Skip to content

Commit

Permalink
Add enum for TR/TX mode
Browse files Browse the repository at this point in the history
  • Loading branch information
JuantAldea authored and egzumer committed Dec 6, 2023
1 parent cd032c3 commit c76a96c
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 9 deletions.
16 changes: 8 additions & 8 deletions ui/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -341,10 +341,10 @@ void UI_DisplayMain(void)
const unsigned int line0 = 0; // text screen line
const unsigned int line1 = 4;
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_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
{
Expand Down Expand Up @@ -426,13 +426,13 @@ void UI_DisplayMain(void)

#ifdef ENABLE_ALARM
if (gAlarmState == ALARM_STATE_SITE_ALARM)
mode = 2;
mode = VFO_MODE_RX;
else
#endif
{
if (activeTxVFO == vfo_num)
{ // show the TX symbol
mode = 1;
mode = VFO_MODE_TX;
#ifdef ENABLE_SMALL_BOLD
UI_PrintStringSmallBold("TX", 14, 0, line);
#else
Expand All @@ -443,7 +443,7 @@ void UI_DisplayMain(void)
}
else
{ // receiving .. show the RX symbol
mode = 2;
mode = VFO_MODE_RX;
if ((gCurrentFunction == FUNCTION_RECEIVE ||
gCurrentFunction == FUNCTION_MONITOR ||
gCurrentFunction == FUNCTION_INCOMING) &&
Expand Down Expand Up @@ -643,7 +643,7 @@ void UI_DisplayMain(void)
{ // show the TX/RX level
uint8_t Level = 0;

if (mode == 1)
if (mode == VFO_MODE_TX)
{ // TX power level
switch (gRxVfo->OUTPUT_POWER)
{
Expand All @@ -653,7 +653,7 @@ void UI_DisplayMain(void)
}
}
else
if (mode == 2)
if (mode == VFO_MODE_RX)
{ // RX signal level
#ifndef ENABLE_RSSI_BAR
// bar graph
Expand All @@ -674,7 +674,7 @@ void UI_DisplayMain(void)
const ModulationMode_t mod = gEeprom.VfoInfo[vfo_num].Modulation;
switch (mod){
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 char *code_list[] = {"", "CT", "DCS", "DCR"};
if (code_type < ARRAY_SIZE(code_list))
Expand Down
8 changes: 7 additions & 1 deletion ui/main.h
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,13 @@ enum center_line_t {
CENTER_LINE_DTMF_DEC,
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;

extern center_line_t center_line;
Expand All @@ -36,4 +43,3 @@ void UI_MAIN_TimeSlice500ms(void);
void UI_DisplayMain(void);

#endif

0 comments on commit c76a96c

Please sign in to comment.