Add support for pwr-on and power-off speed

This commit is contained in:
Raphael Coeffic
2019-08-16 21:02:47 +02:00
parent 8d9a7c22e6
commit 995888ae41
32 changed files with 927 additions and 739 deletions
+9
View File
@@ -66,6 +66,7 @@ enum menuRadioSetupItems {
ITEM_SETUP_BRIGHTNESS,
ITEM_SETUP_DIM_LEVEL,
ITEM_SETUP_FLASH_BEEP,
CASE_PWR_BUTTON_PRESS(ITEM_SETUP_PWR_OFF_SPEED)
CASE_GPS(ITEM_SETUP_LABEL_GPS)
CASE_GPS(ITEM_SETUP_TIMEZONE)
CASE_GPS(ITEM_SETUP_ADJUST_RTC)
@@ -114,6 +115,7 @@ bool menuRadioSetup(event_t event)
CASE_HAPTIC(LABEL(HAPTIC)) CASE_HAPTIC(0) CASE_HAPTIC(0) CASE_HAPTIC(0)
LABEL(ALARMS), 0, 0, 0, 0,
LABEL(BACKLIGHT), 0, 0, 0, 0, 0,
CASE_PWR_BUTTON_PRESS(0)
CASE_GPS(LABEL(GPS)) CASE_GPS(0) CASE_GPS(0) CASE_GPS(0)
CASE_PXX1(0) 0, 0, FAI_CHOICE_ROW 0, 0, 0, 0, 1/*to force edit mode*/ }); // Country code - Voice Language - Units - Fai choice - Play delay - USB mode - Chan order - Mode (1 to 4)
@@ -380,6 +382,13 @@ bool menuRadioSetup(event_t event)
g_eeGeneral.blOffBright = editSlider(RADIO_SETUP_2ND_COLUMN, y, event, g_eeGeneral.blOffBright, BACKLIGHT_LEVEL_MIN, BACKLIGHT_LEVEL_MAX, attr);
break;
#if defined(PWR_BUTTON_PRESS)
case ITEM_SETUP_PWR_OFF_SPEED:
lcdDrawText(MENUS_MARGIN_LEFT, y, STR_PWR_OFF_SPEED);
g_eeGeneral.pwrOffSpeed = editSlider(RADIO_SETUP_2ND_COLUMN, y, event, g_eeGeneral.pwrOffSpeed, 0, 3, attr);
break;
#endif
case ITEM_SETUP_LABEL_GPS:
lcdDrawText(MENUS_MARGIN_LEFT, y, STR_GPS);
break;
+5 -3
View File
@@ -391,8 +391,10 @@ void drawSleepBitmap()
}
#define SHUTDOWN_CIRCLE_DIAMETER 150
void drawShutdownAnimation(uint32_t duration, const char * message)
void drawShutdownAnimation(uint32_t duration, uint32_t total_duration, const char * message)
{
if (total_duration == 0) return;
static uint32_t lastDuration = 0xffffffff;
static const BitmapBuffer * shutdown = BitmapBuffer::load(getThemePath("shutdown.bmp"));
@@ -404,7 +406,7 @@ void drawShutdownAnimation(uint32_t duration, const char * message)
}
else {
lcdRestoreBackupBuffer();
int quarter = duration / (PWR_PRESS_SHUTDOWN_DELAY / 5);
int quarter = duration / (total_duration / 5);
if (quarter >= 1) lcdDrawBitmapPattern(LCD_W/2, (LCD_H-SHUTDOWN_CIRCLE_DIAMETER)/2, LBM_SHUTDOWN_CIRCLE, TEXT_COLOR, 0, SHUTDOWN_CIRCLE_DIAMETER/2);
if (quarter >= 2) lcdDrawBitmapPattern(LCD_W/2, LCD_H/2, LBM_SHUTDOWN_CIRCLE, TEXT_COLOR, SHUTDOWN_CIRCLE_DIAMETER/2, SHUTDOWN_CIRCLE_DIAMETER/2);
if (quarter >= 3) lcdDrawBitmapPattern((LCD_W-SHUTDOWN_CIRCLE_DIAMETER)/2, LCD_H/2, LBM_SHUTDOWN_CIRCLE, TEXT_COLOR, SHUTDOWN_CIRCLE_DIAMETER, SHUTDOWN_CIRCLE_DIAMETER/2);
@@ -413,7 +415,7 @@ void drawShutdownAnimation(uint32_t duration, const char * message)
}
else {
lcd->clear();
int quarter = duration / (PWR_PRESS_SHUTDOWN_DELAY / 5);
int quarter = duration / (total_duration / 5);
for (int i=1; i<=4; i++) {
if (quarter >= i) {
lcd->drawSolidFilledRect(LCD_W / 2 - 70 + 24 * i, LCD_H / 2 - 10, 20, 20, TEXT_BGCOLOR);
+1 -1
View File
@@ -69,7 +69,7 @@ int16_t editGVarFieldValue(coord_t x, coord_t y, int16_t value, int16_t min, int
void drawMenuTemplate(const char * title, uint8_t icon, const uint8_t * icons=nullptr, uint32_t options=0);
void drawSplash();
void drawSleepBitmap();
void drawShutdownAnimation(uint32_t duration, const char * message);
void drawShutdownAnimation(uint32_t duration, uint32_t total_duration, const char * message);
// Main view standard widgets
void drawTopBar();