Skip to content

Commit

Permalink
show "OK" message as we erase eeprom.
Browse files Browse the repository at this point in the history
  • Loading branch information
kamilsss655 committed Jan 13, 2024
1 parent 6e8169c commit 8719df9
Showing 1 changed file with 17 additions and 11 deletions.
28 changes: 17 additions & 11 deletions ui/lock.c
Original file line number Diff line number Diff line change
Expand Up @@ -30,21 +30,26 @@
#include "ui/lock.h"
#include "board.h"

static void Render(void)
static void Render(bool maxAttemptsReached)
{
unsigned int i;
char String[5];

memset(gStatusLine, 0, sizeof(gStatusLine));
memset(gFrameBuffer, 0, sizeof(gFrameBuffer));

strcpy(String, "LOCK");
UI_PrintString(String, 0, 127, 1, 10);
for (i = 0; i < 4; i++)
String[i] = (gInputBox[i] == 10) ? '-' : '*';
String[6] = 0;
UI_PrintString(String, 0, 127, 3, 12);

if (maxAttemptsReached){
strcpy(String, "OK");
UI_PrintString(String, 0, 127, 2, 10);
}
else
{
strcpy(String, "LOCK");
UI_PrintString(String, 0, 127, 1, 10);
for (i = 0; i < 4; i++)
String[i] = (gInputBox[i] == 10) ? '-' : '*';
String[6] = 0;
UI_PrintString(String, 0, 127, 3, 12);
}
ST7565_BlitStatusLine();
ST7565_BlitFullScreen();
}
Expand All @@ -69,7 +74,8 @@ void UI_DisplayLock(void)

Key = KEYBOARD_Poll();
if (gEeprom.PASSWORD_WRONG_ATTEMPTS >= PASSWORD_MAX_RETRIES)
{
{
Render(true);
BOARD_FactoryReset(true);
return;
}
Expand Down Expand Up @@ -158,7 +164,7 @@ void UI_DisplayLock(void)

if (gUpdateDisplay)
{
Render();
Render(false);
gUpdateDisplay = false;
}
}
Expand Down

0 comments on commit 8719df9

Please sign in to comment.