fix(radio): Limit year range for RTC to prevent overflow (#4124)

This commit is contained in:
philmoz
2023-10-03 10:59:29 +10:00
committed by GitHub
parent 776b64c469
commit a9f468e82a
3 changed files with 3 additions and 3 deletions
+1 -1
View File
@@ -238,7 +238,7 @@ void menuRadioSetup(event_t event)
case 0:
lcdDrawNumber(RADIO_SETUP_2ND_COLUMN-2, y, t.tm_year+TM_YEAR_BASE, rowattr);
lcdDrawChar(lcdNextPos, y, '-');
if (rowattr && s_editMode > 0) t.tm_year = checkIncDec(event, t.tm_year, 112, 200, 0);
if (rowattr && s_editMode > 0) t.tm_year = checkIncDec(event, t.tm_year, 123, 137, 0);
break;
case 1:
lcdDrawNumber(lcdNextPos, y, t.tm_mon+1, rowattr|LEADING0, 2);
+1 -1
View File
@@ -239,7 +239,7 @@ void menuRadioSetup(event_t event)
switch (j) {
case 0:
lcdDrawNumber(RADIO_SETUP_DATE_COLUMN, y, t.tm_year+TM_YEAR_BASE, rowattr|RIGHT);
if (rowattr && s_editMode>0) t.tm_year = checkIncDec(event, t.tm_year, 112, 200, 0);
if (rowattr && s_editMode>0) t.tm_year = checkIncDec(event, t.tm_year, 123, 137, 0);
break;
case 1:
lcdDrawNumber(RADIO_SETUP_DATE_COLUMN+3*FW-2, y, t.tm_mon+1, rowattr|LEADING0|RIGHT, 2);
+1 -1
View File
@@ -126,7 +126,7 @@ class DateTimeWindow : public FormWindow {
// Date
auto line = newLine(&grid);
new StaticText(line, rect_t{}, STR_DATE, 0, COLOR_THEME_PRIMARY1);
year = new NumberEdit(line, rect_t{}, 2018, 2100,
year = new NumberEdit(line, rect_t{}, 2023, 2037,
[=]() -> int32_t {
return TM_YEAR_BASE + m_tm.tm_year;
},