]> www.fi.muni.cz Git - bike-lights.git/blobdiff - firmware/logging.c
mudflap for dual rearlights
[bike-lights.git] / firmware / logging.c
index 2b8d242e7156215af1284c1708e609e37d19ff98..44e2c39de2ea09ca31ce3722b7f16aaaf4a3ba95 100644 (file)
@@ -5,7 +5,7 @@
 
 #include "lights.h"
 
-#define LOG_BUFFER 128
+#define LOG_BUFFER 64
 static unsigned char log_buffer_ee[LOG_BUFFER] EEMEM;
 static unsigned char log_buffer_count;
 static unsigned char log_buffer[LOG_BUFFER];
@@ -21,7 +21,7 @@ void log_set_state(unsigned char val)
                eeprom_write_byte(&log_state, val);
 }
 
-void init_log()
+void init_log(unsigned char mcusr)
 {
        unsigned char r_count;
 
@@ -31,8 +31,7 @@ void init_log()
        if (r_count < 5) {
                r_count++;
                eeprom_write_byte(&reboot_count,
-                       (r_count << 4) | (MCUSR & 0xF));
-               MCUSR = 0;
+                       (r_count << 4) | (mcusr & 0xF));
                can_write_eeprom = 1;
        } else {
                //eeprom_write_byte(&log_state, 0xFF);