Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix for the NMEA GPS text overlay bug #1064

Merged
merged 4 commits into from
Apr 27, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
26 changes: 16 additions & 10 deletions applications/external/gps_nmea/gps.c
Original file line number Diff line number Diff line change
Expand Up @@ -23,13 +23,6 @@ static void render_callback(Canvas* const canvas, void* context) {
furi_mutex_acquire(gps_uart->mutex, FuriWaitForever);

canvas_set_font(canvas, FontPrimary);
canvas_draw_str_aligned(
canvas,
64,
32,
AlignCenter,
AlignBottom,
gps_uart->deep_sleep_enabled ? "Deep sleep enabled" : "Deep sleep disabled");

if(!gps_uart->changing_baudrate) {
canvas_set_font(canvas, FontPrimary);
Expand Down Expand Up @@ -81,7 +74,19 @@ static void render_callback(Canvas* const canvas, void* context) {
gps_uart->status.time_minutes,
gps_uart->status.time_seconds);
canvas_draw_str_aligned(canvas, 96, 62, AlignCenter, AlignBottom, buffer);
} else {
}
if(gps_uart->changing_deepsleep) {
canvas_set_font(canvas, FontPrimary);
canvas_clear(canvas);
canvas_draw_str_aligned(
canvas,
64,
32,
AlignCenter,
AlignBottom,
gps_uart->deep_sleep_enabled ? "Deep sleep enabled" : "Deep sleep disabled");
}
if(gps_uart->changing_baudrate) {
char buffer[64];
canvas_set_font(canvas, FontPrimary);
canvas_draw_str_aligned(canvas, 64, 32, AlignCenter, AlignBottom, "Baudrate set to:");
Expand Down Expand Up @@ -214,7 +219,7 @@ int32_t gps_app(void* p) {
gps_uart->serial_handle,
(uint8_t*)"$PMTK161,0*28\r\n",
strlen("$PMTK161,0*28\r\n"));

gps_uart->changing_deepsleep = true;
furi_mutex_release(gps_uart->mutex);
view_port_update(view_port);
furi_delay_ms(1000);
Expand All @@ -228,12 +233,13 @@ int32_t gps_app(void* p) {
}
}
}
if(!gps_uart->changing_baudrate) {
if((!gps_uart->changing_baudrate) && (!gps_uart->changing_deepsleep)) {
furi_mutex_release(gps_uart->mutex);
view_port_update(view_port);
} else {
furi_delay_ms(1000);
gps_uart->changing_baudrate = false;
gps_uart->changing_deepsleep = false;
}
}

Expand Down
2 changes: 1 addition & 1 deletion applications/external/gps_nmea/gps_uart.c
Original file line number Diff line number Diff line change
Expand Up @@ -213,7 +213,7 @@ GpsUart* gps_uart_enable() {
gps_uart->backlight_on = false;
gps_uart->changing_baudrate = false;
gps_uart->deep_sleep_enabled = false;

gps_uart->view_state = NORMAL;
gps_uart_init_thread(gps_uart);

return gps_uart;
Expand Down
3 changes: 3 additions & 0 deletions applications/external/gps_nmea/gps_uart.h
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,9 @@ typedef struct {
bool backlight_on;
bool changing_baudrate;
bool deep_sleep_enabled;
bool changing_deepsleep;

ViewState view_state;
SpeedUnit speed_units;

FuriHalSerialHandle* serial_handle;
Expand Down