Moved M17 destination callsign directly inside radio state data structure

This commit is contained in:
Silvano Seva 2023-05-28 11:41:59 +02:00
parent 423183700c
commit 2f0d56a8e0
4 changed files with 8 additions and 19 deletions

View File

@ -29,17 +29,6 @@
#include <cps.h>
#include <gps.h>
/**
* Data structure representing the settings of the M17 mode.
*/
typedef struct
{
char dst_addr[10]; // Destination callsign
uint8_t can; // Channel Access Number
}
m17_t;
/**
* Part of this structure has been commented because the corresponding
* functionality is not yet implemented.
@ -70,7 +59,7 @@ typedef struct
bool gpsDetected;
bool backup_eflash;
bool restore_eflash;
m17_t m17_data;
char m17_dest[10];
}
state_t;

View File

@ -100,7 +100,7 @@ void *ui_threadFunc(void *arg)
// Copy new M17 CAN, source and destination addresses
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);
strncpy(rtx_cfg.destination_address, state.m17_dest, 10);
pthread_mutex_unlock(&rtx_mutex);

View File

@ -532,9 +532,9 @@ void vp_announceM17Info(const channel_t* channel, bool isEditing,
{
vp_queuePrompt(PROMPT_EDIT);
}
else if (state.m17_data.dst_addr[0] != '\0')
else if (state.m17_dest[0] != '\0')
{
vp_queueString(state.m17_data.dst_addr, vpAnnounceCommonSymbols);
vp_queueString(state.m17_dest, vpAnnounceCommonSymbols);
}
else if ((channel != NULL) && (channel->m17.contact_index != 0))
{

View File

@ -1278,7 +1278,7 @@ void ui_updateFSM(bool *sync_rtx)
{
_ui_textInputConfirm(ui_state.new_callsign);
// Save selected dst ID and disable input mode
strncpy(state.m17_data.dst_addr, ui_state.new_callsign, 10);
strncpy(state.m17_dest, ui_state.new_callsign, 10);
ui_state.edit_mode = false;
*sync_rtx = true;
vp_announceM17Info(NULL, ui_state.edit_mode,
@ -1287,7 +1287,7 @@ void ui_updateFSM(bool *sync_rtx)
else if(msg.keys & KEY_HASH)
{
// Save selected dst ID and disable input mode
strncpy(state.m17_data.dst_addr, "", 1);
strncpy(state.m17_dest, "", 1);
ui_state.edit_mode = false;
*sync_rtx = true;
vp_announceM17Info(NULL, ui_state.edit_mode,
@ -1443,14 +1443,14 @@ void ui_updateFSM(bool *sync_rtx)
{
_ui_textInputConfirm(ui_state.new_callsign);
// Save selected dst ID and disable input mode
strncpy(state.m17_data.dst_addr, ui_state.new_callsign, 10);
strncpy(state.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_data.dst_addr, "", 1);
strncpy(state.m17_dest, "", 1);
ui_state.edit_mode = false;
*sync_rtx = true;
}