mirror of
https://github.com/egzumer/uv-k5-firmware-custom
synced 2024-11-21 17:19:57 +00:00
Power save count constant
This commit is contained in:
parent
3c429753f3
commit
fe212140dd
58
app/app.c
58
app/app.c
@ -432,7 +432,7 @@ void APP_StartListening(FUNCTION_Type_t Function)
|
||||
if (gScanState == SCAN_OFF && gCssScanMode == CSS_SCAN_MODE_OFF && gEeprom.DUAL_WATCH != DUAL_WATCH_OFF)
|
||||
{
|
||||
gRxVfoIsActive = true;
|
||||
|
||||
|
||||
gDualWatchCountdown = dual_watch_count_after_2;
|
||||
gScheduleDualWatch = false;
|
||||
}
|
||||
@ -650,7 +650,7 @@ void APP_CheckRadioInterrupts(void)
|
||||
if (gCurrentFunction == FUNCTION_POWER_SAVE && !gRxIdleMode)
|
||||
{
|
||||
gBatterySave = 20;
|
||||
gBatterySaveCountdownExpired = 0;
|
||||
gBatterySaveCountdownExpired = false;
|
||||
}
|
||||
|
||||
if (gEeprom.DUAL_WATCH != DUAL_WATCH_OFF && (gScheduleDualWatch || gDualWatchCountdown < dual_watch_count_after_vox))
|
||||
@ -926,12 +926,12 @@ void APP_Update(void)
|
||||
gCssScanMode != CSS_SCAN_MODE_OFF ||
|
||||
gScreenToDisplay != DISPLAY_MAIN ||
|
||||
gDTMF_CallState != DTMF_CALL_STATE_NONE)
|
||||
gBatterySaveCountdown = 1000;
|
||||
gBatterySaveCountdown = battery_save_count;
|
||||
else
|
||||
if ((IS_NOT_NOAA_CHANNEL(gEeprom.ScreenChannel[0]) && IS_NOT_NOAA_CHANNEL(gEeprom.ScreenChannel[1])) || !gIsNoaaMode)
|
||||
FUNCTION_Select(FUNCTION_POWER_SAVE);
|
||||
else
|
||||
gBatterySaveCountdown = 1000;
|
||||
gBatterySaveCountdown = battery_save_count;
|
||||
#else
|
||||
if (gFmRadioMode ||
|
||||
gPttIsPressed ||
|
||||
@ -941,7 +941,7 @@ void APP_Update(void)
|
||||
gCssScanMode != CSS_SCAN_MODE_OFF ||
|
||||
gScreenToDisplay != DISPLAY_MAIN ||
|
||||
gDTMF_CallState != DTMF_CALL_STATE_NONE)
|
||||
gBatterySaveCountdown = 1000;
|
||||
gBatterySaveCountdown = battery_save_count;
|
||||
else
|
||||
FUNCTION_Select(FUNCTION_POWER_SAVE);
|
||||
#endif
|
||||
@ -1435,9 +1435,9 @@ void APP_TimeSlice500ms(void)
|
||||
if (gEeprom.AUTO_KEYPAD_LOCK && gKeyLockCountdown > 0 && !gDTMF_InputMode)
|
||||
{
|
||||
if (--gKeyLockCountdown == 0)
|
||||
gEeprom.KEY_LOCK = true;
|
||||
gEeprom.KEY_LOCK = true; // lock the keyboard
|
||||
|
||||
gUpdateStatus = true;
|
||||
gUpdateStatus = true; // lock symbol needs showing
|
||||
}
|
||||
|
||||
if (gVoltageMenuCountdown > 0)
|
||||
@ -1453,6 +1453,7 @@ void APP_TimeSlice500ms(void)
|
||||
|
||||
RADIO_ConfigureChannel(0, 2);
|
||||
RADIO_ConfigureChannel(1, 2);
|
||||
|
||||
RADIO_SetupRegisters(true);
|
||||
}
|
||||
|
||||
@ -1644,10 +1645,10 @@ static void APP_ProcessKey(KEY_Code_t Key, bool bKeyPressed, bool bKeyHeld)
|
||||
if (gCurrentFunction == FUNCTION_POWER_SAVE)
|
||||
FUNCTION_Select(FUNCTION_FOREGROUND);
|
||||
|
||||
gBatterySaveCountdown = 1000;
|
||||
gBatterySaveCountdown = battery_save_count;
|
||||
|
||||
if (gEeprom.AUTO_KEYPAD_LOCK)
|
||||
gKeyLockCountdown = 30;
|
||||
gKeyLockCountdown = 30; // 15 seconds
|
||||
|
||||
if (!bKeyPressed)
|
||||
{
|
||||
@ -1698,41 +1699,32 @@ static void APP_ProcessKey(KEY_Code_t Key, bool bKeyPressed, bool bKeyHeld)
|
||||
}
|
||||
|
||||
if (gEeprom.KEY_LOCK && gCurrentFunction != FUNCTION_TRANSMIT && Key != KEY_PTT)
|
||||
{
|
||||
{ // keyboard is locked
|
||||
|
||||
if (Key == KEY_F)
|
||||
{
|
||||
if (!bKeyHeld)
|
||||
{
|
||||
if (!bKeyPressed)
|
||||
return;
|
||||
|
||||
if (bKeyHeld)
|
||||
return;
|
||||
|
||||
AUDIO_PlayBeep(BEEP_500HZ_60MS_DOUBLE_BEEP_OPTIONAL);
|
||||
|
||||
gKeypadLocked = 4;
|
||||
|
||||
gUpdateDisplay = true;
|
||||
return;
|
||||
}
|
||||
{ // function/key-lock key
|
||||
|
||||
if (!bKeyPressed)
|
||||
return;
|
||||
|
||||
if (!bKeyHeld)
|
||||
{
|
||||
// keypad is locked, tell the user
|
||||
AUDIO_PlayBeep(BEEP_500HZ_60MS_DOUBLE_BEEP_OPTIONAL);
|
||||
gKeypadLocked = 4;
|
||||
gUpdateDisplay = true;
|
||||
return;
|
||||
}
|
||||
}
|
||||
else
|
||||
if (Key != KEY_SIDE1 && Key != KEY_SIDE2)
|
||||
{
|
||||
if (!bKeyPressed)
|
||||
return;
|
||||
|
||||
if (bKeyHeld)
|
||||
if (!bKeyPressed || bKeyHeld)
|
||||
return;
|
||||
|
||||
// keypad is locked, tell the user
|
||||
AUDIO_PlayBeep(BEEP_500HZ_60MS_DOUBLE_BEEP_OPTIONAL);
|
||||
|
||||
gKeypadLocked = 4;
|
||||
|
||||
gKeypadLocked = 4;
|
||||
gUpdateDisplay = true;
|
||||
return;
|
||||
}
|
||||
|
BIN
firmware.bin
BIN
firmware.bin
Binary file not shown.
Binary file not shown.
@ -184,7 +184,8 @@ void FUNCTION_Select(FUNCTION_Type_t Function)
|
||||
break;
|
||||
}
|
||||
|
||||
gBatterySaveCountdown = 1000;
|
||||
gBatterySaveCountdown = battery_save_count;
|
||||
gSchedulePowerSave = false;
|
||||
|
||||
gFM_RestoreCountdown = Countdown;
|
||||
}
|
||||
|
8
misc.c
8
misc.c
@ -30,6 +30,8 @@ const uint32_t gDefaultAesKey[4] = {0x4AA5CC60, 0x0312CC5F, 0xFFD2DABB, 0x6BB
|
||||
|
||||
const uint8_t gMicGain_dB2[5] = {3, 8, 16, 24, 31};
|
||||
|
||||
const uint16_t battery_save_count = 10000 / 10; // 10 seconds
|
||||
|
||||
// 10ms count down resolution
|
||||
const uint16_t dual_watch_count_after_tx = 3600 / 10; // 3.6 sec after TX ends
|
||||
const uint16_t dual_watch_count_after_rx = 1000 / 10; // 1 sec after RX ends ?
|
||||
@ -65,13 +67,14 @@ uint16_t gEEPROM_1F8C;
|
||||
uint8_t gMR_ChannelAttributes[207];
|
||||
|
||||
volatile bool gNextTimeslice500ms;
|
||||
volatile uint16_t gBatterySaveCountdown = 1000;
|
||||
volatile uint16_t gBatterySaveCountdown = battery_save_count;
|
||||
volatile uint16_t gDualWatchCountdown;
|
||||
volatile uint16_t gTxTimerCountdown;
|
||||
volatile uint16_t gTailNoteEliminationCountdown;
|
||||
#ifndef DISABLE_NOAA
|
||||
volatile uint16_t gNOAA_Countdown;
|
||||
#endif
|
||||
|
||||
bool gEnableSpeaker;
|
||||
uint8_t gKeyLockCountdown;
|
||||
uint8_t gRTTECountdown;
|
||||
@ -148,10 +151,11 @@ uint8_t gNeverUsed;
|
||||
uint8_t gNoaaChannel;
|
||||
#endif
|
||||
|
||||
volatile bool gNextTimeslice;
|
||||
bool gUpdateDisplay;
|
||||
bool gF_LOCK;
|
||||
uint8_t gShowChPrefix;
|
||||
|
||||
volatile bool gNextTimeslice;
|
||||
volatile uint16_t gSystickCountdown2;
|
||||
volatile uint8_t gFoundCDCSSCountdown;
|
||||
volatile uint8_t gFoundCTCSSCountdown;
|
||||
|
2
misc.h
2
misc.h
@ -83,6 +83,8 @@ extern const uint16_t gMin_bat_v;
|
||||
|
||||
extern const uint8_t gMicGain_dB2[5];
|
||||
|
||||
extern const uint16_t battery_save_count;
|
||||
|
||||
extern const uint16_t dual_watch_count_after_tx;
|
||||
extern const uint16_t dual_watch_count_after_rx;
|
||||
extern const uint16_t dual_watch_count_after_1;
|
||||
|
@ -36,7 +36,7 @@ void UI_DisplayMain(void)
|
||||
|
||||
memset(gFrameBuffer, 0, sizeof(gFrameBuffer));
|
||||
|
||||
if (gEeprom.KEY_LOCK && gKeypadLocked)
|
||||
if (gEeprom.KEY_LOCK && gKeypadLocked > 0)
|
||||
{
|
||||
UI_PrintString("Long press #", 0, display_width - 1, 1, 8);
|
||||
UI_PrintString("to unlock", 0, display_width - 1, 3, 8);
|
||||
|
Loading…
Reference in New Issue
Block a user