diff --git a/radio/src/bitmaps/Taranis/lock.png b/radio/src/bitmaps/Taranis/lock.png new file mode 100755 index 000000000..a3b103e94 Binary files /dev/null and b/radio/src/bitmaps/Taranis/lock.png differ diff --git a/radio/src/bitmaps/Taranis/logo.bmp b/radio/src/bitmaps/Taranis/logo.bmp deleted file mode 100755 index 42e792dc8..000000000 Binary files a/radio/src/bitmaps/Taranis/logo.bmp and /dev/null differ diff --git a/radio/src/bitmaps/Taranis/sleep.png b/radio/src/bitmaps/Taranis/sleep.png new file mode 100755 index 000000000..b35df3e52 Binary files /dev/null and b/radio/src/bitmaps/Taranis/sleep.png differ diff --git a/radio/src/bitmaps/Taranis/startup.png b/radio/src/bitmaps/Taranis/startup.png new file mode 100644 index 000000000..03fac5a86 Binary files /dev/null and b/radio/src/bitmaps/Taranis/startup.png differ diff --git a/radio/src/targets/taranis/board_taranis.cpp b/radio/src/targets/taranis/board_taranis.cpp index 7742a8c45..c7c1c5d45 100644 --- a/radio/src/targets/taranis/board_taranis.cpp +++ b/radio/src/targets/taranis/board_taranis.cpp @@ -115,6 +115,18 @@ extern "C" void INTERRUPT_5MS_IRQHandler() #if defined(REV9E) #define PWR_PRESS_DURATION_MIN 80 // 800ms #define PWR_PRESS_DURATION_MAX 300 // 3s + + const pm_uchar bmp_startup[] PROGMEM = { + #include "../../bitmaps/Taranis/startup.lbm" + }; + + const pm_uchar bmp_lock[] PROGMEM = { + #include "../../bitmaps/Taranis/lock.lbm" + }; + + const pm_uchar bmp_sleep[] PROGMEM = { + #include "../../bitmaps/Taranis/sleep.lbm" + }; #endif void boardInit() @@ -124,74 +136,14 @@ void boardInit() RCC_APB2PeriphClockCmd(BACKLIGHT_RCC_APB2Periph | ADC_RCC_APB2Periph | HAPTIC_RCC_APB2Periph | INTMODULE_RCC_APB2Periph | EXTMODULE_RCC_APB2Periph | HEARTBEAT_RCC_APB2Periph, ENABLE); pwrInit(); - - init5msTimer(); - __enable_irq(); - -#if 0 // first version - if (!(RCC->CSR & (RCC_CSR_SFTRSTF | RCC_CSR_WDGRSTF))) { - tmr10ms_t start = get_tmr10ms(); - while (pwrPressed()); - tmr10ms_t duration = get_tmr10ms() - start; - if (duration < PWR_PRESS_DURATION_MIN || duration >= PWR_PRESS_DURATION_MAX) { - pwrOff(); - } - } -#endif - -#if 0 // second version - if (!(RCC->CSR & (RCC_CSR_SFTRSTF | RCC_CSR_WDGRSTF))) { - tmr10ms_t start = get_tmr10ms(); - tmr10ms_t duration = 0; - uint8_t pwr_on = 0; - while (pwrPressed()) { - duration = get_tmr10ms() - start; - if (duration >= PWR_PRESS_DURATION_MAX) { - turnBacklightOff(); - } - else if (duration > PWR_PRESS_DURATION_MIN && pwr_on != 1) { - backlightInit(); - pwr_on = 1; - } - } - if (duration < PWR_PRESS_DURATION_MIN || duration >= PWR_PRESS_DURATION_MAX) { - pwrOff(); - } - } -#endif - -#if defined(REV9E) // third version - if (!(RCC->CSR & (RCC_CSR_SFTRSTF | RCC_CSR_WDGRSTF))) { - tmr10ms_t start = get_tmr10ms(); - tmr10ms_t duration = 0; - uint8_t pwr_on = 0; - while (pwrPressed()) { - duration = get_tmr10ms() - start; - if (duration >= PWR_PRESS_DURATION_MAX) { - turnBacklightOff(); - } - else if (duration > PWR_PRESS_DURATION_MIN && pwr_on != 1) { - backlightInit(); - pwr_on = 1; - } - } - if (duration < PWR_PRESS_DURATION_MIN || duration >= PWR_PRESS_DURATION_MAX) { - pwrOff(); - } - } -#endif - keysInit(); adcInit(); delaysInit(); lcdInit(); // delaysInit() must be called before - -#if defined(REV9E) - topLcdInit(); -#endif - audioInit(); init2MhzTimer(); + init5msTimer(); + __enable_irq(); i2cInit(); usbInit(); @@ -207,7 +159,45 @@ 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(REV9E) + if (!(RCC->CSR & (RCC_CSR_SFTRSTF | RCC_CSR_WDGRSTF))) { + tmr10ms_t start = get_tmr10ms(); + tmr10ms_t duration = 0; + uint8_t pwr_on = 0; + while (pwrPressed()) { + duration = get_tmr10ms() - start; + lcd_clear(); + if (duration < PWR_PRESS_DURATION_MIN) { + lcd_bmp(76, 0, bmp_lock, 0, 60); + } + else if (duration >= PWR_PRESS_DURATION_MAX) { + lcd_bmp(76, 0, bmp_sleep, 0, 60); + turnBacklightOff(); + } + else { + unsigned index = (duration - PWR_PRESS_DURATION_MIN) / ((PWR_PRESS_DURATION_MAX-PWR_PRESS_DURATION_MIN) / 4); + lcd_bmp(76, 0, bmp_startup, index*60, 60); + if (pwr_on != 1) { + backlightInit(); + pwr_on = 1; + } + } + lcdRefresh(); + } + if (duration < PWR_PRESS_DURATION_MIN || duration >= PWR_PRESS_DURATION_MAX) { + pwrOff(); + } + else { + lcdRefreshWait(); + } + } + else { + backlightInit(); + } + topLcdInit(); +#else backlightInit(); +#endif } #endif diff --git a/radio/src/targets/taranis/board_taranis.h b/radio/src/targets/taranis/board_taranis.h index 5c3546a54..605332f20 100644 --- a/radio/src/targets/taranis/board_taranis.h +++ b/radio/src/targets/taranis/board_taranis.h @@ -342,6 +342,7 @@ void bluetoothWakeup(void); // LCD driver void lcdInit(void); +void lcdInitFinish(void); void lcdOff(void); // Top LCD driver diff --git a/radio/src/targets/taranis/lcd_driver.cpp b/radio/src/targets/taranis/lcd_driver.cpp index afc965bb8..4ad229b7e 100644 --- a/radio/src/targets/taranis/lcd_driver.cpp +++ b/radio/src/targets/taranis/lcd_driver.cpp @@ -268,8 +268,8 @@ void backlightInit() BACKLIGHT_TIMER->PSC = (PERI2_FREQUENCY * TIMER_MULT_APB2) / 50000 - 1; // 20us * 100 = 2ms => 500Hz BACKLIGHT_TIMER->CCMR1 = TIM_CCMR1_OC1M_1 | TIM_CCMR1_OC1M_2 | TIM_CCMR1_OC2M_1 | TIM_CCMR1_OC2M_2 ; // PWM BACKLIGHT_TIMER->CCER = TIM_CCER_CC1E | TIM_CCER_CC2E ; - BACKLIGHT_TIMER->CCR1 = 0 ; - BACKLIGHT_TIMER->CCR2 = 80 ; + BACKLIGHT_TIMER->CCR2 = 0 ; + BACKLIGHT_TIMER->CCR1 = 100 ; BACKLIGHT_TIMER->EGR = 0 ; BACKLIGHT_TIMER->CR1 = TIM_CR1_CEN ; // Counter enable #elif defined(REVPLUS) @@ -287,7 +287,7 @@ void backlightInit() BACKLIGHT_TIMER->CCMR2 = TIM_CCMR2_OC4M_1 | TIM_CCMR2_OC4M_2 ; // PWM BACKLIGHT_TIMER->CCER = TIM_CCER_CC4E | TIM_CCER_CC2E ; BACKLIGHT_TIMER->CCR2 = 0 ; - BACKLIGHT_TIMER->CCR4 = 80 ; + BACKLIGHT_TIMER->CCR4 = 100 ; BACKLIGHT_TIMER->EGR = 0 ; BACKLIGHT_TIMER->CR1 = TIM_CR1_CEN ; // Counter enable #else