Skip to content

Commit

Permalink
FIX kamilsss655#26: vfo state (TX DISABLE label) update issue when FM…
Browse files Browse the repository at this point in the history
… radio disabled in Makefile
  • Loading branch information
egzumer committed Oct 11, 2023
1 parent d087a25 commit dc0156d
Show file tree
Hide file tree
Showing 7 changed files with 25 additions and 28 deletions.
30 changes: 15 additions & 15 deletions app/app.c
Original file line number Diff line number Diff line change
Expand Up @@ -1895,24 +1895,24 @@ void APP_TimeSlice500ms(void)
if (gCurrentFunction != FUNCTION_POWER_SAVE && gCurrentFunction != FUNCTION_TRANSMIT)
updateRSSI(gEeprom.RX_VFO);

#ifdef ENABLE_FMRADIO
if (!gPttIsPressed && gFM_ResumeCountdown_500ms > 0)
if (!gPttIsPressed && gVFOStateResumeCountdown_500ms > 0)
{
if (--gVFOStateResumeCountdown_500ms == 0)
{
if (--gFM_ResumeCountdown_500ms == 0)
{
RADIO_SetVfoState(VFO_STATE_NORMAL);

if (gCurrentFunction != FUNCTION_RECEIVE &&
gCurrentFunction != FUNCTION_TRANSMIT &&
gCurrentFunction != FUNCTION_MONITOR &&
gFmRadioMode)
{ // switch back to FM radio mode
FM_Start();
GUI_SelectNextDisplay(DISPLAY_FM);
}
RADIO_SetVfoState(VFO_STATE_NORMAL);
#ifdef ENABLE_FMRADIO
if (gCurrentFunction != FUNCTION_RECEIVE &&
gCurrentFunction != FUNCTION_TRANSMIT &&
gCurrentFunction != FUNCTION_MONITOR &&
gFmRadioMode)
{ // switch back to FM radio mode
FM_Start();
GUI_SelectNextDisplay(DISPLAY_FM);
}
#endif
}
#endif
}


if (gLowBattery)
{
Expand Down
1 change: 0 additions & 1 deletion app/fm.c
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,6 @@ bool gFM_AutoScan;
uint8_t gFM_ChannelPosition;
bool gFM_FoundFrequency;
bool gFM_AutoScan;
uint8_t gFM_ResumeCountdown_500ms;
uint16_t gFM_RestoreCountdown_10ms;

bool FM_CheckValidChannel(uint8_t Channel)
Expand Down
1 change: 0 additions & 1 deletion app/fm.h
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,6 @@ extern uint8_t gFM_ChannelPosition;
extern uint16_t gFM_FrequencyDeviation;
extern bool gFM_FoundFrequency;
extern bool gFM_AutoScan;
extern uint8_t gFM_ResumeCountdown_500ms;
extern uint16_t gFM_RestoreCountdown_10ms;

bool FM_CheckValidChannel(uint8_t Channel);
Expand Down
5 changes: 4 additions & 1 deletion misc.c
Original file line number Diff line number Diff line change
Expand Up @@ -19,12 +19,13 @@
#include "misc.h"
#include "settings.h"

const uint8_t fm_resume_countdown_500ms = 2500 / 500; // 2.5 seconds
const uint8_t fm_radio_countdown_500ms = 2000 / 500; // 2 seconds
const uint16_t fm_play_countdown_scan_10ms = 100 / 10; // 100ms
const uint16_t fm_play_countdown_noscan_10ms = 1200 / 10; // 1.2 seconds
const uint16_t fm_restore_countdown_10ms = 5000 / 10; // 5 seconds

const uint8_t vfo_state_resume_countdown_500ms = 2500 / 500; // 2.5 seconds

const uint8_t menu_timeout_500ms = 20000 / 500; // 20 seconds
const uint16_t menu_timeout_long_500ms = 120000 / 500; // 2 minutes

Expand Down Expand Up @@ -141,6 +142,8 @@ volatile bool gTxTimeoutReached;

volatile uint16_t gTailNoteEliminationCountdown_10ms;

volatile uint8_t gVFOStateResumeCountdown_500ms;

#ifdef ENABLE_NOAA
volatile uint16_t gNOAA_Countdown_10ms;
#endif
Expand Down
4 changes: 3 additions & 1 deletion misc.h
Original file line number Diff line number Diff line change
Expand Up @@ -93,12 +93,13 @@ enum scan_next_chan_t {
};
typedef enum scan_next_chan_t scan_next_chan_t;

extern const uint8_t fm_resume_countdown_500ms;
extern const uint8_t fm_radio_countdown_500ms;
extern const uint16_t fm_play_countdown_scan_10ms;
extern const uint16_t fm_play_countdown_noscan_10ms;
extern const uint16_t fm_restore_countdown_10ms;

extern const uint8_t vfo_state_resume_countdown_500ms;

extern const uint8_t menu_timeout_500ms;
extern const uint16_t menu_timeout_long_500ms;

Expand Down Expand Up @@ -319,6 +320,7 @@ extern volatile bool gNextTimeslice40ms;
extern volatile bool gScheduleNOAA;
#endif
extern volatile bool gFlagTailNoteEliminationComplete;
extern volatile uint8_t gVFOStateResumeCountdown_500ms;
#ifdef ENABLE_FMRADIO
extern volatile bool gScheduleFM;
#endif
Expand Down
9 changes: 2 additions & 7 deletions radio.c
Original file line number Diff line number Diff line change
Expand Up @@ -898,10 +898,7 @@ void RADIO_SetVfoState(VfoState_t State)
{
VfoState[0] = VFO_STATE_NORMAL;
VfoState[1] = VFO_STATE_NORMAL;

#ifdef ENABLE_FMRADIO
gFM_ResumeCountdown_500ms = 0;
#endif
gVFOStateResumeCountdown_500ms = 0;
}
else
{
Expand All @@ -916,9 +913,7 @@ void RADIO_SetVfoState(VfoState_t State)
VfoState[vfo] = State;
}

#ifdef ENABLE_FMRADIO
gFM_ResumeCountdown_500ms = fm_resume_countdown_500ms;
#endif
gVFOStateResumeCountdown_500ms = vfo_state_resume_countdown_500ms;
}

gUpdateDisplay = true;
Expand Down
3 changes: 1 addition & 2 deletions ui/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -323,7 +323,6 @@ void UI_DisplayMain(void)
uint8_t *p_line0 = gFrameBuffer[line + 0];
uint8_t *p_line1 = gFrameBuffer[line + 1];
unsigned int mode = 0;
unsigned int state;

if (single_vfo)
{ // we're in single VFO mode - screen is dedicated to just one VFO
Expand Down Expand Up @@ -472,7 +471,7 @@ void UI_DisplayMain(void)

// ************

state = VfoState[vfo_num];
unsigned int state = VfoState[vfo_num];

#ifdef ENABLE_ALARM
if (gCurrentFunction == FUNCTION_TRANSMIT && gAlarmState == ALARM_STATE_ALARM)
Expand Down

0 comments on commit dc0156d

Please sign in to comment.