kopia lustrzana https://github.com/OpenRTX/OpenRTX
Added CONFIG_M17 macro to enable M17 support on each target
rodzic
24c4a25b2d
commit
dc930f4a4b
|
@ -98,7 +98,9 @@ enum settingsItems
|
|||
S_GPS,
|
||||
#endif
|
||||
S_RADIO,
|
||||
#ifdef CONFIG_M17
|
||||
S_M17,
|
||||
#endif
|
||||
S_ACCESSIBILITY,
|
||||
S_RESET2DEFAULTS,
|
||||
};
|
||||
|
|
|
@ -19,6 +19,9 @@
|
|||
***************************************************************************/
|
||||
|
||||
#include <M17/M17DSP.hpp>
|
||||
#include <hwconfig.h>
|
||||
|
||||
#ifdef CONFIG_M17
|
||||
Fir< std::tuple_size< decltype(M17::rrc_taps_48k) >::value > M17::rrc_48k(M17::rrc_taps_48k);
|
||||
Fir< std::tuple_size< decltype(M17::rrc_taps_24k) >::value > M17::rrc_24k(M17::rrc_taps_24k);
|
||||
#endif
|
||||
|
|
|
@ -19,6 +19,7 @@
|
|||
***************************************************************************/
|
||||
|
||||
#include <interfaces/radio.h>
|
||||
#include <hwconfig.h>
|
||||
#include <string.h>
|
||||
#include <rtx.h>
|
||||
#include <OpMode_FM.hpp>
|
||||
|
@ -33,7 +34,10 @@ static bool reinitFilter; // Flag for RSSI filter re-initialisatio
|
|||
static OpMode *currMode; // Pointer to currently active opMode handler
|
||||
static OpMode noMode; // Empty opMode handler for opmode::NONE
|
||||
static OpMode_FM fmMode; // FM mode handler
|
||||
#ifdef CONFIG_M17
|
||||
static OpMode_M17 m17Mode; // M17 mode handler
|
||||
#endif
|
||||
|
||||
|
||||
void rtx_init(pthread_mutex_t *m)
|
||||
{
|
||||
|
@ -151,7 +155,9 @@ void rtx_task()
|
|||
{
|
||||
case OPMODE_NONE: currMode = &noMode; break;
|
||||
case OPMODE_FM: currMode = &fmMode; break;
|
||||
#ifdef CONFIG_M17
|
||||
case OPMODE_M17: currMode = &m17Mode; break;
|
||||
#endif
|
||||
default: currMode = &noMode;
|
||||
}
|
||||
|
||||
|
|
|
@ -140,7 +140,9 @@ const char *settings_items[] =
|
|||
"GPS",
|
||||
#endif
|
||||
"Radio",
|
||||
#ifdef CONFIG_M17
|
||||
"M17",
|
||||
#endif
|
||||
"Accessibility",
|
||||
"Default Settings"
|
||||
};
|
||||
|
@ -257,7 +259,9 @@ const uint8_t display_num = sizeof(display_items)/sizeof(display_items[0]);
|
|||
const uint8_t settings_gps_num = sizeof(settings_gps_items)/sizeof(settings_gps_items[0]);
|
||||
#endif
|
||||
const uint8_t settings_radio_num = sizeof(settings_radio_items)/sizeof(settings_radio_items[0]);
|
||||
#ifdef CONFIG_M17
|
||||
const uint8_t settings_m17_num = sizeof(settings_m17_items)/sizeof(settings_m17_items[0]);
|
||||
#endif
|
||||
const uint8_t settings_accessibility_num = sizeof(settings_accessibility_items)/sizeof(settings_accessibility_items[0]);
|
||||
const uint8_t backup_restore_num = sizeof(backup_restore_items)/sizeof(backup_restore_items[0]);
|
||||
const uint8_t info_num = sizeof(info_items)/sizeof(info_items[0]);
|
||||
|
@ -783,11 +787,13 @@ static void _ui_changeMacroLatch(bool newVal)
|
|||
state.settings.macroMenuLatch);
|
||||
}
|
||||
|
||||
#ifdef CONFIG_M17
|
||||
static inline void _ui_changeM17Can(int variation)
|
||||
{
|
||||
uint8_t can = state.settings.m17_can;
|
||||
state.settings.m17_can = (can + variation) % 16;
|
||||
}
|
||||
#endif
|
||||
|
||||
static void _ui_changeVoiceLevel(int variation)
|
||||
{
|
||||
|
@ -978,11 +984,13 @@ static void _ui_fsm_menuMacro(kbd_msg_t msg, bool *sync_rtx)
|
|||
break;
|
||||
case 5:
|
||||
// Cycle through radio modes
|
||||
#ifdef CONFIG_M17
|
||||
if(state.channel.mode == OPMODE_FM)
|
||||
state.channel.mode = OPMODE_M17;
|
||||
else if(state.channel.mode == OPMODE_M17)
|
||||
state.channel.mode = OPMODE_FM;
|
||||
else //catch any invalid states so they don't get locked out
|
||||
#endif
|
||||
state.channel.mode = OPMODE_FM;
|
||||
*sync_rtx = true;
|
||||
vp_announceRadioMode(state.channel.mode, queueFlags);
|
||||
|
@ -1451,6 +1459,7 @@ void ui_updateFSM(bool *sync_rtx)
|
|||
|
||||
if(ui_state.edit_mode)
|
||||
{
|
||||
#ifdef CONFIG_M17
|
||||
if(state.channel.mode == OPMODE_M17)
|
||||
{
|
||||
if(msg.keys & KEY_ENTER)
|
||||
|
@ -1482,6 +1491,7 @@ void ui_updateFSM(bool *sync_rtx)
|
|||
_ui_textInputKeypad(ui_state.new_callsign, 9, msg, true);
|
||||
break;
|
||||
}
|
||||
#endif
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -1511,6 +1521,7 @@ void ui_updateFSM(bool *sync_rtx)
|
|||
}
|
||||
else if(msg.keys & KEY_HASH)
|
||||
{
|
||||
#ifdef CONFIG_M17
|
||||
// Only enter edit mode when using M17
|
||||
if(state.channel.mode == OPMODE_M17)
|
||||
{
|
||||
|
@ -1522,6 +1533,7 @@ void ui_updateFSM(bool *sync_rtx)
|
|||
queueFlags);
|
||||
}
|
||||
else
|
||||
#endif
|
||||
{
|
||||
if(!state.tone_enabled)
|
||||
{
|
||||
|
@ -1567,8 +1579,8 @@ void ui_updateFSM(bool *sync_rtx)
|
|||
state.bank, vpAllInfo);
|
||||
else
|
||||
vp_replayLastPrompt();
|
||||
f1Handled = true;
|
||||
}
|
||||
f1Handled = true;
|
||||
}
|
||||
}
|
||||
else if(input_isNumberPressed(msg))
|
||||
{
|
||||
|
@ -1911,9 +1923,11 @@ void ui_updateFSM(bool *sync_rtx)
|
|||
case S_RADIO:
|
||||
state.ui_screen = SETTINGS_RADIO;
|
||||
break;
|
||||
#ifdef CONFIG_M17
|
||||
case S_M17:
|
||||
state.ui_screen = SETTINGS_M17;
|
||||
break;
|
||||
#endif
|
||||
case S_ACCESSIBILITY:
|
||||
state.ui_screen = SETTINGS_ACCESSIBILITY;
|
||||
break;
|
||||
|
@ -2230,6 +2244,7 @@ void ui_updateFSM(bool *sync_rtx)
|
|||
else if(msg.keys & KEY_ESC)
|
||||
_ui_menuBack(MENU_SETTINGS);
|
||||
break;
|
||||
#ifdef CONFIG_M17
|
||||
// M17 Settings
|
||||
case SETTINGS_M17:
|
||||
if(ui_state.edit_mode)
|
||||
|
@ -2325,6 +2340,7 @@ void ui_updateFSM(bool *sync_rtx)
|
|||
}
|
||||
}
|
||||
break;
|
||||
#endif
|
||||
case SETTINGS_ACCESSIBILITY:
|
||||
if(msg.keys & KEY_LEFT || (ui_state.edit_mode &&
|
||||
(msg.keys & KEY_DOWN || msg.keys & KNOB_LEFT)))
|
||||
|
@ -2546,10 +2562,12 @@ bool ui_updateGUI()
|
|||
_ui_drawSettingsGPS(&ui_state);
|
||||
break;
|
||||
#endif
|
||||
#ifdef CONFIG_M17
|
||||
// M17 settings screen
|
||||
case SETTINGS_M17:
|
||||
_ui_drawSettingsM17(&ui_state);
|
||||
break;
|
||||
#endif
|
||||
case SETTINGS_ACCESSIBILITY:
|
||||
_ui_drawSettingsAccessibility(&ui_state);
|
||||
break;
|
||||
|
|
|
@ -116,6 +116,7 @@ void _ui_drawModeInfo(ui_state_t* ui_state)
|
|||
color_white, "DMR TG%s", "");
|
||||
break;
|
||||
|
||||
#ifdef CONFIG_M17
|
||||
case OPMODE_M17:
|
||||
{
|
||||
// Print M17 Destination ID on line 3 of 3
|
||||
|
@ -177,6 +178,7 @@ void _ui_drawModeInfo(ui_state_t* ui_state)
|
|||
}
|
||||
break;
|
||||
}
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -276,6 +278,7 @@ void _ui_drawMainBottom()
|
|||
volume,
|
||||
true);
|
||||
break;
|
||||
#ifdef CONFIG_M17
|
||||
case OPMODE_M17:
|
||||
gfx_drawSmeterLevel(meter_pos,
|
||||
meter_width,
|
||||
|
@ -285,6 +288,7 @@ void _ui_drawMainBottom()
|
|||
volume,
|
||||
true);
|
||||
break;
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -294,9 +298,11 @@ void _ui_drawMainVFO(ui_state_t* ui_state)
|
|||
_ui_drawMainTop(ui_state);
|
||||
_ui_drawModeInfo(ui_state);
|
||||
|
||||
#ifdef CONFIG_M17
|
||||
// Show VFO frequency if the OpMode is not M17 or there is no valid LSF data
|
||||
rtxStatus_t status = rtx_getCurrentStatus();
|
||||
if((status.opMode != OPMODE_M17) || (status.lsfOk == false))
|
||||
#endif
|
||||
_ui_drawFrequency();
|
||||
|
||||
_ui_drawMainBottom();
|
||||
|
@ -316,9 +322,11 @@ void _ui_drawMainMEM(ui_state_t* ui_state)
|
|||
_ui_drawMainTop(ui_state);
|
||||
_ui_drawModeInfo(ui_state);
|
||||
|
||||
#ifdef CONFIG_M17
|
||||
// Show channel data if the OpMode is not M17 or there is no valid LSF data
|
||||
rtxStatus_t status = rtx_getCurrentStatus();
|
||||
if((status.opMode != OPMODE_M17) || (status.lsfOk == false))
|
||||
#endif
|
||||
{
|
||||
_ui_drawBankChannel();
|
||||
_ui_drawFrequency();
|
||||
|
|
|
@ -375,6 +375,7 @@ int _ui_getRadioValueName(char *buf, uint8_t max_len, uint8_t index)
|
|||
return 0;
|
||||
}
|
||||
|
||||
#ifdef CONFIG_M17
|
||||
int _ui_getM17EntryName(char *buf, uint8_t max_len, uint8_t index)
|
||||
{
|
||||
if(index >= settings_m17_num) return -1;
|
||||
|
@ -405,6 +406,7 @@ int _ui_getM17ValueName(char *buf, uint8_t max_len, uint8_t index)
|
|||
|
||||
return 0;
|
||||
}
|
||||
#endif
|
||||
|
||||
int _ui_getAccessibilityEntryName(char *buf, uint8_t max_len, uint8_t index)
|
||||
{
|
||||
|
@ -881,6 +883,7 @@ void _ui_drawSettingsTimeDateSet(ui_state_t* ui_state)
|
|||
}
|
||||
#endif
|
||||
|
||||
#ifdef CONFIG_M17
|
||||
void _ui_drawSettingsM17(ui_state_t* ui_state)
|
||||
{
|
||||
gfx_clearScreen();
|
||||
|
@ -908,6 +911,7 @@ void _ui_drawSettingsM17(ui_state_t* ui_state)
|
|||
_ui_getM17ValueName);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
void _ui_drawSettingsAccessibility(ui_state_t* ui_state)
|
||||
{
|
||||
|
@ -1041,6 +1045,7 @@ bool _ui_drawMacroMenu(ui_state_t* ui_state)
|
|||
gfx_print(layout.line1_pos, layout.top_font, TEXT_ALIGN_CENTER,
|
||||
color_white, " T+");
|
||||
}
|
||||
#ifdef CONFIG_M17
|
||||
else if (last_state.channel.mode == OPMODE_M17)
|
||||
{
|
||||
gfx_print(layout.line1_pos, layout.top_font, TEXT_ALIGN_LEFT,
|
||||
|
@ -1050,6 +1055,7 @@ bool _ui_drawMacroMenu(ui_state_t* ui_state)
|
|||
gfx_print(layout.line1_pos, layout.top_font, TEXT_ALIGN_CENTER,
|
||||
yellow_fab413, "2");
|
||||
}
|
||||
#endif
|
||||
#if defined(CONFIG_UI_NO_KEYBOARD)
|
||||
if (ui_state->macro_menu_selected == 2)
|
||||
#endif // CONFIG_UI_NO_KEYBOARD
|
||||
|
@ -1072,12 +1078,14 @@ bool _ui_drawMacroMenu(ui_state_t* ui_state)
|
|||
gfx_print(layout.line1_pos, layout.top_font, TEXT_ALIGN_RIGHT,
|
||||
color_white, encdec_str);
|
||||
}
|
||||
#ifdef CONFIG_M17
|
||||
else if (last_state.channel.mode == OPMODE_M17)
|
||||
{
|
||||
char encdec_str[9] = " ";
|
||||
gfx_print(layout.line1_pos, layout.top_font, TEXT_ALIGN_CENTER,
|
||||
color_white, encdec_str);
|
||||
}
|
||||
#endif
|
||||
|
||||
// Second row
|
||||
// Calculate symmetric second row position, line2_pos is asymmetric like main screen
|
||||
|
@ -1109,12 +1117,14 @@ bool _ui_drawMacroMenu(ui_state_t* ui_state)
|
|||
gfx_print(pos_2, layout.top_font, TEXT_ALIGN_LEFT,
|
||||
color_white, bw_str);
|
||||
}
|
||||
#ifdef CONFIG_M17
|
||||
else if (last_state.channel.mode == OPMODE_M17)
|
||||
{
|
||||
gfx_print(pos_2, layout.top_font, TEXT_ALIGN_LEFT,
|
||||
color_white, " ");
|
||||
|
||||
}
|
||||
#endif
|
||||
|
||||
#if defined(CONFIG_UI_NO_KEYBOARD)
|
||||
if (ui_state->macro_menu_selected == 4)
|
||||
|
@ -1131,9 +1141,11 @@ bool _ui_drawMacroMenu(ui_state_t* ui_state)
|
|||
case OPMODE_DMR:
|
||||
snprintf(mode_str, 12," DMR");
|
||||
break;
|
||||
#ifdef CONFIG_M17
|
||||
case OPMODE_M17:
|
||||
snprintf(mode_str, 12," M17");
|
||||
break;
|
||||
#endif
|
||||
}
|
||||
|
||||
gfx_print(pos_2, layout.top_font, TEXT_ALIGN_CENTER,
|
||||
|
|
|
@ -49,6 +49,9 @@ extern "C" {
|
|||
/* Battery type */
|
||||
#define CONFIG_BAT_LIPO_2S
|
||||
|
||||
/* Device supports M17 mode */
|
||||
#define CONFIG_M17
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
|
|
@ -43,6 +43,9 @@ extern "C" {
|
|||
/* Battery type */
|
||||
#define CONFIG_BAT_LIPO_2S
|
||||
|
||||
/* Device supports M17 mode */
|
||||
#define CONFIG_M17
|
||||
|
||||
/*
|
||||
* To enable pwm for display backlight dimming uncomment this directive.
|
||||
*
|
||||
|
|
|
@ -39,4 +39,7 @@
|
|||
/* Device has no battery */
|
||||
#define CONFIG_BAT_NONE
|
||||
|
||||
/* Device supports M17 mode */
|
||||
#define CONFIG_M17
|
||||
|
||||
#endif
|
||||
|
|
|
@ -28,6 +28,9 @@ extern "C" {
|
|||
/* Battery type */
|
||||
#define CONFIG_BAT_LIPO_2S
|
||||
|
||||
/* Device supports M17 mode */
|
||||
#define CONFIG_M17
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
|
|
@ -33,4 +33,6 @@
|
|||
|
||||
#define CONFIG_BAT_LIPO_1S
|
||||
|
||||
#define CONFIG_M17
|
||||
|
||||
#endif /* HWCONFIG_H */
|
||||
|
|
Ładowanie…
Reference in New Issue