mirror of
https://github.com/OneOfEleven/uv-k5-firmware-custom.git
synced 2025-04-28 06:11:24 +03:00
I broke power/battery save .. now fixed
This commit is contained in:
parent
787a705b45
commit
28ed7e7842
51
app/app.c
51
app/app.c
@ -98,7 +98,7 @@ static void APP_CheckForIncoming(void)
|
||||
}
|
||||
|
||||
gDualWatchCountdown_10ms = dual_watch_count_after_rx_10ms;
|
||||
gDualWatchCountdownExpired = false;
|
||||
gScheduleDualWatch = false;
|
||||
|
||||
// let the user see DW is not active
|
||||
gDualWatchActive = false;
|
||||
@ -166,8 +166,8 @@ static void APP_HandleIncoming(void)
|
||||
{
|
||||
if (gRxReceptionMode == RX_MODE_DETECTED)
|
||||
{
|
||||
gDualWatchCountdown_10ms = dual_watch_count_after_1_10ms;
|
||||
gDualWatchCountdownExpired = false;
|
||||
gDualWatchCountdown_10ms = dual_watch_count_after_1_10ms;
|
||||
gScheduleDualWatch = false;
|
||||
|
||||
gRxReceptionMode = RX_MODE_LISTENING;
|
||||
|
||||
@ -449,8 +449,8 @@ void APP_StartListening(FUNCTION_Type_t Function)
|
||||
|
||||
if (gScanState == SCAN_OFF && gCssScanMode == CSS_SCAN_MODE_OFF && gEeprom.DUAL_WATCH != DUAL_WATCH_OFF)
|
||||
{
|
||||
gDualWatchCountdown_10ms = dual_watch_count_after_2_10ms;
|
||||
gDualWatchCountdownExpired = false;
|
||||
gDualWatchCountdown_10ms = dual_watch_count_after_2_10ms;
|
||||
gScheduleDualWatch = false;
|
||||
|
||||
gRxVfoIsActive = true;
|
||||
|
||||
@ -944,14 +944,14 @@ void APP_CheckRadioInterrupts(void)
|
||||
{
|
||||
if (gCurrentFunction == FUNCTION_POWER_SAVE && !gRxIdleMode)
|
||||
{
|
||||
gBatterySave_10ms = 20; // 200ms
|
||||
gBatterySaveExpired = false;
|
||||
gBatterySave_10ms = 20; // 200ms
|
||||
gBatterySaveCountdownExpired = 0;
|
||||
}
|
||||
|
||||
if (gEeprom.DUAL_WATCH != DUAL_WATCH_OFF && (gBatterySaveCountdownExpired || gDualWatchCountdown_10ms < dual_watch_count_after_vox_10ms))
|
||||
if (gEeprom.DUAL_WATCH != DUAL_WATCH_OFF && (gScheduleDualWatch || gDualWatchCountdown_10ms < dual_watch_count_after_vox_10ms))
|
||||
{
|
||||
gDualWatchCountdown_10ms = dual_watch_count_after_vox_10ms;
|
||||
gDualWatchCountdownExpired = false;
|
||||
gDualWatchCountdown_10ms = dual_watch_count_after_vox_10ms;
|
||||
gScheduleDualWatch = false;
|
||||
|
||||
// let the user see DW is not active
|
||||
gDualWatchActive = false;
|
||||
@ -1182,9 +1182,9 @@ void APP_Update(void)
|
||||
if (gScreenToDisplay != DISPLAY_SCANNER && gEeprom.DUAL_WATCH != DUAL_WATCH_OFF)
|
||||
{
|
||||
#ifdef ENABLE_VOICE
|
||||
if (gDualWatchCountdownExpired && gVoiceWriteIndex == 0)
|
||||
if (gScheduleDualWatch && gVoiceWriteIndex == 0)
|
||||
#else
|
||||
if (gDualWatchCountdownExpired)
|
||||
if (gScheduleDualWatch)
|
||||
#endif
|
||||
{
|
||||
if (gScanState == SCAN_OFF && gCssScanMode == CSS_SCAN_MODE_OFF)
|
||||
@ -1196,16 +1196,15 @@ void APP_Update(void)
|
||||
gDTMF_CallState == DTMF_CALL_STATE_NONE &&
|
||||
gCurrentFunction != FUNCTION_POWER_SAVE)
|
||||
{
|
||||
gDualWatchCountdownExpired = false;
|
||||
|
||||
DUALWATCH_Alternate(); // toggle between the two VFO's
|
||||
|
||||
if (gRxVfoIsActive && gScreenToDisplay == DISPLAY_MAIN)
|
||||
GUI_SelectNextDisplay(DISPLAY_MAIN);
|
||||
|
||||
gRxVfoIsActive = false;
|
||||
gScanPauseMode = false;
|
||||
gRxReceptionMode = RX_MODE_NONE;
|
||||
gRxVfoIsActive = false;
|
||||
gScanPauseMode = false;
|
||||
gRxReceptionMode = RX_MODE_NONE;
|
||||
gScheduleDualWatch = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -1226,7 +1225,7 @@ void APP_Update(void)
|
||||
if (gEeprom.VOX_SWITCH)
|
||||
APP_HandleVox();
|
||||
|
||||
if (gBatterySaveCountdownExpired)
|
||||
if (gSchedulePowerSave)
|
||||
{
|
||||
#ifdef ENABLE_NOAA
|
||||
if (
|
||||
@ -1242,7 +1241,6 @@ void APP_Update(void)
|
||||
gDTMF_CallState != DTMF_CALL_STATE_NONE)
|
||||
{
|
||||
gBatterySaveCountdown_10ms = battery_save_count_10ms;
|
||||
gBatterySaveCountdownExpired = false;
|
||||
}
|
||||
else
|
||||
if ((IS_NOT_NOAA_CHANNEL(gEeprom.ScreenChannel[0]) && IS_NOT_NOAA_CHANNEL(gEeprom.ScreenChannel[1])) || !gIsNoaaMode)
|
||||
@ -1252,7 +1250,6 @@ void APP_Update(void)
|
||||
else
|
||||
{
|
||||
gBatterySaveCountdown_10ms = battery_save_count_10ms;
|
||||
gBatterySaveCountdownExpired = false;
|
||||
}
|
||||
#else
|
||||
if (
|
||||
@ -1268,19 +1265,20 @@ void APP_Update(void)
|
||||
gDTMF_CallState != DTMF_CALL_STATE_NONE)
|
||||
{
|
||||
gBatterySaveCountdown_10ms = battery_save_count_10ms;
|
||||
gBatterySaveCountdownExpired = false;
|
||||
}
|
||||
else
|
||||
{
|
||||
FUNCTION_Select(FUNCTION_POWER_SAVE);
|
||||
}
|
||||
|
||||
gSchedulePowerSave = false;
|
||||
#endif
|
||||
}
|
||||
|
||||
#ifdef ENABLE_VOICE
|
||||
if (gBatterySaveExpired && gCurrentFunction == FUNCTION_POWER_SAVE && gVoiceWriteIndex == 0)
|
||||
if (gBatterySaveCountdownExpired && gCurrentFunction == FUNCTION_POWER_SAVE && gVoiceWriteIndex == 0)
|
||||
#else
|
||||
if (gBatterySaveExpired && gCurrentFunction == FUNCTION_POWER_SAVE)
|
||||
if (gBatterySaveCountdownExpired && gCurrentFunction == FUNCTION_POWER_SAVE)
|
||||
#endif
|
||||
{
|
||||
if (gRxIdleMode)
|
||||
@ -1300,8 +1298,6 @@ void APP_Update(void)
|
||||
FUNCTION_Init();
|
||||
|
||||
gBatterySave_10ms = 10; // 100ms
|
||||
gBatterySaveExpired = false;
|
||||
|
||||
gRxIdleMode = false;
|
||||
}
|
||||
else
|
||||
@ -1311,8 +1307,6 @@ void APP_Update(void)
|
||||
UI_UpdateRSSI(gCurrentRSSI);
|
||||
|
||||
gBatterySave_10ms = gEeprom.BATTERY_SAVE * 10;
|
||||
gBatterySaveExpired = false;
|
||||
|
||||
gRxIdleMode = true;
|
||||
|
||||
BK4819_DisableVox();
|
||||
@ -1329,8 +1323,9 @@ void APP_Update(void)
|
||||
gUpdateRSSI = true;
|
||||
|
||||
gBatterySave_10ms = 10; // 100ms
|
||||
gBatterySaveExpired = false;
|
||||
}
|
||||
|
||||
gBatterySaveCountdownExpired = false;
|
||||
}
|
||||
}
|
||||
|
||||
|
BIN
firmware.bin
BIN
firmware.bin
Binary file not shown.
Binary file not shown.
13
functions.c
13
functions.c
@ -86,11 +86,9 @@ void FUNCTION_Init(void)
|
||||
|
||||
void FUNCTION_Select(FUNCTION_Type_t Function)
|
||||
{
|
||||
FUNCTION_Type_t PreviousFunction;
|
||||
bool bWasPowerSave;
|
||||
FUNCTION_Type_t PreviousFunction = gCurrentFunction;
|
||||
bool bWasPowerSave = (PreviousFunction == FUNCTION_POWER_SAVE);
|
||||
|
||||
PreviousFunction = gCurrentFunction;
|
||||
bWasPowerSave = (PreviousFunction == FUNCTION_POWER_SAVE);
|
||||
gCurrentFunction = Function;
|
||||
|
||||
if (bWasPowerSave)
|
||||
@ -135,7 +133,8 @@ void FUNCTION_Select(FUNCTION_Type_t Function)
|
||||
|
||||
case FUNCTION_POWER_SAVE:
|
||||
gBatterySave_10ms = gEeprom.BATTERY_SAVE * 10;
|
||||
gBatterySaveExpired = false;
|
||||
|
||||
gBatterySaveCountdownExpired = false;
|
||||
|
||||
gRxIdleMode = true;
|
||||
|
||||
@ -198,8 +197,8 @@ void FUNCTION_Select(FUNCTION_Type_t Function)
|
||||
break;
|
||||
}
|
||||
|
||||
gBatterySaveCountdown_10ms = battery_save_count_10ms;
|
||||
gBatterySaveCountdownExpired = false;
|
||||
gBatterySaveCountdown_10ms = battery_save_count_10ms;
|
||||
gSchedulePowerSave = false;
|
||||
|
||||
#if defined(ENABLE_FMRADIO)
|
||||
gFM_RestoreCountdown = 0;
|
||||
|
@ -33,7 +33,6 @@ bool gLowBatteryBlink;
|
||||
uint16_t gBatteryCheckCounter;
|
||||
|
||||
volatile uint16_t gBatterySave_10ms;
|
||||
volatile bool gBatterySaveExpired;
|
||||
|
||||
void BATTERY_GetReadings(bool bDisplayBatteryLevel)
|
||||
{
|
||||
|
@ -32,7 +32,6 @@ extern bool gLowBatteryBlink;
|
||||
extern uint16_t gBatteryCheckCounter;
|
||||
|
||||
extern volatile uint16_t gBatterySave_10ms;
|
||||
extern volatile bool gBatterySaveExpired;
|
||||
|
||||
void BATTERY_GetReadings(bool bDisplayBatteryLevel);
|
||||
|
||||
|
3
misc.c
3
misc.c
@ -83,6 +83,9 @@ uint8_t gMR_ChannelAttributes[207];
|
||||
|
||||
volatile uint16_t gBatterySaveCountdown_10ms = battery_save_count_10ms;
|
||||
volatile bool gBatterySaveCountdownExpired;
|
||||
volatile bool gSchedulePowerSave;
|
||||
|
||||
volatile bool gScheduleDualWatch = true;
|
||||
|
||||
volatile uint16_t gDualWatchCountdown_10ms;
|
||||
volatile bool gDualWatchCountdownExpired = true;
|
||||
|
3
misc.h
3
misc.h
@ -140,8 +140,11 @@ extern uint16_t gEEPROM_1F8C;
|
||||
extern uint8_t gMR_ChannelAttributes[207];
|
||||
|
||||
extern volatile uint16_t gBatterySaveCountdown_10ms;
|
||||
extern volatile bool gSchedulePowerSave;
|
||||
extern volatile bool gBatterySaveCountdownExpired;
|
||||
|
||||
extern volatile bool gScheduleDualWatch;
|
||||
|
||||
extern volatile uint16_t gDualWatchCountdown_10ms;
|
||||
extern volatile bool gDualWatchCountdownExpired;
|
||||
extern bool gDualWatchActive;
|
||||
|
4
radio.c
4
radio.c
@ -876,8 +876,8 @@ void RADIO_PrepareTX(void)
|
||||
{
|
||||
if (gEeprom.DUAL_WATCH != DUAL_WATCH_OFF)
|
||||
{
|
||||
gDualWatchCountdown_10ms = dual_watch_count_after_tx_10ms;
|
||||
gDualWatchCountdownExpired = false;
|
||||
gDualWatchCountdown_10ms = dual_watch_count_after_tx_10ms;
|
||||
gScheduleDualWatch = false;
|
||||
|
||||
if (!gRxVfoIsActive)
|
||||
{
|
||||
|
@ -70,14 +70,14 @@ void SystickHandler(void)
|
||||
DECREMENT(gFoundCTCSSCountdown_10ms);
|
||||
|
||||
if (gCurrentFunction == FUNCTION_FOREGROUND)
|
||||
DECREMENT_AND_TRIGGER(gBatterySaveCountdown_10ms, gBatterySaveCountdownExpired);
|
||||
DECREMENT_AND_TRIGGER(gBatterySaveCountdown_10ms, gSchedulePowerSave);
|
||||
|
||||
if (gCurrentFunction == FUNCTION_POWER_SAVE)
|
||||
DECREMENT_AND_TRIGGER(gBatterySave_10ms, gBatterySaveExpired);
|
||||
DECREMENT_AND_TRIGGER(gBatterySave_10ms, gBatterySaveCountdownExpired);
|
||||
|
||||
if (gScanState == SCAN_OFF && gCssScanMode == CSS_SCAN_MODE_OFF && gEeprom.DUAL_WATCH != DUAL_WATCH_OFF)
|
||||
if (gCurrentFunction != FUNCTION_MONITOR && gCurrentFunction != FUNCTION_TRANSMIT && gCurrentFunction != FUNCTION_RECEIVE)
|
||||
DECREMENT_AND_TRIGGER(gDualWatchCountdown_10ms, gDualWatchCountdownExpired);
|
||||
DECREMENT_AND_TRIGGER(gDualWatchCountdown_10ms, gScheduleDualWatch);
|
||||
|
||||
#ifdef ENABLE_NOAA
|
||||
if (gScanState == SCAN_OFF && gCssScanMode == CSS_SCAN_MODE_OFF && gEeprom.DUAL_WATCH == DUAL_WATCH_OFF)
|
||||
|
Loading…
x
Reference in New Issue
Block a user