* Remove 'static' from bitmapbuffer that where causing issues when changing theme. I have checked that this does not create extra sdcard access

* Cosmetics

* Move calibration bitmaps to theme

* Overlaping PR

* There no theme changing during shutdown

* Cosmetics
This commit is contained in:
3djc
2016-11-18 18:51:11 +01:00
committed by Bertrand Songis
parent d59fdc07c4
commit 6c006c3e2c
6 changed files with 43 additions and 32 deletions
+5
View File
@@ -180,6 +180,11 @@ const uint8_t LBM_SWIPE_RIGHT[] = {
#include "mask_swipe_right.lbm"
};
BitmapBuffer * calibStick = NULL;
BitmapBuffer * calibBackground = NULL;
BitmapBuffer * calibStickBackground = NULL;
BitmapBuffer * calibTrackpBackground = NULL;
BitmapBuffer * calibHorus = NULL;
BitmapBuffer * modelselIconBitmap = NULL;
BitmapBuffer * modelselSdFreeBitmap = NULL;
BitmapBuffer * modelselModelQtyBitmap = NULL;
+7
View File
@@ -78,6 +78,13 @@ extern BitmapBuffer * modelselModelNameBitmap;
extern BitmapBuffer * modelselModelMoveBackground;
extern BitmapBuffer * modelselModelMoveIcon;
// calibration bitmaps
extern BitmapBuffer * calibStick;
extern BitmapBuffer * calibBackground;
extern BitmapBuffer * calibStickBackground;
extern BitmapBuffer * calibTrackpBackground;
extern BitmapBuffer * calibHorus;
// Channels monitor bitmaps
extern BitmapBuffer * chanMonLockedBitmap;
extern BitmapBuffer * chanMonInvertedBitmap;
+1 -1
View File
@@ -384,7 +384,7 @@ void displayMixStatus(uint8_t channel)
bool menuModelMixAll(event_t event)
{
static const BitmapBuffer * mpx_mode[] = {
const BitmapBuffer * mpx_mode[] = {
mixerSetupAddBitmap,
mixerSetupMultiBitmap,
mixerSetupReplaceBitmap
+8 -11
View File
@@ -39,23 +39,21 @@ enum CalibrationState {
void drawStick(coord_t x, coord_t y, const BitmapBuffer * background, int16_t xval, int16_t yval)
{
static const BitmapBuffer * stick = BitmapBuffer::load(getThemePath("stick_pointer.png"));
lcd->drawBitmap(x, y, background);
lcd->drawBitmap(x + 2 + STICK_PANEL_WIDTH/2 + STICK_PANEL_WIDTH/2 * xval/RESX, y + 2 + STICK_PANEL_WIDTH/2 - STICK_PANEL_WIDTH/2 * yval/RESX, stick);
lcd->drawBitmap(x, y, calibStickBackground);
lcd->drawBitmap(x + 2 + STICK_PANEL_WIDTH/2 + STICK_PANEL_WIDTH/2 * xval/RESX, y + 2 + STICK_PANEL_WIDTH/2 - STICK_PANEL_WIDTH/2 * yval/RESX, calibStick);
}
void drawSticks()
{
static const BitmapBuffer * background = BitmapBuffer::load(getThemePath("stick_background.png"));
int16_t calibStickVert = calibratedStick[CONVERT_MODE(1)];
if (g_model.throttleReversed && CONVERT_MODE(1) == THR_STICK)
calibStickVert = -calibStickVert;
drawStick(STICK_LEFT_X, STICKS_Y, background, calibratedStick[CONVERT_MODE(0)], calibStickVert);
drawStick(STICK_LEFT_X, STICKS_Y, calibStickBackground, calibratedStick[CONVERT_MODE(0)], calibStickVert);
calibStickVert = calibratedStick[CONVERT_MODE(2)];
if (g_model.throttleReversed && CONVERT_MODE(2) == THR_STICK)
calibStickVert = -calibStickVert;
drawStick(STICK_RIGHT_X, STICKS_Y, background, calibratedStick[CONVERT_MODE(3)], calibStickVert);
drawStick(STICK_RIGHT_X, STICKS_Y, calibStickBackground, calibratedStick[CONVERT_MODE(3)], calibStickVert);
}
void drawPots()
@@ -73,8 +71,7 @@ void drawPots()
void drawMouse()
{
static const BitmapBuffer * background = BitmapBuffer::load(getThemePath("trackp_background.png"));
drawStick(STICK_LEFT_X, STICKS_Y+100, background, calibratedStick[11], calibratedStick[12]);
drawStick(STICK_LEFT_X, STICKS_Y+100, calibTrackpBackground, calibratedStick[11], calibratedStick[12]);
}
bool menuCommonCalib(event_t event)
@@ -209,9 +206,9 @@ bool menuCommonCalib(event_t event)
break;
}
static const BitmapBuffer * horus = BitmapBuffer::load(getThemePath("horus.bmp"));
if (horus) {
lcd->drawBitmap((LCD_W-horus->getWidth())/2, LCD_H-20-horus->getHeight(), horus);
if (calibHorus) {
lcd->drawBitmap((LCD_W-calibHorus->getWidth())/2, LCD_H-20-calibHorus->getHeight(), calibHorus);
}
drawSticks();
+9 -20
View File
@@ -120,29 +120,18 @@ class DarkblueTheme: public Theme
void loadThemeBitmaps() const
{
// Model Selection screen
delete modelselIconBitmap;
modelselIconBitmap = BitmapBuffer::loadMaskOnBackground("modelsel/mask_iconback.png", TEXT_BGCOLOR, TITLE_BGCOLOR);
if (modelselIconBitmap) {
BitmapBuffer * bitmap = BitmapBuffer::load(getThemePath("modelsel/icon_default.png"));
modelselIconBitmap->drawBitmap(25, 8, bitmap);
delete bitmap;
}
// Calibration screen
delete calibStick;
calibStick = BitmapBuffer::load(getThemePath("stick_pointer.png"));
delete modelselSdFreeBitmap;
modelselSdFreeBitmap = BitmapBuffer::loadMaskOnBackground("modelsel/mask_sdfree.png", TEXT_COLOR, TEXT_BGCOLOR);
delete calibStickBackground;
calibStickBackground = BitmapBuffer::load(getThemePath("stick_background.png"));
delete modelselModelQtyBitmap;
modelselModelQtyBitmap = BitmapBuffer::loadMaskOnBackground("modelsel/mask_modelqty.png", TEXT_COLOR, TEXT_BGCOLOR);
delete calibTrackpBackground;
calibTrackpBackground = BitmapBuffer::load(getThemePath("trackp_background.png"));
delete modelselModelNameBitmap;
modelselModelNameBitmap = BitmapBuffer::loadMaskOnBackground("modelsel/mask_modelname.png", TEXT_COLOR, TEXT_BGCOLOR);
delete modelselModelMoveBackground;
modelselModelMoveBackground = BitmapBuffer::loadMask(getThemePath("modelsel/mask_moveback.png"));
delete modelselModelMoveIcon;
modelselModelMoveIcon = BitmapBuffer::loadMask(getThemePath("modelsel/mask_moveico.png"));
delete calibHorus;
calibHorus = BitmapBuffer::load(getThemePath("horus.bmp"));
// Channels monitor screen
delete chanMonLockedBitmap;
+13
View File
@@ -154,6 +154,19 @@ class DefaultTheme: public Theme
void loadThemeBitmaps() const
{
// Calibration screen
delete calibStick;
calibStick = BitmapBuffer::load(getThemePath("stick_pointer.png"));
delete calibStickBackground;
calibStickBackground = BitmapBuffer::load(getThemePath("stick_background.png"));
delete calibTrackpBackground;
calibTrackpBackground = BitmapBuffer::load(getThemePath("trackp_background.png"));
delete calibHorus;
calibHorus = BitmapBuffer::load(getThemePath("horus.bmp"));
// Model Selection screen
delete modelselIconBitmap;
modelselIconBitmap = BitmapBuffer::loadMaskOnBackground("modelsel/mask_iconback.png", TITLE_BGCOLOR, TEXT_BGCOLOR);