[New Feature] LED indicates position lock

Signed-off-by: Richard Eoin Meadows <richardeoin@gmail.com>
rocketry
Richard Eoin Meadows 2014-10-24 19:33:54 +01:00
rodzic 64e7847459
commit a5389fbb99
3 zmienionych plików z 21 dodań i 2 usunięć

Wyświetl plik

@ -40,6 +40,8 @@ struct ubx_nav_posllh gps_get_nav_posllh();
struct ubx_nav_sol gps_get_nav_sol();
struct ubx_nav_timeutc gps_get_nav_timeutc();
uint8_t gps_is_locked(void);
void gps_init(void);
void usart_loopback_test(void);

Wyświetl plik

@ -315,6 +315,15 @@ struct ubx_nav_timeutc gps_get_nav_timeutc()
{
return ubx_nav_timeutc;
}
/**
* Returns if the GPS has a position lock
*/
uint8_t gps_is_locked(void)
{
return (ubx_nav_sol.payload.gpsFix == 0x2) ||
(ubx_nav_sol.payload.gpsFix == 0x3) ||
(ubx_nav_sol.payload.gpsFix == 0x4);
}
/**
* Verify that the uBlox 6 GPS receiver is set to the <1g airborne

Wyświetl plik

@ -236,11 +236,19 @@ int main(void)
gps_update(); /* Request updates from the gps */
led_on();
if (gps_is_locked()) {
led_on();
} else {
led_off();
}
gps_update_wait(); /* Wait for the gps update */
led_off();
if (gps_is_locked()) {
led_off();
} else {
led_on();
}
/* Set the next packet */
set_telemetry_string();