diff --git a/openrtx/include/core/settings.h b/openrtx/include/core/settings.h index 851a0b5b..25908e3d 100644 --- a/openrtx/include/core/settings.h +++ b/openrtx/include/core/settings.h @@ -60,6 +60,7 @@ typedef struct vpPhoneticSpell : 1, // Phonetic spell enabled _reserved : 4; bool m17_can_rx; // Check M17 CAN on RX + char m17_dest[10]; // M17 destination } __attribute__((packed)) settings_t; @@ -82,7 +83,8 @@ static const settings_t default_settings = 0, // Voice prompts off 0, // Phonetic spell off 0, // not used - false // Check M17 CAN on RX + false, // Check M17 CAN on RX + "" // Empty M17 destination }; #endif /* SETTINGS_H */ diff --git a/openrtx/include/core/state.h b/openrtx/include/core/state.h index 0671d871..0ae5bde2 100644 --- a/openrtx/include/core/state.h +++ b/openrtx/include/core/state.h @@ -59,7 +59,6 @@ typedef struct bool gpsDetected; bool backup_eflash; bool restore_eflash; - char m17_dest[10]; bool txDisable; uint8_t step_index; } diff --git a/openrtx/src/core/threads.c b/openrtx/src/core/threads.c index 5c0931ab..9b0bf776 100644 --- a/openrtx/src/core/threads.c +++ b/openrtx/src/core/threads.c @@ -107,7 +107,7 @@ void *ui_threadFunc(void *arg) rtx_cfg.can = state.settings.m17_can; rtx_cfg.canRxEn = state.settings.m17_can_rx; strncpy(rtx_cfg.source_address, state.settings.callsign, 10); - strncpy(rtx_cfg.destination_address, state.m17_dest, 10); + strncpy(rtx_cfg.destination_address, state.settings.m17_dest, 10); pthread_mutex_unlock(&rtx_mutex); diff --git a/openrtx/src/core/voicePromptUtils.c b/openrtx/src/core/voicePromptUtils.c index 67556058..64d8d513 100644 --- a/openrtx/src/core/voicePromptUtils.c +++ b/openrtx/src/core/voicePromptUtils.c @@ -532,9 +532,9 @@ void vp_announceM17Info(const channel_t* channel, bool isEditing, { vp_queuePrompt(PROMPT_EDIT); } - else if (state.m17_dest[0] != '\0') + else if (state.settings.m17_dest[0] != '\0') { - vp_queueString(state.m17_dest, vpAnnounceCommonSymbols); + vp_queueString(state.settings.m17_dest, vpAnnounceCommonSymbols); } else if ((channel != NULL) && (channel->m17.contact_index != 0)) { diff --git a/openrtx/src/ui/default/ui.c b/openrtx/src/ui/default/ui.c index 7988635f..47258f7c 100644 --- a/openrtx/src/ui/default/ui.c +++ b/openrtx/src/ui/default/ui.c @@ -1429,7 +1429,7 @@ void ui_updateFSM(bool *sync_rtx) { _ui_textInputConfirm(ui_state.new_callsign); // Save selected dst ID and disable input mode - strncpy(state.m17_dest, ui_state.new_callsign, 10); + strncpy(state.settings.m17_dest, ui_state.new_callsign, 10); ui_state.edit_mode = false; *sync_rtx = true; vp_announceM17Info(NULL, ui_state.edit_mode, @@ -1438,7 +1438,7 @@ void ui_updateFSM(bool *sync_rtx) else if(msg.keys & KEY_HASH) { // Save selected dst ID and disable input mode - strncpy(state.m17_dest, "", 1); + strncpy(state.settings.m17_dest, "", 1); ui_state.edit_mode = false; *sync_rtx = true; vp_announceM17Info(NULL, ui_state.edit_mode, @@ -1614,14 +1614,14 @@ void ui_updateFSM(bool *sync_rtx) { _ui_textInputConfirm(ui_state.new_callsign); // Save selected dst ID and disable input mode - strncpy(state.m17_dest, ui_state.new_callsign, 10); + strncpy(state.settings.m17_dest, ui_state.new_callsign, 10); ui_state.edit_mode = false; *sync_rtx = true; } else if(msg.keys & KEY_HASH) { // Save selected dst ID and disable input mode - strncpy(state.m17_dest, "", 1); + strncpy(state.settings.m17_dest, "", 1); ui_state.edit_mode = false; *sync_rtx = true; } diff --git a/openrtx/src/ui/module17/ui.c b/openrtx/src/ui/module17/ui.c index 088893d4..001f5b6a 100644 --- a/openrtx/src/ui/module17/ui.c +++ b/openrtx/src/ui/module17/ui.c @@ -817,7 +817,7 @@ void ui_updateFSM(bool *sync_rtx) { _ui_textInputConfirm(ui_state.new_callsign); // Save selected callsign and disable input mode - strncpy(state.m17_dest, ui_state.new_callsign, 10); + strncpy(state.settings.m17_dest, ui_state.new_callsign, 10); *sync_rtx = true; ui_state.edit_mode = false; }