Permalink
Browse files

System ticks counter is now stored in eeprom

  • Loading branch information...
1 parent 2c704b5 commit b36771cc232b6ebffee70e63aebbf23718d16a64 @jonsowman jonsowman committed Mar 26, 2012
Showing with 12 additions and 8 deletions.
  1. +8 −4 firmware/main.c
  2. +4 −4 firmware/main.eep
View
@@ -23,6 +23,7 @@
// 30kHz range on COARSE, 3kHz on FINE
char s[100];
+uint32_t EEMEM ticks = 0;
int main()
{
@@ -42,13 +43,16 @@ int main()
radio_set_baud(RADIO_BAUD_300);
int32_t lat = 0, lon = 0, alt = 0;
- uint32_t ticks = 0;
uint8_t hour = 0, minute = 0, second = 0, lock = 0, sats = 0;
while(true)
{
- // Get temperature
led_set(LED_GREEN, 1);
+
+ // Get the current system tick and increment
+ uint32_t tick = eeprom_read_dword(&ticks) + 1;
+
+ // Get temperature from the TMP102
//int16_t temperature = temperature_read();
int16_t temperature = 0;
@@ -68,12 +72,12 @@ int main()
alt /= 1000;
sprintf(s, "$$JOEY,%lu,%02u:%02u:%02u,%02.7f,%03.7f,%ld,%d,%u,%x",
- ticks, hour, minute, second, lat_fmt, lon_fmt, alt, temperature,
+ tick, hour, minute, second, lat_fmt, lon_fmt, alt, temperature,
sats, lock);
radio_transmit_sentence(s);
led_set(LED_RED, 0);
- ticks++;
+ eeprom_update_dword(&ticks, tick);
_delay_ms(1000);
}
View
@@ -1,6 +1,6 @@
:02000004008179
-:1000000004070B0F13171C20252A2F34393E4349B0
-:100010004E545A5F656B71777D82888E949AA0A545
-:10002000ABB1B6BCC1C6CBD0D5DADFE3E8ECF0F4B7
-:02003000F8FBDB
+:100000000000000004070B0F13171C20252A2F34B3
+:10001000393E43494E545A5F656B71777D82888EB5
+:10002000949AA0A5ABB1B6BCC1C6CBD0D5DADFE3FC
+:06003000E8ECF0F4F8FB1F
:00000001FF

0 comments on commit b36771c

Please sign in to comment.