diff --git a/openrtx/include/core/settings.h b/openrtx/include/core/settings.h index 8b60c0ec..f5e99804 100644 --- a/openrtx/include/core/settings.h +++ b/openrtx/include/core/settings.h @@ -53,13 +53,12 @@ typedef struct uint8_t voxLevel; // Vox level int8_t utc_timezone; // Timezone, in units of half hours bool gps_enabled; // GPS active - char callsign[10]; // Plaintext callsign, for future use + char callsign[10]; // Plaintext callsign uint8_t display_timer : 4, // Standby timer - _ununsed : 4; + m17_can : 4; // M17 CAN uint8_t vpLevel : 3, // Voice prompt level vpPhoneticSpell : 1, // Phonetic spell enabled _reserved : 4; - } __attribute__((packed)) settings_t; @@ -78,7 +77,7 @@ static const settings_t default_settings = false, // GPS enabled "", // Empty callsign TIMER_30S, // 30 seconds - 0, // not used + 0, // M17 CAN 0, // Voice prompts off 0, // Phonetic spell off 0 // not used diff --git a/openrtx/src/core/threads.c b/openrtx/src/core/threads.c index 1cb7f35c..7c95b34e 100644 --- a/openrtx/src/core/threads.c +++ b/openrtx/src/core/threads.c @@ -98,7 +98,7 @@ void *ui_threadFunc(void *arg) rtx_cfg.txTone = ctcss_tone[state.channel.fm.txTone]; // Copy new M17 CAN, source and destination addresses - rtx_cfg.can = state.m17_data.can; + rtx_cfg.can = state.settings.m17_can; strncpy(rtx_cfg.source_address, state.settings.callsign, 10); strncpy(rtx_cfg.destination_address, state.m17_data.dst_addr, 10); diff --git a/openrtx/src/ui/module17/ui.c b/openrtx/src/ui/module17/ui.c index 9f042ac9..a600e3fd 100644 --- a/openrtx/src/ui/module17/ui.c +++ b/openrtx/src/ui/module17/ui.c @@ -588,11 +588,11 @@ bool _ui_exitStandby(long long now) void _ui_changeCAN(int variation) { // M17 CAN ranges from 0 to 15 - int8_t can = state.m17_data.can + variation; + int8_t can = state.settings.m17_can + variation; if(can > 15) can = 0; if(can < 0) can = 15; - state.m17_data.can = can; + state.settings.m17_can = can; } void _ui_changeTxWiper(int variation) diff --git a/openrtx/src/ui/module17/ui_main.c b/openrtx/src/ui/module17/ui_main.c index 7514c09c..b26f73cf 100644 --- a/openrtx/src/ui/module17/ui_main.c +++ b/openrtx/src/ui/module17/ui_main.c @@ -110,7 +110,7 @@ void _ui_drawModeInfo(ui_state_t* ui_state) "--" : cfg.destination_address; // Print CAN gfx_print(layout.top_pos, layout.top_font, TEXT_ALIGN_RIGHT, - color_white, "CAN %02d", state.m17_data.can); + color_white, "CAN %02d", state.settings.m17_can); gfx_print(layout.line2_pos, layout.line2_font, TEXT_ALIGN_CENTER, color_white, "LAST"); // Print M17 Destination ID on line 2 diff --git a/openrtx/src/ui/module17/ui_menu.c b/openrtx/src/ui/module17/ui_menu.c index 2cb2a9e2..3adb7c57 100644 --- a/openrtx/src/ui/module17/ui_menu.c +++ b/openrtx/src/ui/module17/ui_menu.c @@ -191,17 +191,17 @@ int _ui_getM17EntryName(char *buf, uint8_t max_len, uint8_t index) int _ui_getM17ValueName(char *buf, uint8_t max_len, uint8_t index) { if(index >= m17_num) return -1; - uint16_t value = 0; + switch(index) { case M_CALLSIGN: snprintf(buf, max_len, "%s", last_state.settings.callsign); return 0; case M_CAN: - value = last_state.m17_data.can; + snprintf(buf, max_len, "%d", last_state.settings.m17_can); break; } - snprintf(buf, max_len, "%d", value); + return 0; }