Renamed sat_t data structure to gpssat_t, changed signedness of point_t coordinates from unsigned to signed.

rename sat_t to gpssat_t to avoid future name collisions
allow signed values in point_t to allow relative values
fix crash when attempting to 'draw' negative absolute pixel values (like when zooming a map)
pull/88/head
tarxvf 2022-07-04 23:06:51 -04:00 zatwierdzone przez Silvano Seva
rodzic 54aa794bf8
commit ac3c8ea711
4 zmienionych plików z 9 dodań i 8 usunięć

Wyświetl plik

@ -33,7 +33,7 @@ typedef struct
uint16_t azimuth; // Azimuth in degrees uint16_t azimuth; // Azimuth in degrees
uint8_t snr; // Quality of the signal in range 0-99 uint8_t snr; // Quality of the signal in range 0-99
} }
sat_t; gpssat_t;
/** /**
* Data structure representing the last state received from the GPS module. * Data structure representing the last state received from the GPS module.
@ -45,7 +45,7 @@ typedef struct
uint8_t fix_type; // 0: no fix, 1: 2D, 2: 3D uint8_t fix_type; // 0: no fix, 1: 2D, 2: 3D
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 gpssat_t satellites[12]; // Details about satellites in view
uint32_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

Wyświetl plik

@ -73,8 +73,8 @@ extern "C" {
*/ */
typedef struct point_t typedef struct point_t
{ {
uint16_t x; int16_t x;
uint16_t y; int16_t y;
} point_t; } point_t;
/** /**
@ -329,7 +329,7 @@ void gfx_drawSmeterLevel(point_t start, uint16_t width, uint16_t height, float r
* @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, uint32_t active_sats); void gfx_drawGPSgraph(point_t start, uint16_t width, uint16_t height, gpssat_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

@ -138,7 +138,7 @@ void gps_taskFunc()
// When the first sentence arrives, clear all the old data // When the first sentence arrives, clear all the old data
if (frame.msg_nr == 1) if (frame.msg_nr == 1)
{ {
bzero(&gps_data.satellites[0], 12 * sizeof(sat_t)); bzero(&gps_data.satellites[0], 12 * sizeof(gpssat_t));
} }
gps_data.satellites_in_view = frame.total_sats; gps_data.satellites_in_view = frame.total_sats;

Wyświetl plik

@ -169,7 +169,8 @@ void gfx_fillScreen(color_t color)
inline void gfx_setPixel(point_t pos, color_t color) inline void gfx_setPixel(point_t pos, color_t color)
{ {
if (pos.x >= SCREEN_WIDTH || pos.y >= SCREEN_HEIGHT) if (pos.x >= SCREEN_WIDTH || pos.y >= SCREEN_HEIGHT
|| pos.x < 0 || pos.y < 0)
return; // off the screen return; // off the screen
#ifdef PIX_FMT_RGB565 #ifdef PIX_FMT_RGB565
@ -818,7 +819,7 @@ void gfx_drawSmeterLevel(point_t start, uint16_t width, uint16_t height, float r
void gfx_drawGPSgraph(point_t start, void gfx_drawGPSgraph(point_t start,
uint16_t width, uint16_t width,
uint16_t height, uint16_t height,
sat_t *sats, gpssat_t *sats,
uint32_t active_sats) uint32_t active_sats)
{ {
color_t white = {255, 255, 255, 255}; color_t white = {255, 255, 255, 255};