[Horus] Shutdown animation now OK

This commit is contained in:
Bertrand Songis
2016-01-16 11:00:42 +01:00
parent 295491f965
commit 3f7b289ebe
43 changed files with 96 additions and 56 deletions
+2 -1
View File
@@ -84,6 +84,7 @@ if(PCB STREQUAL HORUS)
pwr_driver.c
sdram_driver.c
led_driver.cpp
mp3_driver.cpp
)
set(STM32LIB_SRC
STM32F4xx_StdPeriph_Driver/src/stm32f4xx_sdio.c
@@ -425,7 +426,7 @@ if(ARCH STREQUAL ARM)
keys_driver.cpp
adc_driver.cpp
trainer_driver.cpp
mp3_driver.cpp
audio_driver.cpp
serial2_driver.cpp
telemetry_driver.cpp
)
+3 -3
View File
@@ -6,8 +6,8 @@ add_truetype_font_target(horus dblsize "DejaVu Sans" 32 True)
add_truetype_font_target(horus xxlsize "DejaVu Sans" 48 False)
add_custom_target(ttf_horus_fonts DEPENDS ttf_horus_tinsize ttf_horus_smlsize ttf_horus_stdsize ttf_horus_midsize ttf_horus_dblsize ttf_horus_xxlsize)
add_bitmaps_target(horus_bitmaps "${RADIO_SRC_DIRECTORY}/bitmaps/horus/????[^_]*.png" 480 5/6/5)
# add_bitmaps_target(horus_alpha_bitmaps "${RADIO_SRC_DIRECTORY}/bitmaps/horus/alpha_*.png" 480 5/6/5/8)
add_bitmaps_target(horus_bitmaps "${RADIO_SRC_DIRECTORY}/bitmaps/horus/bmp_*.png" 480 5/6/5)
add_bitmaps_target(horus_alpha_bitmaps "${RADIO_SRC_DIRECTORY}/bitmaps/horus/alpha_*.png" 480 5/6/5/8)
add_bitmaps_target(horus_masks ${RADIO_SRC_DIRECTORY}/bitmaps/horus/mask_*.png 480 8bits)
add_bitmaps_target(horus_fonts ${RADIO_SRC_DIRECTORY}/fonts/horus/*.png 480 8bits)
add_dependencies(horus_bitmaps horus_masks horus_fonts)
add_dependencies(horus_bitmaps horus_alpha_bitmaps horus_masks horus_fonts)
Binary file not shown.

After

Width:  |  Height:  |  Size: 9.7 KiB

Before

Width:  |  Height:  |  Size: 9.2 KiB

After

Width:  |  Height:  |  Size: 9.2 KiB

Before

Width:  |  Height:  |  Size: 58 KiB

After

Width:  |  Height:  |  Size: 58 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 16 KiB

Before

Width:  |  Height:  |  Size: 7.5 KiB

After

Width:  |  Height:  |  Size: 7.5 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 21 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 5.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.4 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 11 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 17 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 10 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 326 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 325 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.4 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.6 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.5 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 558 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.4 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.3 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 185 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 178 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 778 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 788 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 780 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 829 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 737 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 677 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 681 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 728 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.5 KiB

+6 -6
View File
@@ -49,7 +49,7 @@ const uint8_t LBM_CURRENT_DOT[] = {
*/
const uint8_t LBM_MAINVIEW_BACKGROUND[] = {
#include "background.lbm"
#include "bmp_background.lbm"
};
const uint8_t LBM_TOPMENU_OPENTX[] = {
@@ -233,7 +233,7 @@ const uint8_t LBM_STAR1[] __DMA = {
*/
const uint8_t LBM_ASTERISK[] __DMA = {
#include "asterisk.lbm"
#include "bmp_asterisk.lbm"
};
const uint8_t LBM_POINT[] __DMA = {
@@ -253,13 +253,13 @@ const uint8_t LBM_CURVE_COORD_SHADOW[] __DMA = {
};
const uint8_t LBM_SHUTDOWN[] __DMA = {
#include "shutdown.lbm"
#include "alpha_shutdown.lbm"
};
const uint8_t LBM_SLEEP[] __DMA = {
#include "sleep.lbm"
#include "bmp_sleep.lbm"
};
const uint8_t LBM_BIGRSCALE[] __DMA = {
#include "mask_bigrscale.lbm"
const uint8_t LBM_SHUTDOWN_CIRCLE[] __DMA = {
#include "mask_shutdown_circle.lbm"
};
+1 -1
View File
@@ -134,4 +134,4 @@ extern const uint8_t LBM_CURVE_POINT_CENTER[];
extern const uint8_t LBM_CURVE_COORD_SHADOW[];
extern const uint8_t LBM_SHUTDOWN[];
extern const uint8_t LBM_SLEEP[];
extern const uint8_t LBM_BIGRSCALE[];
extern const uint8_t LBM_SHUTDOWN_CIRCLE[];
+29 -10
View File
@@ -93,7 +93,7 @@ void lcdDrawBitmapPattern(coord_t x, coord_t y, const uint8_t * img, LcdFlags fl
display_t * p = PIXEL_PTR(x, y+row);
const uint8_t * q = img + 4 + row*w + offset;
for (coord_t col=0; col<width; col++) {
lcdDrawTransparentPixel(p, *q, color);
lcdDrawAlphaPixel(p, *q, color);
p++; q++;
}
}
@@ -798,7 +798,7 @@ void lcdSetContrast()
lcdSetRefVolt(g_eeGeneral.contrast);
}
void lcdDrawTransparentPixel(display_t * p, uint8_t opacity, uint16_t color)
void lcdDrawAlphaPixel(display_t * p, uint8_t opacity, uint16_t color)
{
ASSERT_IN_DISPLAY(p);
@@ -836,14 +836,14 @@ void lcdDrawHorizontalLine(coord_t x, coord_t y, coord_t w, uint8_t pat, LcdFlag
if (pat == SOLID) {
while (w--) {
lcdDrawTransparentPixel(p, opacity, color);
lcdDrawAlphaPixel(p, opacity, color);
p++;
}
}
else {
while (w--) {
if (pat & 1) {
lcdDrawTransparentPixel(p, opacity, color);
lcdDrawAlphaPixel(p, opacity, color);
pat = (pat >> 1) | 0x80;
}
else {
@@ -867,7 +867,7 @@ void lcdDrawVerticalLine(coord_t x, coord_t y, coord_t h, uint8_t pat, LcdFlags
if (pat == SOLID) {
while (h--) {
lcdDrawTransparentPixel(x, y, opacity, color);
lcdDrawAlphaPixel(x, y, opacity, color);
y++;
}
}
@@ -877,7 +877,7 @@ void lcdDrawVerticalLine(coord_t x, coord_t y, coord_t h, uint8_t pat, LcdFlags
}
while (h--) {
if (pat & 1) {
lcdDrawTransparentPixel(x, y, opacity, color);
lcdDrawAlphaPixel(x, y, opacity, color);
pat = (pat >> 1) | 0x80;
}
else {
@@ -896,6 +896,25 @@ inline void lcdDrawBitmapDMA(coord_t x, coord_t y, coord_t width, coord_t height
#endif
#if !defined(BOOT)
void lcdDrawAlphaBitmap(coord_t x, coord_t y, const uint8_t * bmp)
{
int width = getBitmapWidth(bmp);
int height = getBitmapHeight(bmp);
if (width == 0 || height == 0) {
return;
}
for (coord_t line=0; line<height; line++) {
display_t * p = &displayBuf[(y+line)*LCD_W + x];
const uint8_t * q = bmp + 4 + line*width*3;
for (coord_t col=0; col<width; col++) {
lcdDrawAlphaPixel(p, q[2]>>4, *((uint16_t *)q));
p++; q+=3;
}
}
}
void lcdDrawBitmap(coord_t x, coord_t y, const uint8_t * bmp, coord_t offset, coord_t height, int scale)
{
int width = getBitmapWidth(bmp);
@@ -1095,16 +1114,16 @@ void lcdDrawBitmapPatternPie(coord_t x0, coord_t y0, const uint8_t * img, LcdFla
for (int x=w2-1; x>=0; x--) {
int slope = (x==0 ? (y<0 ? -99000 : 99000) : y*100/x);
if (slope >= slopes[0] && slope < slopes[1]) {
lcdDrawTransparentPixel(x0+w2+x, y0+h2-y, q[(h2-y)*width + w2+x], color);
lcdDrawAlphaPixel(x0+w2+x, y0+h2-y, q[(h2-y)*width + w2+x], color);
}
if (-slope >= slopes[0] && -slope < slopes[1]) {
lcdDrawTransparentPixel(x0+w2+x, y0+h2+y, q[(h2+y)*width + w2+x], color);
lcdDrawAlphaPixel(x0+w2+x, y0+h2+y, q[(h2+y)*width + w2+x], color);
}
if (slope >= slopes[2] && slope < slopes[3]) {
lcdDrawTransparentPixel(x0+w2-x, y0+h2-y, q[(h2-y)*width + w2-x], color);
lcdDrawAlphaPixel(x0+w2-x, y0+h2-y, q[(h2-y)*width + w2-x], color);
}
if (-slope >= slopes[2] && -slope < slopes[3]) {
lcdDrawTransparentPixel(x0+w2-x, y0+h2+y, q[(h2+y)*width + w2-x], color);
lcdDrawAlphaPixel(x0+w2-x, y0+h2+y, q[(h2+y)*width + w2-x], color);
}
}
}
+5 -4
View File
@@ -223,16 +223,16 @@ inline void lcdDrawPixel(coord_t x, coord_t y, display_t value)
lcdDrawPixel(p, value);
}
void lcdDrawTransparentPixel(display_t * p, uint8_t opacity, uint16_t color);
void lcdDrawAlphaPixel(display_t * p, uint8_t opacity, uint16_t color);
void lcdDrawPoint(coord_t x, coord_t y, LcdFlags att=0);
void lcdDrawHorizontalLine(coord_t x, coord_t y, coord_t w, uint8_t pat, LcdFlags att=0);
void lcdDrawVerticalLine(coord_t x, scoord_t y, scoord_t h, uint8_t pat, LcdFlags att=0);
void lcdDrawLine(coord_t x1, coord_t y1, coord_t x2, coord_t y2, uint8_t pat=SOLID, LcdFlags att=0);
inline void lcdDrawTransparentPixel(coord_t x, coord_t y, uint8_t opacity, uint16_t color)
inline void lcdDrawAlphaPixel(coord_t x, coord_t y, uint8_t opacity, uint16_t color)
{
display_t * p = PIXEL_PTR(x, y);
lcdDrawTransparentPixel(p, opacity, color);
lcdDrawAlphaPixel(p, opacity, color);
}
#if !defined(SIMU)
@@ -305,6 +305,7 @@ int getBitmapScale(const uint8_t * bmp, int dstWidth, int dstHeight);
int getTextWidth(const pm_char *s, int len=0, LcdFlags flags=0);
void lcdDrawBitmap(coord_t x, coord_t y, const uint8_t * img, coord_t offset=0, coord_t height=0, int scale=0);
void lcdDrawBitmapPattern(coord_t x, coord_t y, const uint8_t * img, LcdFlags flags=0, coord_t offset=0, coord_t width=0);
void lcdDrawAlphaBitmap(coord_t x, coord_t y, const uint8_t * bmp);
#define lcdSetRefVolt(...)
void lcdSetContrast();
@@ -314,7 +315,7 @@ const char * bmpLoad(uint8_t * dest, const char * filename, uint16_t width, uint
const char * imgLoad(uint8_t * dest, const char * filename, uint16_t width, uint16_t height);
void drawSleepBitmap();
void drawShutdownBitmap(uint8_t index);
void drawShutdownBitmap(uint32_t index);
#if defined(BOOT)
#define BLINK_ON_PHASE (0)
+1 -1
View File
@@ -21,7 +21,7 @@
#include "../../opentx.h"
const uint8_t LBM_SPLASH[] __DMA = {
#include "splash.lbm"
#include "bmp_splash.lbm"
};
#if defined(SPLASH)
+21 -6
View File
@@ -324,8 +324,8 @@ int16_t editGVarFieldValue(coord_t x, coord_t y, int16_t value, int16_t min, int
}
#endif
#define SLEEP_BITMAP_WIDTH 110
#define SLEEP_BITMAP_HEIGHT 110
#define SLEEP_BITMAP_WIDTH 150
#define SLEEP_BITMAP_HEIGHT 150
void drawSleepBitmap()
{
lcdClear();
@@ -335,10 +335,25 @@ void drawSleepBitmap()
#define SHUTDOWN_BITMAP_WIDTH 110
#define SHUTDOWN_BITMAP_HEIGHT 110
void drawShutdownBitmap(uint8_t index)
#define SHUTDOWN_CIRCLE_DIAMETER 150
void drawShutdownBitmap(uint32_t index)
{
// lcdClear();
lcdDrawBitmap((LCD_W-SHUTDOWN_BITMAP_WIDTH)/2, (LCD_H-SHUTDOWN_BITMAP_HEIGHT)/2, LBM_SHUTDOWN, index*SHUTDOWN_BITMAP_WIDTH, SHUTDOWN_BITMAP_WIDTH);
lcdDrawBitmapPatternPie((LCD_W-150)/2, (LCD_H-150)/2, LBM_BIGRSCALE, TEXT_COLOR, 0, 360/4*index);
static uint32_t last_index = UINT32_MAX;
if (index < last_index) {
lcdDrawBlackOverlay();
lcdDrawAlphaBitmap((LCD_W-SHUTDOWN_BITMAP_WIDTH)/2, (LCD_H-SHUTDOWN_BITMAP_HEIGHT)/2, LBM_SHUTDOWN);
lcdStoreBackupBuffer();
}
else {
lcdRestoreBackupBuffer();
index /= (PWR_PRESS_SHUTDOWN / 5);
if (index >= 1) lcdDrawBitmapPattern(LCD_W/2, (LCD_H-SHUTDOWN_CIRCLE_DIAMETER)/2, LBM_SHUTDOWN_CIRCLE, TEXT_COLOR, 0, SHUTDOWN_CIRCLE_DIAMETER/2);
if (index >= 2) lcdDrawBitmapPattern(LCD_W/2, LCD_H/2, LBM_SHUTDOWN_CIRCLE, TEXT_COLOR, SHUTDOWN_CIRCLE_DIAMETER/2, SHUTDOWN_CIRCLE_DIAMETER/2);
if (index >= 3) lcdDrawBitmapPattern((LCD_W-SHUTDOWN_CIRCLE_DIAMETER)/2, LCD_H/2, LBM_SHUTDOWN_CIRCLE, TEXT_COLOR, SHUTDOWN_CIRCLE_DIAMETER, SHUTDOWN_CIRCLE_DIAMETER/2);
if (index >= 4) lcdDrawBitmapPattern((LCD_W-SHUTDOWN_CIRCLE_DIAMETER)/2, (LCD_H-SHUTDOWN_CIRCLE_DIAMETER)/2, LBM_SHUTDOWN_CIRCLE, TEXT_COLOR, SHUTDOWN_CIRCLE_DIAMETER*3/2, SHUTDOWN_CIRCLE_DIAMETER/2);
}
lcdRefresh();
last_index = index;
}
+1 -1
View File
@@ -196,7 +196,7 @@ inline void lcdDrawSquare(coord_t x, coord_t y, coord_t w, LcdFlags att=0)
void lcdInvertLine(int8_t line);
#define lcdInvertLastLine() lcdInvertLine(LCD_LINES-1)
void drawShutdownBitmap(uint8_t index);
void drawShutdownBitmap(uint32_t index);
void drawSleepBitmap();
void lcdDrawTelemetryTopBar();
+3 -1
View File
@@ -39,8 +39,10 @@ const pm_uchar bmp_shutdown[] PROGMEM = {
#define SHUTDOWN_BITMAP_WIDTH 60
#define SHUTDOWN_BITMAP_HEIGHT 60
void drawShutdownBitmap(uint8_t index)
void drawShutdownBitmap(uint32_t index)
{
index /= (PWR_PRESS_SHUTDOWN / 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);
lcdRefresh();
+1 -4
View File
@@ -2636,7 +2636,6 @@ int main(void)
#endif // !SIMU
#if defined(PWR_BUTTON_DELAY)
#define PWR_PRESS_SHUTDOWN 300 // 3s
uint32_t pwr_press_time = 0;
@@ -2697,9 +2696,7 @@ uint32_t pwrCheck()
#endif
}
else {
lcdRefreshWait();
unsigned index = pwrPressedDuration() / (PWR_PRESS_SHUTDOWN / 4);
drawShutdownBitmap(index);
drawShutdownBitmap(pwrPressedDuration());
return e_power_press;
}
}
+19 -18
View File
@@ -297,17 +297,17 @@
#define pgm_read_byte(address_short) (*(uint8_t*)(address_short))
#define PSTR(adr) adr
#define PROGMEM
#define pgm_read_adr(x) *(x)
#define pgm_read_adr(x) *(x)
#define cli()
#define sei()
extern void boardInit();
#if defined(PCBTARANIS)
extern void boardOff();
#else
#define boardOff() pwrOff();
#define boardOff() pwrOff();
#endif
#else
#define boardOff() pwrOff();
#define boardOff() pwrOff();
#include <avr/io.h>
#include <avr/pgmspace.h>
#include "pgmtypes.h"
@@ -315,9 +315,9 @@
#include <avr/eeprom.h>
#include <avr/sleep.h>
#include <avr/interrupt.h>
#define F_CPU 16000000UL // 16 MHz
#define F_CPU 16000000UL // 16 MHz
#include <util/delay.h>
#define pgm_read_adr(address_short) pgm_read_word(address_short)
#define pgm_read_adr(address_short) pgm_read_word(address_short)
#include <avr/wdt.h>
#endif
@@ -327,15 +327,15 @@
#define NUM_SWITCHES 5
#elif defined(PCBTARANIS) || defined(PCBHORUS)
#if defined(REV9E)
#define NUM_SWITCHES 18 // yes, it's a lot!
#define NUM_SWITCHES 18 // yes, it's a lot!
#else
#define NUM_SWITCHES 8
#define NUM_SWITCHES 8
#endif
#define SWSRC_THR SWSRC_SF2
#define SWSRC_GEA SWSRC_SG2
#define SWSRC_ID0 SWSRC_SA0
#define SWSRC_ID1 SWSRC_SA1
#define SWSRC_ID2 SWSRC_SA2
#define SWSRC_THR SWSRC_SF2
#define SWSRC_GEA SWSRC_SG2
#define SWSRC_ID0 SWSRC_SA0
#define SWSRC_ID1 SWSRC_SA1
#define SWSRC_ID2 SWSRC_SA2
#else
#define NUM_SWITCHES 7
#define IS_3POS(sw) ((sw) == 0)
@@ -343,23 +343,23 @@
#define SW_DSM2_BIND SW_TRN
#endif
#define NUM_PSWITCH (SWSRC_LAST_SWITCH-SWSRC_FIRST_SWITCH+1)
#define NUM_POTSSW (NUM_XPOTS*6)
#define NUM_PSWITCH (SWSRC_LAST_SWITCH-SWSRC_FIRST_SWITCH+1)
#define NUM_POTSSW (NUM_XPOTS*6)
#include "myeeprom.h"
#if defined(CPUM64)
void memclear(void *ptr, uint8_t size);
#else
#define memclear(p, s) memset(p, 0, s)
#define memclear(p, s) memset(p, 0, s)
#endif
void memswap(void * a, void * b, uint8_t size);
#if defined(PCBHORUS)
#define IS_POT_AVAILABLE(x) (true)
#define IS_POT_MULTIPOS(x) ((x)==POT2)
#define IS_POT_WITHOUT_DETENT(x) (true)
#define IS_POT_AVAILABLE(x) (true)
#define IS_POT_MULTIPOS(x) ((x)==POT2)
#define IS_POT_WITHOUT_DETENT(x) (true)
#elif defined(PCBFLAMENCO)
#define IS_POT_AVAILABLE(x) (true)
#define IS_POT_MULTIPOS(x) (false)
@@ -387,6 +387,7 @@ void memswap(void * a, void * b, uint8_t size);
#if defined(PCBFLAMENCO) || defined(PCBHORUS) || (defined(PCBTARANIS) && defined(REV9E))
#define PWR_BUTTON_DELAY
#define PWR_PRESS_SHUTDOWN 300 // 3s
#endif
#define GET_LOWRES_POT_POSITION(i) (getValue(MIXSRC_FIRST_POT+(i)) >> 4)
+4
View File
@@ -20,6 +20,8 @@
#include "../../opentx.h"
#if 0
uint32_t audioBufferCount = 0;
#if !defined(SIMU)
@@ -142,3 +144,5 @@ extern "C" void DMA1_Stream5_IRQHandler()
}
}
#endif // #if !defined(SIMU)
#endif