[Taranis X9E] Makefile option "SHUTDOWN_CONFIRMATION=YES/NO" added
This commit is contained in:
@@ -257,6 +257,10 @@ DEFAULT_MODE = NO
|
||||
# Values = YES, NO
|
||||
EEPROM_PROGRESS_BAR = NO
|
||||
|
||||
# Shutdown confirmation (for boards which have soft power)
|
||||
# Values = NO, YES
|
||||
SHUTDOWN_CONFIRMATION = NO
|
||||
|
||||
# Activates the DEBUG Mode (all boards)
|
||||
# On G9X V4 board, when VOICE=NO:
|
||||
# PORTH:7 --> Transition LOW to HIGH = start of setupPulses(). Transition HIGH to LOW = end of setupPulses().
|
||||
@@ -1286,6 +1290,10 @@ ifeq ($(EEPROM_PROGRESS_BAR), YES)
|
||||
CPPDEFS += -DEEPROM_PROGRESS_BAR
|
||||
endif
|
||||
|
||||
ifeq ($(SHUTDOWN_CONFIRMATION), YES)
|
||||
CPPDEFS += -DSHUTDOWN_CONFIRMATION
|
||||
endif
|
||||
|
||||
RUN_FROM_FLASH = 1
|
||||
|
||||
### Global Build-Option Directives ###
|
||||
|
||||
Executable
BIN
Binary file not shown.
|
After Width: | Height: | Size: 3.2 KiB |
@@ -53,9 +53,6 @@ void displayScrollbar(coord_t x, coord_t y, coord_t h, uint16_t offset, uint16_t
|
||||
void displayMenuBar(const MenuItem *menu, int index);
|
||||
void displayProgressBar(const char *label);
|
||||
void updateProgressBar(int num, int den);
|
||||
#if defined(REV9E)
|
||||
void displayShutdownProgress(uint32_t progress);
|
||||
#endif
|
||||
|
||||
extern coord_t scrollbar_X;
|
||||
#define SET_SCROLLBAR_X(x) scrollbar_X = (x);
|
||||
|
||||
@@ -63,19 +63,6 @@ void menu_lcd_onoff(coord_t x, coord_t y, uint8_t value, LcdFlags attr)
|
||||
lcd_square(x, y, 7);
|
||||
}
|
||||
|
||||
#if defined(REV9E)
|
||||
void displayShutdownProgress(uint32_t progress)
|
||||
{
|
||||
lcd_clear();
|
||||
lcd_putsLeft(LCD_H/2-20, STR_POWEROFF);
|
||||
drawFilledRect((LCD_W-44)/2, LCD_H/2-5, 28, 10, SOLID, ERASE);
|
||||
lcd_rect((LCD_W-44)/2, LCD_H/2-5, 28, 10);
|
||||
for (int i=(progress/100); i>=0; i--) {
|
||||
drawFilledRect((LCD_W-44)/2+3+i*8, LCD_H/2-3, 6, 6, SOLID);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
void displayScreenIndex(uint8_t index, uint8_t count, uint8_t attr)
|
||||
{
|
||||
lcd_outdezAtt(LCD_W, 0, count, attr);
|
||||
|
||||
+15
-2
@@ -2599,6 +2599,12 @@ int main(void)
|
||||
#endif // !SIMU
|
||||
|
||||
#if defined(PCBTARANIS) && defined(REV9E)
|
||||
#define PWR_PRESS_SHUTDOWN 300 // 3s
|
||||
|
||||
const pm_uchar bmp_shutdown[] PROGMEM = {
|
||||
#include "../../bitmaps/Taranis/shutdown.lbm"
|
||||
};
|
||||
|
||||
uint32_t pwr_press_time = 0;
|
||||
|
||||
uint32_t pwrPressedDuration()
|
||||
@@ -2632,7 +2638,8 @@ uint32_t pwrCheck()
|
||||
pwr_press_time = get_tmr10ms();
|
||||
}
|
||||
else {
|
||||
if (get_tmr10ms() - pwr_press_time > 300) {
|
||||
if (get_tmr10ms() - pwr_press_time > PWR_PRESS_SHUTDOWN) {
|
||||
#if defined(SHUTDOWN_CONFIRMATION)
|
||||
while (1) {
|
||||
lcdRefreshWait();
|
||||
lcd_clear();
|
||||
@@ -2650,10 +2657,16 @@ uint32_t pwrCheck()
|
||||
return e_power_on;
|
||||
}
|
||||
}
|
||||
#else
|
||||
pwr_check_state = PWR_CHECK_OFF;
|
||||
return e_power_off;
|
||||
#endif
|
||||
}
|
||||
else {
|
||||
lcdRefreshWait();
|
||||
displayShutdownProgress(pwrPressedDuration());
|
||||
unsigned index = pwrPressedDuration() / (PWR_PRESS_SHUTDOWN / 4);
|
||||
lcd_clear();
|
||||
lcd_bmp(76, 0, bmp_shutdown, index*60, 60);
|
||||
lcdRefresh();
|
||||
return e_power_press;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user