From 63fe6ab10a93c6b0f44d6459300af88eedac1e39 Mon Sep 17 00:00:00 2001 From: Eggert Jung Date: Sat, 21 Sep 2019 23:25:38 +0200 Subject: [PATCH] use LED_C gps signal indicator --- code/src/main.c | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/code/src/main.c b/code/src/main.c index 3ea2fb0..53baf55 100644 --- a/code/src/main.c +++ b/code/src/main.c @@ -219,7 +219,6 @@ void set_PWM_duty(int dutycycle){ ISR (TIMER1_OVF_vect) // Timer1 ISR { //PORTD ^=TUBE_LED; - PORTB ^=STATUS_LED_C; TCNT1 = 63974; //63974; // for 1 sec at 16 MHz animationtimer ++; if(animationtimer > 10){ @@ -257,14 +256,17 @@ ISR(USART0_RX_vect) async_input_buffer[async_buffer_pointer]=data; async_buffer_pointer++; } - else if(async_buffer_pointer>0){ + else if(async_buffer_pointer > 0){ async_input_buffer[async_buffer_pointer] = 0; // Null terminate string async_buffer_pointer=0; - PORTB ^=STATUS_LED_C; - uint8_t test[3]; - if(!parse_nmea_gps(async_input_buffer, test)){ - printf("parse: %x %x %x\n\r", test[2], test[1], test[0]); - DS3231_write(test); + uint8_t bcd_time[3]; + + /* write to RTC if time is valid */ + if(!parse_nmea_gps(async_input_buffer, bcd_time)){ + DS3231_write(bcd_time); + PORTB |= STATUS_LED_C; + } else { + PORTB &= ~STATUS_LED_C; } } }