# HG changeset patch # User Ethan Zonca # Date 2016-04-02 22:05:28 # Node ID e1db5d4a8be4ad5f99953ac9894b39d99bddd007 # Parent b295af18d965d790d8f01e9d69e47ff345d7499f Change LED blink rate based on GPS fix status diff --git a/src/main.c b/src/main.c --- a/src/main.c +++ b/src/main.c @@ -138,22 +138,32 @@ int main(void) HAL_Delay(100); uint8_t lastMinute = 0; + uint16_t blink_rate = 250; while (1) { if(HAL_GetTick() - last_wspr > 500) { + if(get_hdop()[0] == '9' && get_hdop()[1] == '9') + blink_rate = 250; + else + blink_rate = 100; + volatile uint8_t minute = get_timestamp()[3] - 0x30; // If last minute was odd and this minute is even (transition) if(lastMinute%2 == 1 && minute%2 == 0) + { + // Wait until the first second of the minute + HAL_Delay(1000); encode_wspr(); + } lastMinute = minute; last_wspr = HAL_GetTick(); } - if(HAL_GetTick() - led_timer > 100) + if(HAL_GetTick() - led_timer > blink_rate) { HAL_GPIO_TogglePin(LED_BLUE); led_timer = HAL_GetTick();