Fix a bug where only satellites with a low id were marked active

replace/33e3ae66d5716f11d67ce2faada84e251f5faa19
Niccolò Izzo 2021-02-13 13:49:03 +01:00
rodzic 7577b4d6ae
commit a163bc6998
4 zmienionych plików z 5 dodań i 5 usunięć

Wyświetl plik

@ -269,7 +269,7 @@ void gfx_drawSmeter(point_t start, uint16_t width, uint16_t height, float rssi,
* @param sats: pointer to the array of satellites data * @param sats: pointer to the array of satellites data
* @param active_sats: bitset representing which sats are part of the fix * @param active_sats: bitset representing which sats are part of the fix
*/ */
void gfx_drawGPSgraph(point_t start, uint16_t width, uint16_t height, sat_t *sats, uint16_t active_sats); void gfx_drawGPSgraph(point_t start, uint16_t width, uint16_t height, sat_t *sats, uint32_t active_sats);
/** /**
* Function to draw a compass of arbitrary size. * Function to draw a compass of arbitrary size.

Wyświetl plik

@ -49,7 +49,7 @@ typedef struct
uint8_t satellites_tracked; // Number of tracked satellites uint8_t satellites_tracked; // Number of tracked satellites
uint8_t satellites_in_view; // Satellites in view uint8_t satellites_in_view; // Satellites in view
sat_t satellites[12]; // Details about satellites in view sat_t satellites[12]; // Details about satellites in view
uint16_t active_sats; // Bitmap representing which sats are part of the fix uint32_t active_sats; // Bitmap representing which sats are part of the fix
float latitude; // Latitude coordinates float latitude; // Latitude coordinates
float longitude; // Longitude coordinates float longitude; // Longitude coordinates
float altitude; // Antenna altitude above mean sea level (geoid) in m float altitude; // Antenna altitude above mean sea level (geoid) in m

Wyświetl plik

@ -67,7 +67,7 @@ void gps_taskFunc(char *line, int len, gps_t *state)
{ {
if (frame.sats[i] != 0) if (frame.sats[i] != 0)
{ {
state->active_sats |= 1 << frame.sats[i]; state->active_sats |= 1 << (frame.sats[i] - 1);
} }
} }
} }

Wyświetl plik

@ -642,7 +642,7 @@ void gfx_drawGPSgraph(point_t start,
uint16_t width, uint16_t width,
uint16_t height, uint16_t height,
sat_t *sats, sat_t *sats,
uint16_t active_sats) uint32_t active_sats)
{ {
color_t white = {255, 255, 255, 255}; color_t white = {255, 255, 255, 255};
color_t yellow = {250, 180, 19 , 255}; color_t yellow = {250, 180, 19 , 255};
@ -656,7 +656,7 @@ void gfx_drawGPSgraph(point_t start,
bar_height = (height - 8) * sats[i].snr / 100 + 1; bar_height = (height - 8) * sats[i].snr / 100 + 1;
point_t bar_pos = {start.x + 2 + i * (bar_width + 2), point_t bar_pos = {start.x + 2 + i * (bar_width + 2),
start.y + (height - 8) - bar_height}; start.y + (height - 8) - bar_height};
color_t bar_color = (active_sats & 1 << sats[i].id) ? yellow : white; color_t bar_color = (active_sats & 1 << (sats[i].id - 1)) ? yellow : white;
gfx_drawRect(bar_pos, bar_width, bar_height, bar_color, true); gfx_drawRect(bar_pos, bar_width, bar_height, bar_color, true);
snprintf(id_buf, 5, "%2d ", sats[i].id); snprintf(id_buf, 5, "%2d ", sats[i].id);
point_t id_pos = {bar_pos.x, start.y + height}; point_t id_pos = {bar_pos.x, start.y + height};