Add enum for TR/TX mode

This commit is contained in:
Juan Antonio
2023-12-05 17:17:52 +01:00
committed by Krzysiek Egzmont
parent cd032c39d2
commit c76a96c3ad
2 changed files with 15 additions and 9 deletions

View File

@@ -341,10 +341,10 @@ void UI_DisplayMain(void)
const unsigned int line0 = 0; // text screen line const unsigned int line0 = 0; // text screen line
const unsigned int line1 = 4; const unsigned int line1 = 4;
const unsigned int line = (vfo_num == 0) ? line0 : line1; const unsigned int line = (vfo_num == 0) ? line0 : line1;
const bool isMainVFO = (vfo_num == gEeprom.TX_VFO); const bool isMainVFO = (vfo_num == gEeprom.TX_VFO);
uint8_t *p_line0 = gFrameBuffer[line + 0]; uint8_t *p_line0 = gFrameBuffer[line + 0];
uint8_t *p_line1 = gFrameBuffer[line + 1]; uint8_t *p_line1 = gFrameBuffer[line + 1];
unsigned int mode = 0; enum Vfo_txtr_mode mode = VFO_MODE_NONE;
if (activeTxVFO != vfo_num) // this is not active TX VFO if (activeTxVFO != vfo_num) // this is not active TX VFO
{ {
@@ -426,13 +426,13 @@ void UI_DisplayMain(void)
#ifdef ENABLE_ALARM #ifdef ENABLE_ALARM
if (gAlarmState == ALARM_STATE_SITE_ALARM) if (gAlarmState == ALARM_STATE_SITE_ALARM)
mode = 2; mode = VFO_MODE_RX;
else else
#endif #endif
{ {
if (activeTxVFO == vfo_num) if (activeTxVFO == vfo_num)
{ // show the TX symbol { // show the TX symbol
mode = 1; mode = VFO_MODE_TX;
#ifdef ENABLE_SMALL_BOLD #ifdef ENABLE_SMALL_BOLD
UI_PrintStringSmallBold("TX", 14, 0, line); UI_PrintStringSmallBold("TX", 14, 0, line);
#else #else
@@ -443,7 +443,7 @@ void UI_DisplayMain(void)
} }
else else
{ // receiving .. show the RX symbol { // receiving .. show the RX symbol
mode = 2; mode = VFO_MODE_RX;
if ((gCurrentFunction == FUNCTION_RECEIVE || if ((gCurrentFunction == FUNCTION_RECEIVE ||
gCurrentFunction == FUNCTION_MONITOR || gCurrentFunction == FUNCTION_MONITOR ||
gCurrentFunction == FUNCTION_INCOMING) && gCurrentFunction == FUNCTION_INCOMING) &&
@@ -643,7 +643,7 @@ void UI_DisplayMain(void)
{ // show the TX/RX level { // show the TX/RX level
uint8_t Level = 0; uint8_t Level = 0;
if (mode == 1) if (mode == VFO_MODE_TX)
{ // TX power level { // TX power level
switch (gRxVfo->OUTPUT_POWER) switch (gRxVfo->OUTPUT_POWER)
{ {
@@ -653,7 +653,7 @@ void UI_DisplayMain(void)
} }
} }
else else
if (mode == 2) if (mode == VFO_MODE_RX)
{ // RX signal level { // RX signal level
#ifndef ENABLE_RSSI_BAR #ifndef ENABLE_RSSI_BAR
// bar graph // bar graph
@@ -674,7 +674,7 @@ void UI_DisplayMain(void)
const ModulationMode_t mod = gEeprom.VfoInfo[vfo_num].Modulation; const ModulationMode_t mod = gEeprom.VfoInfo[vfo_num].Modulation;
switch (mod){ switch (mod){
case MODULATION_FM: { case MODULATION_FM: {
const FREQ_Config_t *pConfig = (mode == 1) ? gEeprom.VfoInfo[vfo_num].pTX : gEeprom.VfoInfo[vfo_num].pRX; const FREQ_Config_t *pConfig = (mode == VFO_MODE_TX) ? gEeprom.VfoInfo[vfo_num].pTX : gEeprom.VfoInfo[vfo_num].pRX;
const unsigned int code_type = pConfig->CodeType; const unsigned int code_type = pConfig->CodeType;
const char *code_list[] = {"", "CT", "DCS", "DCR"}; const char *code_list[] = {"", "CT", "DCS", "DCR"};
if (code_type < ARRAY_SIZE(code_list)) if (code_type < ARRAY_SIZE(code_list))

View File

@@ -26,6 +26,13 @@ enum center_line_t {
CENTER_LINE_DTMF_DEC, CENTER_LINE_DTMF_DEC,
CENTER_LINE_CHARGE_DATA CENTER_LINE_CHARGE_DATA
}; };
enum Vfo_txtr_mode{
VFO_MODE_NONE = 0,
VFO_MODE_TX = 1,
VFO_MODE_RX = 2,
};
typedef enum center_line_t center_line_t; typedef enum center_line_t center_line_t;
extern center_line_t center_line; extern center_line_t center_line;
@@ -36,4 +43,3 @@ void UI_MAIN_TimeSlice500ms(void);
void UI_DisplayMain(void); void UI_DisplayMain(void);
#endif #endif