mirror of
https://github.com/egzumer/uv-k5-firmware-custom
synced 2024-11-22 01:32:43 +00:00
Power save count constant
This commit is contained in:
parent
3c429753f3
commit
fe212140dd
44
app/app.c
44
app/app.c
@ -650,7 +650,7 @@ void APP_CheckRadioInterrupts(void)
|
|||||||
if (gCurrentFunction == FUNCTION_POWER_SAVE && !gRxIdleMode)
|
if (gCurrentFunction == FUNCTION_POWER_SAVE && !gRxIdleMode)
|
||||||
{
|
{
|
||||||
gBatterySave = 20;
|
gBatterySave = 20;
|
||||||
gBatterySaveCountdownExpired = 0;
|
gBatterySaveCountdownExpired = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (gEeprom.DUAL_WATCH != DUAL_WATCH_OFF && (gScheduleDualWatch || gDualWatchCountdown < dual_watch_count_after_vox))
|
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 ||
|
gCssScanMode != CSS_SCAN_MODE_OFF ||
|
||||||
gScreenToDisplay != DISPLAY_MAIN ||
|
gScreenToDisplay != DISPLAY_MAIN ||
|
||||||
gDTMF_CallState != DTMF_CALL_STATE_NONE)
|
gDTMF_CallState != DTMF_CALL_STATE_NONE)
|
||||||
gBatterySaveCountdown = 1000;
|
gBatterySaveCountdown = battery_save_count;
|
||||||
else
|
else
|
||||||
if ((IS_NOT_NOAA_CHANNEL(gEeprom.ScreenChannel[0]) && IS_NOT_NOAA_CHANNEL(gEeprom.ScreenChannel[1])) || !gIsNoaaMode)
|
if ((IS_NOT_NOAA_CHANNEL(gEeprom.ScreenChannel[0]) && IS_NOT_NOAA_CHANNEL(gEeprom.ScreenChannel[1])) || !gIsNoaaMode)
|
||||||
FUNCTION_Select(FUNCTION_POWER_SAVE);
|
FUNCTION_Select(FUNCTION_POWER_SAVE);
|
||||||
else
|
else
|
||||||
gBatterySaveCountdown = 1000;
|
gBatterySaveCountdown = battery_save_count;
|
||||||
#else
|
#else
|
||||||
if (gFmRadioMode ||
|
if (gFmRadioMode ||
|
||||||
gPttIsPressed ||
|
gPttIsPressed ||
|
||||||
@ -941,7 +941,7 @@ void APP_Update(void)
|
|||||||
gCssScanMode != CSS_SCAN_MODE_OFF ||
|
gCssScanMode != CSS_SCAN_MODE_OFF ||
|
||||||
gScreenToDisplay != DISPLAY_MAIN ||
|
gScreenToDisplay != DISPLAY_MAIN ||
|
||||||
gDTMF_CallState != DTMF_CALL_STATE_NONE)
|
gDTMF_CallState != DTMF_CALL_STATE_NONE)
|
||||||
gBatterySaveCountdown = 1000;
|
gBatterySaveCountdown = battery_save_count;
|
||||||
else
|
else
|
||||||
FUNCTION_Select(FUNCTION_POWER_SAVE);
|
FUNCTION_Select(FUNCTION_POWER_SAVE);
|
||||||
#endif
|
#endif
|
||||||
@ -1435,9 +1435,9 @@ void APP_TimeSlice500ms(void)
|
|||||||
if (gEeprom.AUTO_KEYPAD_LOCK && gKeyLockCountdown > 0 && !gDTMF_InputMode)
|
if (gEeprom.AUTO_KEYPAD_LOCK && gKeyLockCountdown > 0 && !gDTMF_InputMode)
|
||||||
{
|
{
|
||||||
if (--gKeyLockCountdown == 0)
|
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)
|
if (gVoltageMenuCountdown > 0)
|
||||||
@ -1453,6 +1453,7 @@ void APP_TimeSlice500ms(void)
|
|||||||
|
|
||||||
RADIO_ConfigureChannel(0, 2);
|
RADIO_ConfigureChannel(0, 2);
|
||||||
RADIO_ConfigureChannel(1, 2);
|
RADIO_ConfigureChannel(1, 2);
|
||||||
|
|
||||||
RADIO_SetupRegisters(true);
|
RADIO_SetupRegisters(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1644,10 +1645,10 @@ static void APP_ProcessKey(KEY_Code_t Key, bool bKeyPressed, bool bKeyHeld)
|
|||||||
if (gCurrentFunction == FUNCTION_POWER_SAVE)
|
if (gCurrentFunction == FUNCTION_POWER_SAVE)
|
||||||
FUNCTION_Select(FUNCTION_FOREGROUND);
|
FUNCTION_Select(FUNCTION_FOREGROUND);
|
||||||
|
|
||||||
gBatterySaveCountdown = 1000;
|
gBatterySaveCountdown = battery_save_count;
|
||||||
|
|
||||||
if (gEeprom.AUTO_KEYPAD_LOCK)
|
if (gEeprom.AUTO_KEYPAD_LOCK)
|
||||||
gKeyLockCountdown = 30;
|
gKeyLockCountdown = 30; // 15 seconds
|
||||||
|
|
||||||
if (!bKeyPressed)
|
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)
|
if (gEeprom.KEY_LOCK && gCurrentFunction != FUNCTION_TRANSMIT && Key != KEY_PTT)
|
||||||
{
|
{ // keyboard is locked
|
||||||
|
|
||||||
if (Key == KEY_F)
|
if (Key == KEY_F)
|
||||||
{
|
{ // function/key-lock key
|
||||||
if (!bKeyHeld)
|
|
||||||
{
|
|
||||||
if (!bKeyPressed)
|
if (!bKeyPressed)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if (bKeyHeld)
|
if (!bKeyHeld)
|
||||||
return;
|
{
|
||||||
|
// keypad is locked, tell the user
|
||||||
AUDIO_PlayBeep(BEEP_500HZ_60MS_DOUBLE_BEEP_OPTIONAL);
|
AUDIO_PlayBeep(BEEP_500HZ_60MS_DOUBLE_BEEP_OPTIONAL);
|
||||||
|
|
||||||
gKeypadLocked = 4;
|
gKeypadLocked = 4;
|
||||||
|
|
||||||
gUpdateDisplay = true;
|
gUpdateDisplay = true;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!bKeyPressed)
|
|
||||||
return;
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
if (Key != KEY_SIDE1 && Key != KEY_SIDE2)
|
if (Key != KEY_SIDE1 && Key != KEY_SIDE2)
|
||||||
{
|
{
|
||||||
if (!bKeyPressed)
|
if (!bKeyPressed || bKeyHeld)
|
||||||
return;
|
|
||||||
|
|
||||||
if (bKeyHeld)
|
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
// keypad is locked, tell the user
|
||||||
AUDIO_PlayBeep(BEEP_500HZ_60MS_DOUBLE_BEEP_OPTIONAL);
|
AUDIO_PlayBeep(BEEP_500HZ_60MS_DOUBLE_BEEP_OPTIONAL);
|
||||||
|
|
||||||
gKeypadLocked = 4;
|
gKeypadLocked = 4;
|
||||||
|
|
||||||
gUpdateDisplay = true;
|
gUpdateDisplay = true;
|
||||||
return;
|
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;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
gBatterySaveCountdown = 1000;
|
gBatterySaveCountdown = battery_save_count;
|
||||||
gSchedulePowerSave = false;
|
gSchedulePowerSave = false;
|
||||||
|
|
||||||
gFM_RestoreCountdown = Countdown;
|
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 uint8_t gMicGain_dB2[5] = {3, 8, 16, 24, 31};
|
||||||
|
|
||||||
|
const uint16_t battery_save_count = 10000 / 10; // 10 seconds
|
||||||
|
|
||||||
// 10ms count down resolution
|
// 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_tx = 3600 / 10; // 3.6 sec after TX ends
|
||||||
const uint16_t dual_watch_count_after_rx = 1000 / 10; // 1 sec after RX 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];
|
uint8_t gMR_ChannelAttributes[207];
|
||||||
|
|
||||||
volatile bool gNextTimeslice500ms;
|
volatile bool gNextTimeslice500ms;
|
||||||
volatile uint16_t gBatterySaveCountdown = 1000;
|
volatile uint16_t gBatterySaveCountdown = battery_save_count;
|
||||||
volatile uint16_t gDualWatchCountdown;
|
volatile uint16_t gDualWatchCountdown;
|
||||||
volatile uint16_t gTxTimerCountdown;
|
volatile uint16_t gTxTimerCountdown;
|
||||||
volatile uint16_t gTailNoteEliminationCountdown;
|
volatile uint16_t gTailNoteEliminationCountdown;
|
||||||
#ifndef DISABLE_NOAA
|
#ifndef DISABLE_NOAA
|
||||||
volatile uint16_t gNOAA_Countdown;
|
volatile uint16_t gNOAA_Countdown;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
bool gEnableSpeaker;
|
bool gEnableSpeaker;
|
||||||
uint8_t gKeyLockCountdown;
|
uint8_t gKeyLockCountdown;
|
||||||
uint8_t gRTTECountdown;
|
uint8_t gRTTECountdown;
|
||||||
@ -148,10 +151,11 @@ uint8_t gNeverUsed;
|
|||||||
uint8_t gNoaaChannel;
|
uint8_t gNoaaChannel;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
volatile bool gNextTimeslice;
|
|
||||||
bool gUpdateDisplay;
|
bool gUpdateDisplay;
|
||||||
bool gF_LOCK;
|
bool gF_LOCK;
|
||||||
uint8_t gShowChPrefix;
|
uint8_t gShowChPrefix;
|
||||||
|
|
||||||
|
volatile bool gNextTimeslice;
|
||||||
volatile uint16_t gSystickCountdown2;
|
volatile uint16_t gSystickCountdown2;
|
||||||
volatile uint8_t gFoundCDCSSCountdown;
|
volatile uint8_t gFoundCDCSSCountdown;
|
||||||
volatile uint8_t gFoundCTCSSCountdown;
|
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 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_tx;
|
||||||
extern const uint16_t dual_watch_count_after_rx;
|
extern const uint16_t dual_watch_count_after_rx;
|
||||||
extern const uint16_t dual_watch_count_after_1;
|
extern const uint16_t dual_watch_count_after_1;
|
||||||
|
@ -36,7 +36,7 @@ void UI_DisplayMain(void)
|
|||||||
|
|
||||||
memset(gFrameBuffer, 0, sizeof(gFrameBuffer));
|
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("Long press #", 0, display_width - 1, 1, 8);
|
||||||
UI_PrintString("to unlock", 0, display_width - 1, 3, 8);
|
UI_PrintString("to unlock", 0, display_width - 1, 3, 8);
|
||||||
|
Loading…
Reference in New Issue
Block a user