From 4c40aec8b38f043fb7bfa8a2a665f724c0488115 Mon Sep 17 00:00:00 2001 From: 3djc Date: Sun, 18 Jun 2017 20:55:49 +0200 Subject: [PATCH] x7/x9e startup review (#5033) * Turn on X7 like it is done on X9 * 4 squares like shutdown + prep for firmware option to disable * Compile option * - rollback firmware option - fast one second power on - unchanged power off - animation added for x7 power on - animation for power off changed to 'removing' quarter instead of adding (ie the power on anim fills in, the power down fills out) * Cosmetics * Cosmetics --- radio/src/gui/128x64/lcd.cpp | 2 +- radio/src/gui/212x64/widgets.cpp | 4 ++-- radio/src/targets/taranis/board.cpp | 23 +++++++++++++++++++---- 3 files changed, 22 insertions(+), 7 deletions(-) diff --git a/radio/src/gui/128x64/lcd.cpp b/radio/src/gui/128x64/lcd.cpp index 7b1c9272d..2c867040c 100644 --- a/radio/src/gui/128x64/lcd.cpp +++ b/radio/src/gui/128x64/lcd.cpp @@ -1568,7 +1568,7 @@ void drawShutdownAnimation(uint32_t index) lcdClear(); int quarter = index / (PWR_PRESS_SHUTDOWN_DELAY / 5); for (int i=1; i<=4; i++) { - if (quarter >= i) { + if ((4 -quarter) >= i) { lcdDrawFilledRect(LCD_W / 2 - 28 + 10 * i, LCD_H / 2 - 3, 6, 6, SOLID, 0); } } diff --git a/radio/src/gui/212x64/widgets.cpp b/radio/src/gui/212x64/widgets.cpp index fae103994..369337efa 100644 --- a/radio/src/gui/212x64/widgets.cpp +++ b/radio/src/gui/212x64/widgets.cpp @@ -2,7 +2,7 @@ * Copyright (C) OpenTX * * Based on code named - * th9x - http://code.google.com/p/th9x + * th9x - http://code.google.com/p/th9x * er9x - http://code.google.com/p/er9x * gruvin9x - http://code.google.com/p/gruvin9x * @@ -45,7 +45,7 @@ void drawShutdownAnimation(uint32_t index) index /= (PWR_PRESS_SHUTDOWN_DELAY / 4); lcdRefreshWait(); lcdClear(); - lcdDrawBitmap((LCD_W-SHUTDOWN_BITMAP_WIDTH)/2, (LCD_H-SHUTDOWN_BITMAP_HEIGHT)/2, bmp_shutdown, index * SHUTDOWN_BITMAP_WIDTH, SHUTDOWN_BITMAP_WIDTH); + lcdDrawBitmap((LCD_W-SHUTDOWN_BITMAP_WIDTH)/2, (LCD_H-SHUTDOWN_BITMAP_HEIGHT)/2, bmp_shutdown, (3 - index) * SHUTDOWN_BITMAP_WIDTH, SHUTDOWN_BITMAP_WIDTH); lcdRefresh(); } #endif diff --git a/radio/src/targets/taranis/board.cpp b/radio/src/targets/taranis/board.cpp index b0bdb53b6..bf839ae40 100644 --- a/radio/src/targets/taranis/board.cpp +++ b/radio/src/targets/taranis/board.cpp @@ -100,10 +100,11 @@ extern "C" void INTERRUPT_5MS_IRQHandler() } #endif -#if defined(PCBX9E) && !defined(SIMU) -#define PWR_PRESS_DURATION_MIN 200 // 2s +#if (defined(PCBX9E) || defined(PCBX7)) && !defined(SIMU) +#define PWR_PRESS_DURATION_MIN 100 // 1s #define PWR_PRESS_DURATION_MAX 500 // 5s - +#endif +#if (defined(PCBX9E) && !defined(SIMU)) const pm_uchar bmp_startup[] PROGMEM = { #include "startup.lbm" }; @@ -187,10 +188,14 @@ void boardInit() DBGMCU_APB1PeriphConfig(DBGMCU_IWDG_STOP|DBGMCU_TIM1_STOP|DBGMCU_TIM2_STOP|DBGMCU_TIM3_STOP|DBGMCU_TIM6_STOP|DBGMCU_TIM8_STOP|DBGMCU_TIM10_STOP|DBGMCU_TIM13_STOP|DBGMCU_TIM14_STOP, ENABLE); #endif -#if defined(PCBX9E) +#if defined(PCBX9E) || defined(PCBX7) if (!WAS_RESET_BY_WATCHDOG_OR_SOFTWARE()) { lcdClear(); +#if defined(PCBX9E) lcdDrawBitmap(76, 2, bmp_lock, 0, 60); +#else + lcdDrawFilledRect(LCD_W / 2 - 18, LCD_H / 2 - 3, 6, 6, SOLID, 0); +#endif lcdRefresh(); lcdRefreshWait(); @@ -202,7 +207,15 @@ void boardInit() if (duration < PWR_PRESS_DURATION_MIN) { unsigned index = duration / (PWR_PRESS_DURATION_MIN / 4); lcdClear(); +#if defined(PCBX9E) lcdDrawBitmap(76, 2, bmp_startup, index*60, 60); +#else + for(uint8_t i= 0; i < 4; i++) { + if (index >= i) { + lcdDrawFilledRect(LCD_W / 2 - 18 + 10 * i, LCD_H / 2 - 3, 6, 6, SOLID, 0); + } + } +#endif } else if (duration >= PWR_PRESS_DURATION_MAX) { drawSleepBitmap(); @@ -227,7 +240,9 @@ void boardInit() pwrInit(); backlightInit(); } +#if defined(PCBX9E) toplcdInit(); +#endif #else backlightInit(); #endif