mirror of
https://github.com/kamilsss655/uv-k5-firmware-custom
synced 2024-11-22 02:08:48 +00:00
UART disabled in locked state.
This commit is contained in:
parent
aed640620f
commit
1227460f95
13
app/uart.c
13
app/uart.c
@ -191,7 +191,7 @@ static void SendVersion(void)
|
||||
Reply.Header.ID = 0x0515;
|
||||
Reply.Header.Size = sizeof(Reply.Data);
|
||||
strcpy(Reply.Data.Version, Version);
|
||||
Reply.Data.bHasCustomAesKey = bHasCustomAesKey;
|
||||
Reply.Data.bHasCustomAesKey = false;
|
||||
Reply.Data.bIsInLockScreen = bIsInLockScreen;
|
||||
Reply.Data.Challenge[0] = gChallenge[0];
|
||||
Reply.Data.Challenge[1] = gChallenge[1];
|
||||
@ -223,7 +223,6 @@ static void CMD_051B(const uint8_t *pBuffer)
|
||||
{
|
||||
const CMD_051B_t *pCmd = (const CMD_051B_t *)pBuffer;
|
||||
REPLY_051B_t Reply;
|
||||
bool bLocked = false;
|
||||
|
||||
if (pCmd->Timestamp != Timestamp)
|
||||
return;
|
||||
@ -240,10 +239,7 @@ static void CMD_051B(const uint8_t *pBuffer)
|
||||
Reply.Data.Offset = pCmd->Offset;
|
||||
Reply.Data.Size = pCmd->Size;
|
||||
|
||||
if (bHasCustomAesKey)
|
||||
bLocked = gIsLocked;
|
||||
|
||||
if (!bLocked)
|
||||
EEPROM_ReadBuffer(pCmd->Offset, Reply.Data.Data, pCmd->Size);
|
||||
|
||||
SendReply(&Reply, pCmd->Size + 8);
|
||||
@ -254,7 +250,6 @@ static void CMD_051D(const uint8_t *pBuffer)
|
||||
const CMD_051D_t *pCmd = (const CMD_051D_t *)pBuffer;
|
||||
REPLY_051D_t Reply;
|
||||
bool bReloadEeprom;
|
||||
bool bIsLocked;
|
||||
|
||||
if (pCmd->Timestamp != Timestamp)
|
||||
return;
|
||||
@ -271,17 +266,13 @@ static void CMD_051D(const uint8_t *pBuffer)
|
||||
Reply.Header.Size = sizeof(Reply.Data);
|
||||
Reply.Data.Offset = pCmd->Offset;
|
||||
|
||||
bIsLocked = bHasCustomAesKey ? gIsLocked : bHasCustomAesKey;
|
||||
|
||||
if (!bIsLocked)
|
||||
{
|
||||
unsigned int i;
|
||||
for (i = 0; i < (pCmd->Size / 8); i++)
|
||||
{
|
||||
const uint16_t Offset = pCmd->Offset + (i * 8U);
|
||||
|
||||
if (Offset >= 0x0F30 && Offset < 0x0F40)
|
||||
if (!gIsLocked)
|
||||
bReloadEeprom = true;
|
||||
|
||||
if ((Offset < 0x0E98 || Offset >= 0x0EA0) || !bIsInLockScreen || pCmd->bAllowPassword)
|
||||
@ -290,7 +281,7 @@ static void CMD_051D(const uint8_t *pBuffer)
|
||||
|
||||
if (bReloadEeprom)
|
||||
BOARD_EEPROM_Init();
|
||||
}
|
||||
|
||||
|
||||
SendReply(&Reply, sizeof(Reply));
|
||||
}
|
||||
|
12
board.c
12
board.c
@ -722,18 +722,6 @@ void BOARD_EEPROM_Init(void)
|
||||
}
|
||||
}
|
||||
|
||||
// 0F30..0F3F
|
||||
EEPROM_ReadBuffer(0x0F30, gCustomAesKey, sizeof(gCustomAesKey));
|
||||
bHasCustomAesKey = false;
|
||||
for (i = 0; i < ARRAY_SIZE(gCustomAesKey); i++)
|
||||
{
|
||||
if (gCustomAesKey[i] != 0xFFFFFFFFu)
|
||||
{
|
||||
bHasCustomAesKey = true;
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
#ifdef ENABLE_SPECTRUM_SHOW_CHANNEL_NAME
|
||||
BOARD_gMR_LoadChannels();
|
||||
#endif
|
||||
|
1
main.c
1
main.c
@ -177,6 +177,7 @@ void Main(void)
|
||||
if (gEeprom.POWER_ON_PASSWORD < PASSWORD_OFF)
|
||||
{
|
||||
bIsInLockScreen = true;
|
||||
gIsLocked = true;
|
||||
UI_DisplayLock();
|
||||
bIsInLockScreen = false;
|
||||
}
|
||||
|
3
misc.c
3
misc.c
@ -97,7 +97,6 @@ uint8_t gSetting_battery_text;
|
||||
bool gMonitor = false; // true opens the squelch
|
||||
|
||||
uint32_t gCustomAesKey[4];
|
||||
bool bHasCustomAesKey;
|
||||
uint32_t gChallenge[4];
|
||||
uint8_t gTryCount;
|
||||
|
||||
@ -249,7 +248,7 @@ volatile uint8_t boot_counter_10ms;
|
||||
|
||||
int16_t gCurrentRSSI[2] = {0, 0}; // now one per VFO
|
||||
|
||||
uint8_t gIsLocked = 0xFF;
|
||||
bool gIsLocked = false;
|
||||
|
||||
|
||||
|
||||
|
3
misc.h
3
misc.h
@ -172,7 +172,6 @@ extern bool gMonitor;
|
||||
|
||||
extern const uint32_t gDefaultAesKey[4];
|
||||
extern uint32_t gCustomAesKey[4];
|
||||
extern bool bHasCustomAesKey;
|
||||
extern uint32_t gChallenge[4];
|
||||
extern uint8_t gTryCount;
|
||||
|
||||
@ -353,7 +352,7 @@ extern volatile uint8_t gVFOStateResumeCountdown_500ms;
|
||||
extern volatile bool gScheduleFM;
|
||||
#endif
|
||||
extern int16_t gCurrentRSSI[2]; // now one per VFO
|
||||
extern uint8_t gIsLocked;
|
||||
extern bool gIsLocked;
|
||||
extern volatile uint8_t boot_counter_10ms;
|
||||
|
||||
int32_t NUMBER_AddWithWraparound(int32_t Base, int32_t Add, int32_t LowerLimit, int32_t UpperLimit);
|
||||
|
@ -107,6 +107,7 @@ void UI_DisplayLock(void)
|
||||
if ((gEeprom.POWER_ON_PASSWORD) == Password)
|
||||
{
|
||||
AUDIO_PlayBeep(BEEP_1KHZ_60MS_OPTIONAL);
|
||||
gIsLocked = false;
|
||||
return;
|
||||
}
|
||||
|
||||
@ -143,13 +144,6 @@ void UI_DisplayLock(void)
|
||||
gKeyReading0 = Key;
|
||||
}
|
||||
|
||||
if (UART_IsCommandAvailable())
|
||||
{
|
||||
__disable_irq();
|
||||
UART_HandleCommand();
|
||||
__enable_irq();
|
||||
}
|
||||
|
||||
if (gUpdateDisplay)
|
||||
{
|
||||
Render();
|
||||
|
Loading…
Reference in New Issue
Block a user