mirror of
https://github.com/egzumer/uv-k5-firmware-custom
synced 2024-11-21 09:10:27 +00:00
Comments, refactor
This commit is contained in:
parent
2086bd6aaa
commit
f3cc0f5acf
166
app/app.c
166
app/app.c
@ -62,9 +62,10 @@
|
||||
#include "ui/status.h"
|
||||
#include "ui/ui.h"
|
||||
|
||||
static void APP_ProcessKey(KEY_Code_t Key, bool bKeyPressed, bool bKeyHeld);
|
||||
static void ProcessKey(KEY_Code_t Key, bool bKeyPressed, bool bKeyHeld);
|
||||
static void FlashlightTimeSlice();
|
||||
|
||||
static void updateRSSI(const int vfo)
|
||||
static void UpdateRSSI(const int vfo)
|
||||
{
|
||||
int16_t rssi = BK4819_GetRSSI();
|
||||
|
||||
@ -82,7 +83,7 @@ static void updateRSSI(const int vfo)
|
||||
UI_UpdateRSSI(rssi, vfo);
|
||||
}
|
||||
|
||||
static void APP_CheckForIncoming(void)
|
||||
static void CheckForIncoming(void)
|
||||
{
|
||||
if (!g_SquelchLost)
|
||||
return; // squelch is closed
|
||||
@ -116,7 +117,7 @@ static void APP_CheckForIncoming(void)
|
||||
FUNCTION_Select(FUNCTION_INCOMING);
|
||||
//gUpdateDisplay = true;
|
||||
|
||||
updateRSSI(gEeprom.RX_VFO);
|
||||
UpdateRSSI(gEeprom.RX_VFO);
|
||||
gUpdateRSSI = true;
|
||||
}
|
||||
|
||||
@ -132,7 +133,7 @@ static void APP_CheckForIncoming(void)
|
||||
FUNCTION_Select(FUNCTION_INCOMING);
|
||||
//gUpdateDisplay = true;
|
||||
|
||||
updateRSSI(gEeprom.RX_VFO);
|
||||
UpdateRSSI(gEeprom.RX_VFO);
|
||||
gUpdateRSSI = true;
|
||||
}
|
||||
return;
|
||||
@ -154,7 +155,7 @@ static void APP_CheckForIncoming(void)
|
||||
FUNCTION_Select(FUNCTION_INCOMING);
|
||||
//gUpdateDisplay = true;
|
||||
|
||||
updateRSSI(gEeprom.RX_VFO);
|
||||
UpdateRSSI(gEeprom.RX_VFO);
|
||||
gUpdateRSSI = true;
|
||||
}
|
||||
return;
|
||||
@ -171,12 +172,12 @@ static void APP_CheckForIncoming(void)
|
||||
FUNCTION_Select(FUNCTION_INCOMING);
|
||||
//gUpdateDisplay = true;
|
||||
|
||||
updateRSSI(gEeprom.RX_VFO);
|
||||
UpdateRSSI(gEeprom.RX_VFO);
|
||||
gUpdateRSSI = true;
|
||||
}
|
||||
}
|
||||
|
||||
static void APP_HandleIncoming(void)
|
||||
static void HandleIncoming(void)
|
||||
{
|
||||
bool bFlag;
|
||||
|
||||
@ -248,7 +249,7 @@ static void APP_HandleIncoming(void)
|
||||
APP_StartListening(gMonitor ? FUNCTION_MONITOR : FUNCTION_RECEIVE, false);
|
||||
}
|
||||
|
||||
static void APP_HandleReceive(void)
|
||||
static void HandleReceive(void)
|
||||
{
|
||||
#define END_OF_RX_MODE_SKIP 0
|
||||
#define END_OF_RX_MODE_END 1
|
||||
@ -263,7 +264,7 @@ static void APP_HandleReceive(void)
|
||||
}
|
||||
|
||||
if (gScanStateDir != SCAN_OFF && IS_FREQ_CHANNEL(gNextMrChannel))
|
||||
{
|
||||
{ // we are scanning in the frequency mode
|
||||
if (g_SquelchLost)
|
||||
return;
|
||||
|
||||
@ -370,7 +371,7 @@ static void APP_HandleReceive(void)
|
||||
if (!gEndOfRxDetectedMaybe &&
|
||||
Mode == END_OF_RX_MODE_SKIP &&
|
||||
gNextTimeslice40ms &&
|
||||
gEeprom.TAIL_NOTE_ELIMINATION &&
|
||||
gEeprom.TAIL_TONE_ELIMINATION &&
|
||||
(gCurrentCodeType == CODE_TYPE_DIGITAL || gCurrentCodeType == CODE_TYPE_REVERSE_DIGITAL) &&
|
||||
BK4819_GetCTCType() == 1)
|
||||
Mode = END_OF_RX_MODE_TTE;
|
||||
@ -414,7 +415,7 @@ Skip:
|
||||
break;
|
||||
|
||||
case END_OF_RX_MODE_TTE:
|
||||
if (gEeprom.TAIL_NOTE_ELIMINATION)
|
||||
if (gEeprom.TAIL_TONE_ELIMINATION)
|
||||
{
|
||||
GPIO_ClearBit(&GPIOC->DATA, GPIOC_PIN_AUDIO_PATH);
|
||||
|
||||
@ -427,12 +428,12 @@ Skip:
|
||||
}
|
||||
}
|
||||
|
||||
static void APP_HandleFunction(void)
|
||||
static void HandleFunction(void)
|
||||
{
|
||||
switch (gCurrentFunction)
|
||||
{
|
||||
case FUNCTION_FOREGROUND:
|
||||
APP_CheckForIncoming();
|
||||
CheckForIncoming();
|
||||
break;
|
||||
|
||||
case FUNCTION_TRANSMIT:
|
||||
@ -442,16 +443,16 @@ static void APP_HandleFunction(void)
|
||||
break;
|
||||
|
||||
case FUNCTION_INCOMING:
|
||||
APP_HandleIncoming();
|
||||
HandleIncoming();
|
||||
break;
|
||||
|
||||
case FUNCTION_RECEIVE:
|
||||
APP_HandleReceive();
|
||||
HandleReceive();
|
||||
break;
|
||||
|
||||
case FUNCTION_POWER_SAVE:
|
||||
if (!gRxIdleMode)
|
||||
APP_CheckForIncoming();
|
||||
CheckForIncoming();
|
||||
break;
|
||||
|
||||
case FUNCTION_BAND_SCOPE:
|
||||
@ -592,7 +593,7 @@ uint32_t APP_SetFrequencyByStep(VFO_Info_t *pInfo, int8_t direction)
|
||||
}
|
||||
#endif
|
||||
|
||||
static void DUALWATCH_Alternate(void)
|
||||
static void DualwatchAlternate(void)
|
||||
{
|
||||
#ifdef ENABLE_NOAA
|
||||
if (gIsNoaaMode)
|
||||
@ -610,8 +611,8 @@ static void DUALWATCH_Alternate(void)
|
||||
else
|
||||
#endif
|
||||
{ // toggle between VFO's
|
||||
gEeprom.RX_VFO = (gEeprom.RX_VFO + 1) & 1;
|
||||
gRxVfo = &gEeprom.VfoInfo[gEeprom.RX_VFO];
|
||||
gEeprom.RX_VFO = !gEeprom.RX_VFO;
|
||||
gRxVfo = &gEeprom.VfoInfo[gEeprom.RX_VFO];
|
||||
|
||||
if (!gDualWatchActive)
|
||||
{ // let the user see DW is active
|
||||
@ -629,7 +630,7 @@ static void DUALWATCH_Alternate(void)
|
||||
#endif
|
||||
}
|
||||
|
||||
void APP_CheckRadioInterrupts(void)
|
||||
static void CheckRadioInterrupts(void)
|
||||
{
|
||||
if (gScreenToDisplay == DISPLAY_SCANNER)
|
||||
return;
|
||||
@ -779,7 +780,7 @@ void APP_EndTransmission(void)
|
||||
{ // CTCSS/DCS is enabled
|
||||
|
||||
//if (gEeprom.TAIL_NOTE_ELIMINATION && gEeprom.REPEATER_TAIL_TONE_ELIMINATION > 0)
|
||||
if (gEeprom.TAIL_NOTE_ELIMINATION)
|
||||
if (gEeprom.TAIL_TONE_ELIMINATION)
|
||||
{ // send the CTCSS/DCS tail tone - allows the receivers to mute the usual FM squelch tail/crash
|
||||
RADIO_EnableCxCSS();
|
||||
}
|
||||
@ -797,7 +798,7 @@ void APP_EndTransmission(void)
|
||||
}
|
||||
|
||||
#ifdef ENABLE_VOX
|
||||
static void APP_HandleVox(void)
|
||||
static void HandleVox(void)
|
||||
{
|
||||
if (gSetting_KILLED)
|
||||
return;
|
||||
@ -878,13 +879,12 @@ void APP_EndTransmission(void)
|
||||
|
||||
void APP_Update(void)
|
||||
{
|
||||
#ifdef ENABLE_VOICE
|
||||
if (gFlagPlayQueuedVoice)
|
||||
{
|
||||
#ifdef ENABLE_VOICE
|
||||
if (gFlagPlayQueuedVoice) {
|
||||
AUDIO_PlayQueuedVoice();
|
||||
gFlagPlayQueuedVoice = false;
|
||||
}
|
||||
#endif
|
||||
}
|
||||
#endif
|
||||
|
||||
if (gCurrentFunction == FUNCTION_TRANSMIT && (gTxTimeoutReached || gSerialConfigCountDown_500ms > 0))
|
||||
{ // transmitter timed out or must de-key
|
||||
@ -904,7 +904,7 @@ void APP_Update(void)
|
||||
return;
|
||||
|
||||
if (gCurrentFunction != FUNCTION_TRANSMIT)
|
||||
APP_HandleFunction();
|
||||
HandleFunction();
|
||||
|
||||
#ifdef ENABLE_FMRADIO
|
||||
// if (gFmRadioCountdown_500ms > 0)
|
||||
@ -965,7 +965,7 @@ void APP_Update(void)
|
||||
gDTMF_CallState == DTMF_CALL_STATE_NONE &&
|
||||
gCurrentFunction != FUNCTION_POWER_SAVE)
|
||||
{
|
||||
DUALWATCH_Alternate(); // toggle between the two VFO's
|
||||
DualwatchAlternate(); // toggle between the two VFO's
|
||||
|
||||
if (gRxVfoIsActive && gScreenToDisplay == DISPLAY_MAIN)
|
||||
GUI_SelectNextDisplay(DISPLAY_MAIN);
|
||||
@ -993,7 +993,7 @@ void APP_Update(void)
|
||||
|
||||
#ifdef ENABLE_VOX
|
||||
if (gEeprom.VOX_SWITCH)
|
||||
APP_HandleVox();
|
||||
HandleVox();
|
||||
#endif
|
||||
|
||||
if (gSchedulePowerSave)
|
||||
@ -1067,7 +1067,7 @@ void APP_Update(void)
|
||||
gScanStateDir == SCAN_OFF &&
|
||||
gCssScanMode == CSS_SCAN_MODE_OFF)
|
||||
{ // dual watch mode, toggle between the two VFO's
|
||||
DUALWATCH_Alternate();
|
||||
DualwatchAlternate();
|
||||
|
||||
gUpdateRSSI = false;
|
||||
}
|
||||
@ -1079,9 +1079,9 @@ void APP_Update(void)
|
||||
}
|
||||
else
|
||||
if (gEeprom.DUAL_WATCH == DUAL_WATCH_OFF || gScanStateDir != SCAN_OFF || gCssScanMode != CSS_SCAN_MODE_OFF || gUpdateRSSI)
|
||||
{ // dual watch mode, go back to sleep
|
||||
{ // dual watch mode off or scanning or rssi update request
|
||||
|
||||
updateRSSI(gEeprom.RX_VFO);
|
||||
UpdateRSSI(gEeprom.RX_VFO);
|
||||
|
||||
// go back to sleep
|
||||
|
||||
@ -1098,7 +1098,7 @@ void APP_Update(void)
|
||||
else
|
||||
{
|
||||
// toggle between the two VFO's
|
||||
DUALWATCH_Alternate();
|
||||
DualwatchAlternate();
|
||||
|
||||
gUpdateRSSI = true;
|
||||
gPowerSave_10ms = power_save1_10ms;
|
||||
@ -1109,7 +1109,7 @@ void APP_Update(void)
|
||||
}
|
||||
|
||||
// called every 10ms
|
||||
void APP_CheckKeys(void)
|
||||
static void CheckKeys(void)
|
||||
{
|
||||
#ifdef ENABLE_AIRCOPY
|
||||
if (gSetting_KILLED || (gScreenToDisplay == DISPLAY_AIRCOPY && gAircopyState != AIRCOPY_READY))
|
||||
@ -1126,7 +1126,7 @@ void APP_CheckKeys(void)
|
||||
{ // PTT released or serial comms config in progress
|
||||
if (++gPttDebounceCounter >= 3 || gSerialConfigCountDown_500ms > 0) // 30ms
|
||||
{ // stop transmitting
|
||||
APP_ProcessKey(KEY_PTT, false, false);
|
||||
ProcessKey(KEY_PTT, false, false);
|
||||
gPttIsPressed = false;
|
||||
if (gKeyReading1 != KEY_INVALID)
|
||||
gPttWasReleased = true;
|
||||
@ -1142,7 +1142,7 @@ void APP_CheckKeys(void)
|
||||
boot_counter_10ms = 0;
|
||||
gPttDebounceCounter = 0;
|
||||
gPttIsPressed = true;
|
||||
APP_ProcessKey(KEY_PTT, true, false);
|
||||
ProcessKey(KEY_PTT, true, false);
|
||||
}
|
||||
}
|
||||
else
|
||||
@ -1160,7 +1160,7 @@ void APP_CheckKeys(void)
|
||||
{
|
||||
|
||||
if (gKeyReading0 != KEY_INVALID && Key != KEY_INVALID)
|
||||
APP_ProcessKey(gKeyReading1, false, gKeyBeingHeld); // key pressed without releasing previous key
|
||||
ProcessKey(gKeyReading1, false, gKeyBeingHeld); // key pressed without releasing previous key
|
||||
|
||||
gKeyReading0 = Key;
|
||||
gDebounceCounter = 0;
|
||||
@ -1175,14 +1175,14 @@ void APP_CheckKeys(void)
|
||||
{
|
||||
if (gKeyReading1 != KEY_INVALID) // some button was pressed before
|
||||
{
|
||||
APP_ProcessKey(gKeyReading1, false, gKeyBeingHeld); // process last button released event
|
||||
ProcessKey(gKeyReading1, false, gKeyBeingHeld); // process last button released event
|
||||
gKeyReading1 = KEY_INVALID;
|
||||
}
|
||||
}
|
||||
else // process new key pressed
|
||||
{
|
||||
gKeyReading1 = Key;
|
||||
APP_ProcessKey(Key, true, false);
|
||||
ProcessKey(Key, true, false);
|
||||
}
|
||||
|
||||
gKeyBeingHeld = false;
|
||||
@ -1197,7 +1197,7 @@ void APP_CheckKeys(void)
|
||||
if (Key != KEY_PTT)
|
||||
{
|
||||
gKeyBeingHeld = true;
|
||||
APP_ProcessKey(Key, true, true); // key held event
|
||||
ProcessKey(Key, true, true); // key held event
|
||||
}
|
||||
}
|
||||
else //subsequent fast key repeats
|
||||
@ -1206,7 +1206,7 @@ void APP_CheckKeys(void)
|
||||
{
|
||||
gKeyBeingHeld = true;
|
||||
if ((gDebounceCounter % key_repeat_10ms) == 0)
|
||||
APP_ProcessKey(Key, true, true); // key held event
|
||||
ProcessKey(Key, true, true); // key held event
|
||||
}
|
||||
|
||||
if (gDebounceCounter < 0xFFFF)
|
||||
@ -1243,7 +1243,7 @@ void APP_TimeSlice10ms(void)
|
||||
return;
|
||||
|
||||
if (gCurrentFunction != FUNCTION_POWER_SAVE || !gRxIdleMode)
|
||||
APP_CheckRadioInterrupts();
|
||||
CheckRadioInterrupts();
|
||||
|
||||
if (gCurrentFunction == FUNCTION_TRANSMIT)
|
||||
{ // transmitting
|
||||
@ -1260,7 +1260,7 @@ void APP_TimeSlice10ms(void)
|
||||
}
|
||||
|
||||
if (gUpdateStatus)
|
||||
UI_DisplayStatus(false);
|
||||
UI_DisplayStatus();
|
||||
|
||||
// Skipping authentic device checks
|
||||
|
||||
@ -1269,37 +1269,7 @@ void APP_TimeSlice10ms(void)
|
||||
return;
|
||||
#endif
|
||||
|
||||
if (gFlashLightState == FLASHLIGHT_BLINK && (gFlashLightBlinkCounter & 15u) == 0)
|
||||
GPIO_FlipBit(&GPIOC->DATA, GPIOC_PIN_FLASHLIGHT);
|
||||
else if(gFlashLightState == FLASHLIGHT_SOS) {
|
||||
const uint16_t u = 15;
|
||||
static uint8_t c;
|
||||
static uint16_t next;
|
||||
|
||||
if(gFlashLightBlinkCounter - next > 7*u) {
|
||||
c = 0;
|
||||
next = gFlashLightBlinkCounter+1;
|
||||
}
|
||||
else if(gFlashLightBlinkCounter == next) {
|
||||
if(c==0) {
|
||||
GPIO_ClearBit(&GPIOC->DATA, GPIOC_PIN_FLASHLIGHT);
|
||||
}
|
||||
else
|
||||
GPIO_FlipBit(&GPIOC->DATA, GPIOC_PIN_FLASHLIGHT);
|
||||
|
||||
if(c == 18) {
|
||||
next += 7*u;
|
||||
c = 0;
|
||||
}
|
||||
else if(c==7 || c==9 || c==11)
|
||||
next += 3*u;
|
||||
else
|
||||
next += u;
|
||||
|
||||
c++;
|
||||
}
|
||||
|
||||
}
|
||||
FlashlightTimeSlice();
|
||||
|
||||
#ifdef ENABLE_VOX
|
||||
if (gVoxResumeCountdown > 0)
|
||||
@ -1399,14 +1369,14 @@ void APP_TimeSlice10ms(void)
|
||||
{
|
||||
if (--gScanDelay_10ms > 0)
|
||||
{
|
||||
APP_CheckKeys();
|
||||
CheckKeys();
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
if (gScannerEditState != 0)
|
||||
{
|
||||
APP_CheckKeys();
|
||||
CheckKeys();
|
||||
return;
|
||||
}
|
||||
|
||||
@ -1525,7 +1495,7 @@ void APP_TimeSlice10ms(void)
|
||||
}
|
||||
#endif
|
||||
|
||||
APP_CheckKeys();
|
||||
CheckKeys();
|
||||
}
|
||||
|
||||
void cancelUserInputModes(void)
|
||||
@ -1750,7 +1720,7 @@ void APP_TimeSlice500ms(void)
|
||||
}
|
||||
|
||||
if (gCurrentFunction != FUNCTION_POWER_SAVE && gCurrentFunction != FUNCTION_TRANSMIT)
|
||||
updateRSSI(gEeprom.RX_VFO);
|
||||
UpdateRSSI(gEeprom.RX_VFO);
|
||||
|
||||
if (!gPttIsPressed && gVFOStateResumeCountdown_500ms > 0)
|
||||
{
|
||||
@ -1909,7 +1879,7 @@ void APP_TimeSlice500ms(void)
|
||||
|
||||
|
||||
|
||||
static void APP_ProcessKey(KEY_Code_t Key, bool bKeyPressed, bool bKeyHeld)
|
||||
static void ProcessKey(KEY_Code_t Key, bool bKeyPressed, bool bKeyHeld)
|
||||
{
|
||||
if (Key == KEY_EXIT && !BACKLIGHT_IsOn() && gEeprom.BACKLIGHT_TIME > 0)
|
||||
{ // just turn the light on for now so the user can see what's what
|
||||
@ -2369,3 +2339,37 @@ Skip:
|
||||
|
||||
gUpdateDisplay = true;
|
||||
}
|
||||
|
||||
static void FlashlightTimeSlice()
|
||||
{
|
||||
if (gFlashLightState == FLASHLIGHT_BLINK && (gFlashLightBlinkCounter & 15u) == 0)
|
||||
GPIO_FlipBit(&GPIOC->DATA, GPIOC_PIN_FLASHLIGHT);
|
||||
else if(gFlashLightState == FLASHLIGHT_SOS) {
|
||||
const uint16_t u = 15;
|
||||
static uint8_t c;
|
||||
static uint16_t next;
|
||||
|
||||
if(gFlashLightBlinkCounter - next > 7*u) {
|
||||
c = 0;
|
||||
next = gFlashLightBlinkCounter + 1;
|
||||
}
|
||||
else if(gFlashLightBlinkCounter == next) {
|
||||
if(c==0) {
|
||||
GPIO_ClearBit(&GPIOC->DATA, GPIOC_PIN_FLASHLIGHT);
|
||||
}
|
||||
else
|
||||
GPIO_FlipBit(&GPIOC->DATA, GPIOC_PIN_FLASHLIGHT);
|
||||
|
||||
if(c >= 18) {
|
||||
next = gFlashLightBlinkCounter + 7*u;
|
||||
c = 0;
|
||||
}
|
||||
else if(c==7 || c==9 || c==11)
|
||||
next = gFlashLightBlinkCounter + 3*u;
|
||||
else
|
||||
next = gFlashLightBlinkCounter + u;
|
||||
|
||||
c++;
|
||||
}
|
||||
}
|
||||
}
|
@ -594,7 +594,7 @@ void MENU_AcceptSetting(void)
|
||||
return;
|
||||
|
||||
case MENU_STE:
|
||||
gEeprom.TAIL_NOTE_ELIMINATION = gSubMenuSelection;
|
||||
gEeprom.TAIL_TONE_ELIMINATION = gSubMenuSelection;
|
||||
break;
|
||||
|
||||
case MENU_RP_STE:
|
||||
@ -1015,7 +1015,7 @@ void MENU_ShowCurrentSetting(void)
|
||||
break;
|
||||
|
||||
case MENU_STE:
|
||||
gSubMenuSelection = gEeprom.TAIL_NOTE_ELIMINATION;
|
||||
gSubMenuSelection = gEeprom.TAIL_TONE_ELIMINATION;
|
||||
break;
|
||||
|
||||
case MENU_RP_STE:
|
||||
|
@ -52,6 +52,9 @@ extern volatile uint16_t gScanPauseDelayIn_10ms;
|
||||
extern uint8_t gScanProgressIndicator;
|
||||
extern uint8_t gScanHitCount;
|
||||
extern bool gScanUseCssResult;
|
||||
|
||||
// scan direction, if not equal SCAN_OFF indicates
|
||||
// that we are in a process of scanning channels/frequencies
|
||||
extern int8_t gScanStateDir;
|
||||
extern bool gScanKeepResult;
|
||||
|
||||
|
2
board.c
2
board.c
@ -564,7 +564,7 @@ void BOARD_EEPROM_Init(void)
|
||||
gEeprom.BATTERY_SAVE = (Data[3] < 5) ? Data[3] : 4;
|
||||
gEeprom.DUAL_WATCH = (Data[4] < 3) ? Data[4] : DUAL_WATCH_CHAN_A;
|
||||
gEeprom.BACKLIGHT_TIME = (Data[5] < ARRAY_SIZE(gSubMenu_BACKLIGHT)) ? Data[5] : 3;
|
||||
gEeprom.TAIL_NOTE_ELIMINATION = (Data[6] < 2) ? Data[6] : false;
|
||||
gEeprom.TAIL_TONE_ELIMINATION = (Data[6] < 2) ? Data[6] : false;
|
||||
gEeprom.VFO_OPEN = (Data[7] < 2) ? Data[7] : true;
|
||||
|
||||
// 0E80..0E87
|
||||
|
@ -62,6 +62,7 @@ enum BK4819_CssScanResult_t
|
||||
|
||||
typedef enum BK4819_CssScanResult_t BK4819_CssScanResult_t;
|
||||
|
||||
// radio is asleep, not listening
|
||||
extern bool gRxIdleMode;
|
||||
|
||||
void BK4819_Init(void);
|
||||
|
@ -93,7 +93,7 @@ void FUNCTION_Select(FUNCTION_Type_t Function)
|
||||
{
|
||||
BK4819_Conditional_RX_TurnOn_and_GPIO6_Enable();
|
||||
gRxIdleMode = false;
|
||||
UI_DisplayStatus(false);
|
||||
UI_DisplayStatus();
|
||||
}
|
||||
|
||||
switch (Function)
|
||||
|
6
misc.h
6
misc.h
@ -225,8 +225,12 @@ extern bool gEndOfRxDetectedMaybe;
|
||||
extern int16_t gVFO_RSSI[2];
|
||||
extern uint8_t gVFO_RSSI_bar_level[2];
|
||||
|
||||
// battery critical, limit functionality to minimum
|
||||
extern uint8_t gReducedService;
|
||||
extern uint8_t gBatteryVoltageIndex;
|
||||
|
||||
// if not equal CSS_SCAN_MODE_OFF we are scanning CTCSS/DCS
|
||||
// this is a scanning inside RX ctcss/dcs menu
|
||||
extern CssScanMode_t gCssScanMode;
|
||||
extern bool gUpdateRSSI;
|
||||
extern AlarmState_t gAlarmState;
|
||||
@ -264,6 +268,8 @@ extern bool g_CxCSS_TAIL_Found;
|
||||
extern uint16_t gVoxResumeCountdown;
|
||||
extern uint16_t gVoxPauseCountdown;
|
||||
#endif
|
||||
|
||||
// true means we are receiving signal
|
||||
extern bool g_SquelchLost;
|
||||
extern uint8_t gFlashLightState;
|
||||
extern volatile uint16_t gFlashLightBlinkCounter;
|
||||
|
4
radio.c
4
radio.c
@ -570,7 +570,7 @@ void RADIO_SelectVfos(void)
|
||||
RADIO_SelectCurrentVfo();
|
||||
}
|
||||
|
||||
void RADIO_SetupRegisters(bool bSwitchToFunction0)
|
||||
void RADIO_SetupRegisters(bool switchToForeground)
|
||||
{
|
||||
BK4819_FilterBandwidth_t Bandwidth = gRxVfo->CHANNEL_BANDWIDTH;
|
||||
uint16_t InterruptMask;
|
||||
@ -773,7 +773,7 @@ void RADIO_SetupRegisters(bool bSwitchToFunction0)
|
||||
|
||||
FUNCTION_Init();
|
||||
|
||||
if (bSwitchToFunction0)
|
||||
if (switchToForeground)
|
||||
FUNCTION_Select(FUNCTION_FOREGROUND);
|
||||
}
|
||||
|
||||
|
@ -102,7 +102,7 @@ void SETTINGS_SaveSettings(void)
|
||||
State[3] = gEeprom.BATTERY_SAVE;
|
||||
State[4] = gEeprom.DUAL_WATCH;
|
||||
State[5] = gEeprom.BACKLIGHT_TIME;
|
||||
State[6] = gEeprom.TAIL_NOTE_ELIMINATION;
|
||||
State[6] = gEeprom.TAIL_TONE_ELIMINATION;
|
||||
State[7] = gEeprom.VFO_OPEN;
|
||||
EEPROM_WriteBuffer(0x0E78, State);
|
||||
|
||||
|
@ -155,7 +155,7 @@ typedef struct {
|
||||
#endif
|
||||
bool BEEP_CONTROL;
|
||||
uint8_t CHANNEL_DISPLAY_MODE;
|
||||
bool TAIL_NOTE_ELIMINATION;
|
||||
bool TAIL_TONE_ELIMINATION;
|
||||
bool VFO_OPEN;
|
||||
uint8_t DUAL_WATCH;
|
||||
uint8_t CROSS_BAND_RX_TX;
|
||||
|
37
ui/status.c
37
ui/status.c
@ -33,7 +33,7 @@
|
||||
#include "ui/ui.h"
|
||||
#include "ui/status.h"
|
||||
|
||||
void UI_DisplayStatus(const bool test_display)
|
||||
void UI_DisplayStatus()
|
||||
{
|
||||
uint8_t *line = gStatusLine;
|
||||
unsigned int x = 0;
|
||||
@ -60,7 +60,7 @@ void UI_DisplayStatus(const bool test_display)
|
||||
x1 = x + sizeof(BITMAP_RX);
|
||||
}
|
||||
else
|
||||
if (gCurrentFunction == FUNCTION_POWER_SAVE || test_display)
|
||||
if (gCurrentFunction == FUNCTION_POWER_SAVE)
|
||||
{
|
||||
memmove(line + x, BITMAP_POWERSAVE, sizeof(BITMAP_POWERSAVE));
|
||||
x1 = x + sizeof(BITMAP_POWERSAVE);
|
||||
@ -69,7 +69,7 @@ void UI_DisplayStatus(const bool test_display)
|
||||
|
||||
#ifdef ENABLE_NOAA
|
||||
// NOASS SCAN indicator
|
||||
if (gIsNoaaMode || test_display)
|
||||
if (gIsNoaaMode)
|
||||
{
|
||||
memmove(line + x, BITMAP_NOAA, sizeof(BITMAP_NOAA));
|
||||
x1 = x + sizeof(BITMAP_NOAA);
|
||||
@ -86,30 +86,29 @@ void UI_DisplayStatus(const bool test_display)
|
||||
}
|
||||
else
|
||||
// SCAN indicator
|
||||
if (gScanStateDir != SCAN_OFF || gScreenToDisplay == DISPLAY_SCANNER || test_display)
|
||||
if (gScanStateDir != SCAN_OFF || gScreenToDisplay == DISPLAY_SCANNER)
|
||||
{
|
||||
char * s = "";
|
||||
if (IS_MR_CHANNEL(gNextMrChannel) && gScreenToDisplay != DISPLAY_SCANNER)
|
||||
{ // channel mode
|
||||
if (gEeprom.SCAN_LIST_DEFAULT == 0)
|
||||
UI_PrintStringSmallBuffer("1", line + x);
|
||||
else
|
||||
if (gEeprom.SCAN_LIST_DEFAULT == 1)
|
||||
UI_PrintStringSmallBuffer("2", line + x);
|
||||
else
|
||||
if (gEeprom.SCAN_LIST_DEFAULT == 2)
|
||||
UI_PrintStringSmallBuffer("*", line + x);
|
||||
switch(gEeprom.SCAN_LIST_DEFAULT) {
|
||||
case 0: s = "1"; break;
|
||||
case 1: s = "2"; break;
|
||||
case 2: s = "*"; break;
|
||||
}
|
||||
}
|
||||
else
|
||||
{ // frequency mode
|
||||
UI_PrintStringSmallBuffer("S", line + x);
|
||||
s = "S";
|
||||
}
|
||||
UI_PrintStringSmallBuffer(s, line + x);
|
||||
x1 = x + 7;
|
||||
}
|
||||
x += 7; // font character width
|
||||
|
||||
#ifdef ENABLE_VOICE
|
||||
// VOICE indicator
|
||||
if (gEeprom.VOICE_PROMPT != VOICE_PROMPT_OFF || test_display)
|
||||
if (gEeprom.VOICE_PROMPT != VOICE_PROMPT_OFF)
|
||||
{
|
||||
memmove(line + x, BITMAP_VoicePrompt, sizeof(BITMAP_VoicePrompt));
|
||||
x1 = x + sizeof(BITMAP_VoicePrompt);
|
||||
@ -122,8 +121,8 @@ void UI_DisplayStatus(const bool test_display)
|
||||
x++;
|
||||
if(gScreenToDisplay != DISPLAY_SCANNER) {
|
||||
uint8_t dw = (gEeprom.DUAL_WATCH != DUAL_WATCH_OFF) + (gEeprom.CROSS_BAND_RX_TX != CROSS_BAND_OFF) * 2;
|
||||
if(dw == 1 || dw == 3 || test_display) { // DWR - dual watch + respond
|
||||
if(gDualWatchActive || test_display)
|
||||
if(dw == 1 || dw == 3) { // DWR - dual watch + respond
|
||||
if(gDualWatchActive)
|
||||
memmove(line + x, BITMAP_TDR1, sizeof(BITMAP_TDR1) - (dw==1?0:5));
|
||||
else
|
||||
memmove(line + x + 3, BITMAP_TDR2, sizeof(BITMAP_TDR2));
|
||||
@ -136,7 +135,7 @@ void UI_DisplayStatus(const bool test_display)
|
||||
|
||||
#ifdef ENABLE_VOX
|
||||
// VOX indicator
|
||||
if (gEeprom.VOX_SWITCH || test_display)
|
||||
if (gEeprom.VOX_SWITCH)
|
||||
{
|
||||
memmove(line + x, BITMAP_VOX, sizeof(BITMAP_VOX));
|
||||
x1 = x + sizeof(BITMAP_VOX);
|
||||
@ -148,7 +147,7 @@ void UI_DisplayStatus(const bool test_display)
|
||||
x1 = x;
|
||||
|
||||
// KEY-LOCK indicator
|
||||
if (gEeprom.KEY_LOCK || test_display)
|
||||
if (gEeprom.KEY_LOCK)
|
||||
{
|
||||
memmove(line + x, BITMAP_KeyLock, sizeof(BITMAP_KeyLock));
|
||||
x += sizeof(BITMAP_KeyLock);
|
||||
@ -204,7 +203,7 @@ void UI_DisplayStatus(const bool test_display)
|
||||
x = LCD_WIDTH - sizeof(BITMAP_BatteryLevel1) - sizeof(BITMAP_USB_C);
|
||||
|
||||
// USB-C charge indicator
|
||||
if (gChargingWithTypeC || test_display)
|
||||
if (gChargingWithTypeC)
|
||||
memmove(line + x, BITMAP_USB_C, sizeof(BITMAP_USB_C));
|
||||
x += sizeof(BITMAP_USB_C);
|
||||
|
||||
|
@ -17,7 +17,7 @@
|
||||
#ifndef UI_STATUS_H
|
||||
#define UI_STATUS_H
|
||||
|
||||
void UI_DisplayStatus(const bool test_display);
|
||||
void UI_DisplayStatus();
|
||||
|
||||
#endif
|
||||
|
||||
|
18
ui/welcome.c
18
ui/welcome.c
@ -43,7 +43,6 @@ void UI_DisplayWelcome(void)
|
||||
{
|
||||
char WelcomeString0[16];
|
||||
char WelcomeString1[16];
|
||||
char WelcomeString2[16];
|
||||
|
||||
memset(gStatusLine, 0, sizeof(gStatusLine));
|
||||
memset(gFrameBuffer, 0, sizeof(gFrameBuffer));
|
||||
@ -61,7 +60,6 @@ void UI_DisplayWelcome(void)
|
||||
{
|
||||
memset(WelcomeString0, 0, sizeof(WelcomeString0));
|
||||
memset(WelcomeString1, 0, sizeof(WelcomeString1));
|
||||
memset(WelcomeString2, 0, sizeof(WelcomeString2));
|
||||
|
||||
if (gEeprom.POWER_ON_DISPLAY_MODE == POWER_ON_DISPLAY_MODE_VOLTAGE)
|
||||
{
|
||||
@ -70,10 +68,6 @@ void UI_DisplayWelcome(void)
|
||||
gBatteryVoltageAverage / 100,
|
||||
gBatteryVoltageAverage % 100,
|
||||
BATTERY_VoltsToPercent(gBatteryVoltageAverage));
|
||||
|
||||
#if 0
|
||||
sprintf(WelcomeString2, "Current %u", gBatteryCurrent); // needs scaling into mA
|
||||
#endif
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -83,17 +77,9 @@ void UI_DisplayWelcome(void)
|
||||
|
||||
UI_PrintString(WelcomeString0, 0, 127, 0, 10);
|
||||
UI_PrintString(WelcomeString1, 0, 127, 2, 10);
|
||||
#if 0
|
||||
UI_PrintStringSmall(WelcomeString2, 0, 127, 4);
|
||||
#endif
|
||||
UI_PrintStringSmall(Version, 0, 0, 6);
|
||||
UI_PrintStringSmall(Version, 0, 0, 6);
|
||||
|
||||
#if 1
|
||||
ST7565_BlitStatusLine(); // blank status line
|
||||
#else
|
||||
UI_DisplayStatus(true); // show all status line symbols (test)
|
||||
#endif
|
||||
|
||||
ST7565_BlitStatusLine(); // blank status line
|
||||
ST7565_BlitFullScreen();
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user