Skip to content

Commit

Permalink
feat: gps screens refresh improved
Browse files Browse the repository at this point in the history
  • Loading branch information
Otrebor671 committed Aug 29, 2024
1 parent e32221d commit 5de6b03
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions firmware/main/modules/gps/gps_screens.c
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ void gps_screens_show_help() {

static void gps_screens_update_date_and_time(gps_t* gps) {
char* str = (char*) malloc(20);
oled_screen_clear_buffer();
sprintf(str, "Signal: %s ", gps_module_get_signal_strength(gps));
oled_screen_display_text(str, 0, 0, OLED_DISPLAY_NORMAL);
sprintf(str, "Date: %d/%d/%d", gps->date.year, gps->date.month,
Expand All @@ -28,11 +29,13 @@ static void gps_screens_update_date_and_time(gps_t* gps) {
sprintf(str, "Time: %d:%d:%d", gps->tim.hour, gps->tim.minute,
gps->tim.second);
oled_screen_display_text(str, 0, 3, OLED_DISPLAY_NORMAL);
oled_screen_display_show();
free(str);
}

static void gps_screens_update_location(gps_t* gps) {
char* str = (char*) malloc(20);
oled_screen_clear_buffer();
sprintf(str, "Signal: %s ", gps_module_get_signal_strength(gps));
oled_screen_display_text(str, 0, 0, OLED_DISPLAY_NORMAL);
oled_screen_display_text("Latitude:", 0, 2, OLED_DISPLAY_NORMAL);
Expand All @@ -44,20 +47,25 @@ static void gps_screens_update_location(gps_t* gps) {
oled_screen_display_text("Altitude:", 0, 6, OLED_DISPLAY_NORMAL);
sprintf(str, " %.04fm", gps->altitude);
oled_screen_display_text(str, 0, 7, OLED_DISPLAY_NORMAL);
oled_screen_display_show();
free(str);
}

static void gps_screens_update_speed(gps_t* gps) {
char* str = (char*) malloc(20);
oled_screen_clear_buffer();
sprintf(str, "Signal: %s ", gps_module_get_signal_strength(gps));
oled_screen_display_text(str, 0, 0, OLED_DISPLAY_NORMAL);
sprintf(str, "Speed: %.02fm/s", gps->speed);
oled_screen_display_text(str, 0, 2, OLED_DISPLAY_NORMAL);
oled_screen_display_show();
free(str);
}

void gps_screens_show_waiting_signal() {
oled_screen_clear_buffer();
oled_screen_display_text_center("Waiting Signal", 0, OLED_DISPLAY_NORMAL);
oled_screen_display_show();
}

void gps_screens_update_handler(gps_t* gps) {
Expand Down

0 comments on commit 5de6b03

Please sign in to comment.