Skip to content

Commit

Permalink
osd: ensure status is properly reset
Browse files Browse the repository at this point in the history
  • Loading branch information
bkleiner committed Jun 26, 2024
1 parent eea601f commit d32c1e4
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 0 deletions.
6 changes: 6 additions & 0 deletions src/io/quic.c
Original file line number Diff line number Diff line change
Expand Up @@ -503,6 +503,9 @@ static void process_osd(quic_t *quic, cbor_value_t *dec) {
check_cbor_error(QUIC_CMD_GET);

quic_send(quic, QUIC_CMD_OSD, QUIC_FLAG_NONE, encode_buffer, cbor_encoder_len(&enc));

osd_clear();
osd_display_reset();
break;
}
case QUIC_OSD_WRITE_CHAR: {
Expand All @@ -517,6 +520,9 @@ static void process_osd(quic_t *quic, cbor_value_t *dec) {
check_cbor_error(QUIC_CMD_SET);

quic_send(quic, QUIC_CMD_OSD, QUIC_FLAG_NONE, encode_buffer, cbor_encoder_len(&enc));

osd_clear();
osd_display_reset();
break;
}
#endif
Expand Down
2 changes: 2 additions & 0 deletions src/osd/render.c
Original file line number Diff line number Diff line change
Expand Up @@ -125,6 +125,8 @@ static uint32_t *osd_elements() {
}

void osd_display_reset() {
osd_status_reset();

osd_state.element = OSD_CALLSIGN;

osd_state.screen = OSD_SCREEN_REGULAR;
Expand Down
5 changes: 5 additions & 0 deletions src/osd/status.c
Original file line number Diff line number Diff line change
Expand Up @@ -132,6 +132,11 @@ static bool osd_status_print(osd_element_t *el) {
return true;
}

void osd_status_reset() {
current_status.entry = STATUS_MAX;
current_status.state = PRINT_IDLE;
}

bool osd_status_update(osd_element_t *el) {
if (!flags.rx_ready) {
osd_status_show(MODE_HOLD, STATUS_RX_WAIT);
Expand Down
1 change: 1 addition & 0 deletions src/osd/status.h
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,5 @@

#include "osd/render.h"

void osd_status_reset();
bool osd_status_update(osd_element_t *el);

0 comments on commit d32c1e4

Please sign in to comment.