feat: add 0.5 second option to power on/off delays (#5134)
This commit is contained in:
@@ -585,17 +585,11 @@ void menuRadioSetup(event_t event)
|
||||
|
||||
#if defined(PWR_BUTTON_PRESS)
|
||||
case ITEM_RADIO_SETUP_PWR_ON_SPEED:
|
||||
lcdDrawTextAlignedLeft(y, STR_PWR_ON_DELAY);
|
||||
lcdDrawNumber(LCD_W-7, y, 2 - g_eeGeneral.pwrOnSpeed, attr|RIGHT);
|
||||
lcdDrawChar(lcdLastRightPos, y, 's');
|
||||
if (attr) CHECK_INCDEC_GENVAR(event, g_eeGeneral.pwrOnSpeed, -1, 2);
|
||||
g_eeGeneral.pwrOnSpeed = pwrDelayToYaml(editChoice(LCD_W-2, y, STR_PWR_ON_DELAY, STR_PWR_OFF_DELAYS, pwrDelayFromYaml(g_eeGeneral.pwrOnSpeed), 0, 4, attr|RIGHT, event));
|
||||
break;
|
||||
|
||||
case ITEM_RADIO_SETUP_PWR_OFF_SPEED:
|
||||
lcdDrawTextAlignedLeft(y, STR_PWR_OFF_DELAY);
|
||||
lcdDrawNumber(LCD_W-7, y, 2 - g_eeGeneral.pwrOffSpeed, attr|RIGHT);
|
||||
lcdDrawChar(lcdLastRightPos, y, 's');
|
||||
if (attr) CHECK_INCDEC_GENVAR(event, g_eeGeneral.pwrOffSpeed, -1, 2);
|
||||
g_eeGeneral.pwrOffSpeed = pwrDelayToYaml(editChoice(LCD_W-2, y, STR_PWR_OFF_DELAY, STR_PWR_OFF_DELAYS, pwrDelayFromYaml(g_eeGeneral.pwrOffSpeed), 0, 4, attr|RIGHT, event));
|
||||
break;
|
||||
#endif
|
||||
|
||||
|
||||
@@ -549,17 +549,11 @@ void menuRadioSetup(event_t event)
|
||||
|
||||
#if defined(PWR_BUTTON_PRESS)
|
||||
case ITEM_RADIO_SETUP_PWR_ON_SPEED:
|
||||
lcdDrawTextAlignedLeft(y, STR_PWR_ON_DELAY);
|
||||
lcdDrawNumber(RADIO_SETUP_2ND_COLUMN, y, 2 - g_eeGeneral.pwrOnSpeed, attr|LEFT);
|
||||
lcdDrawChar(lcdLastRightPos, y, 's');
|
||||
if (attr) CHECK_INCDEC_GENVAR(event, g_eeGeneral.pwrOnSpeed, -1, 2);
|
||||
g_eeGeneral.pwrOnSpeed = pwrDelayToYaml(editChoice(LCD_W-2, y, STR_PWR_ON_DELAY, STR_PWR_OFF_DELAYS, pwrDelayFromYaml(g_eeGeneral.pwrOnSpeed), 0, 4, attr|RIGHT, event));
|
||||
break;
|
||||
|
||||
case ITEM_RADIO_SETUP_PWR_OFF_SPEED:
|
||||
lcdDrawTextAlignedLeft(y, STR_PWR_OFF_DELAY);
|
||||
lcdDrawNumber(RADIO_SETUP_2ND_COLUMN, y, 2 - g_eeGeneral.pwrOffSpeed, attr|LEFT);
|
||||
lcdDrawChar(lcdLastRightPos, y, 's');
|
||||
if (attr) CHECK_INCDEC_GENVAR(event, g_eeGeneral.pwrOffSpeed, -1, 2);
|
||||
g_eeGeneral.pwrOffSpeed = pwrDelayToYaml(editChoice(LCD_W-2, y, STR_PWR_OFF_DELAY, STR_PWR_OFF_DELAYS, pwrDelayFromYaml(g_eeGeneral.pwrOffSpeed), 0, 4, attr|RIGHT, event));
|
||||
break;
|
||||
#endif
|
||||
|
||||
|
||||
@@ -760,10 +760,10 @@ static SetupLineDef setupLines[] = {
|
||||
STR_PWR_OFF_DELAY,
|
||||
[](Window* parent, coord_t x, coord_t y) {
|
||||
new Choice(
|
||||
parent, {x, y, 0, EdgeTxStyles::UI_ELEMENT_HEIGHT}, STR_PWR_OFF_DELAYS, 0, 3,
|
||||
[=]() -> int32_t { return 2 - g_eeGeneral.pwrOffSpeed; },
|
||||
parent, {x, y, 0, EdgeTxStyles::UI_ELEMENT_HEIGHT}, STR_PWR_OFF_DELAYS, 0, 4,
|
||||
[=]() -> int32_t { return pwrDelayFromYaml(g_eeGeneral.pwrOffSpeed); },
|
||||
[=](int32_t newValue) {
|
||||
g_eeGeneral.pwrOffSpeed = 2 - newValue;
|
||||
g_eeGeneral.pwrOffSpeed = pwrDelayToYaml(newValue);
|
||||
SET_DIRTY();
|
||||
});
|
||||
}
|
||||
|
||||
@@ -247,7 +247,7 @@ void drawShutdownAnimation(uint32_t duration, uint32_t totalDuration,
|
||||
}
|
||||
}
|
||||
|
||||
int quarter = 3 - duration / (totalDuration / 5);
|
||||
int quarter = 4 - (duration * 5) / totalDuration;
|
||||
if (quarter < 0) quarter = 0;
|
||||
for (int i = 3; i >= quarter; i -= 1) shutdownAnim[i]->hide();
|
||||
|
||||
|
||||
Reference in New Issue
Block a user