diff --git a/openrtx/include/ui/ui_mod17.h b/openrtx/include/ui/ui_mod17.h index f63b6157..175cf3ed 100644 --- a/openrtx/include/ui/ui_mod17.h +++ b/openrtx/include/ui/ui_mod17.h @@ -129,7 +129,7 @@ enum module17Items D_RXWIPER, D_TXINVERT, D_RXINVERT, - D_SAVE + D_MICGAIN }; /** diff --git a/openrtx/src/ui/module17/ui.c b/openrtx/src/ui/module17/ui.c index 4c88c6c0..e0788801 100644 --- a/openrtx/src/ui/module17/ui.c +++ b/openrtx/src/ui/module17/ui.c @@ -98,10 +98,11 @@ const char *display_items[] = const char *module17_items[] = { - "TX Wiper", - "RX Wiper", - "TX Phase Inversion", - "RX Phase Inversion" + "TX Softpot", + "RX Softpot", + "TX Phase", + "RX Phase", + "Mic Gain" }; #ifdef GPS_PRESENT @@ -605,6 +606,15 @@ void _ui_changeRxInvert(int variation) mod17CalData.rx_invert += variation; } +void _ui_changeMicGain(int variation) +{ + mod17CalData.mic_gain += variation; + + // Mic gain can be between 0 and 2 + if(mod17CalData.mic_gain > 2) mod17CalData.mic_gain = 2; + if(mod17CalData.mic_gain < 0) mod17CalData.mic_gain = 0; +} + void _ui_menuUp(uint8_t menu_entries) { if(ui_state.menu_selected > 0) @@ -1236,6 +1246,9 @@ void ui_updateFSM(bool *sync_rtx) case D_RXINVERT: _ui_changeRxInvert(-1); break; + case D_MICGAIN: + _ui_changeMicGain(-1); + break; default: state.ui_screen = SETTINGS_MODULE17; } @@ -1257,6 +1270,9 @@ void ui_updateFSM(bool *sync_rtx) case D_RXINVERT: _ui_changeRxInvert(+1); break; + case D_MICGAIN: + _ui_changeMicGain(+1); + break; default: state.ui_screen = SETTINGS_MODULE17; } @@ -1268,7 +1284,10 @@ void ui_updateFSM(bool *sync_rtx) else if(msg.keys & KEY_ENTER) ui_state.edit_mode = !ui_state.edit_mode; else if(msg.keys & KEY_ESC) + { + // TODO save settings to non-volatile memory _ui_menuBack(MENU_SETTINGS); + } break; } } diff --git a/openrtx/src/ui/module17/ui_menu.c b/openrtx/src/ui/module17/ui_menu.c index 283c2fb9..f08f5e39 100644 --- a/openrtx/src/ui/module17/ui_menu.c +++ b/openrtx/src/ui/module17/ui_menu.c @@ -52,6 +52,19 @@ const char *display_timer_values[] = "1 hour" }; +const char *mic_gain_values[] = +{ + "40 dB", + "50 dB", + "60 dB" +}; + +const char *phase_values[] = +{ + "Normal", + "Inverted" +}; + void _ui_drawMenuList(uint8_t selected, int (*getCurrentEntry)(char *buf, uint8_t max_len, uint8_t index)) { point_t pos = layout.line1_pos; @@ -178,23 +191,26 @@ int _ui_getModule17EntryName(char *buf, uint8_t max_len, uint8_t index) int _ui_getModule17ValueName(char *buf, uint8_t max_len, uint8_t index) { if(index >= module17_num) return -1; - uint16_t value = 0; + switch(index) { case D_TXWIPER: - value = mod17CalData.tx_wiper; + snprintf(buf, max_len, "%d", mod17CalData.tx_wiper); break; case D_RXWIPER: - value = mod17CalData.rx_wiper; + snprintf(buf, max_len, "%d", mod17CalData.rx_wiper); break; case D_TXINVERT: - value = mod17CalData.tx_invert; + snprintf(buf, max_len, "%s", phase_values[mod17CalData.tx_invert]); break; case D_RXINVERT: - value = mod17CalData.rx_invert; + snprintf(buf, max_len, "%s", phase_values[mod17CalData.rx_invert]); + break; + case D_MICGAIN: + snprintf(buf, max_len, "%s", mic_gain_values[mod17CalData.mic_gain]); break; } - snprintf(buf, max_len, "%d", value); + return 0; }