diff --git a/src/main.c b/src/main.c index 2aad978..af73129 100644 --- a/src/main.c +++ b/src/main.c @@ -3,6 +3,7 @@ #include #include #include +#include #include #include "hmi_msg.h" #include "uart-wrapper.h" @@ -80,7 +81,10 @@ static inline void search_month() { static inline void heartbeat() { static uint32_t last_time; - uint32_t cur_time = time; + uint32_t cur_time; + ATOMIC_BLOCK(ATOMIC_FORCEON) { + cur_time = time; + } if ((last_time - cur_time) > 0) { // Toggle led on arduino pin 25 PORTA ^= _BV(PORTA3); diff --git a/src/uart-wrapper.c b/src/uart-wrapper.c index 571e628..c086a0b 100644 --- a/src/uart-wrapper.c +++ b/src/uart-wrapper.c @@ -29,5 +29,5 @@ int uart3_putchar(char c, FILE *stream) int uart0_getchar(FILE *stream) { (void) stream; - return (unsigned char)uart0_getc(); + return uart0_getc() & 0xff; }