diff --git a/radio/src/gui/horus/bitmapbuffer.cpp b/radio/src/gui/horus/bitmapbuffer.cpp index 86b05960c..41f693933 100644 --- a/radio/src/gui/horus/bitmapbuffer.cpp +++ b/radio/src/gui/horus/bitmapbuffer.cpp @@ -267,33 +267,40 @@ void BitmapBuffer::drawBitmapPattern(coord_t x, coord_t y, const uint8_t * bmp, display_t color = lcdColorTable[COLOR_IDX(flags)]; for (coord_t row=0; row 0) drawBitmapPattern(x, y, font, flags, offset, width); - lcdNextPos = x + width; + return width; } -void BitmapBuffer::drawCharWithCache(coord_t x, coord_t y, const BitmapBuffer * font, const uint16_t * spec, int index, LcdFlags flags) +uint8_t BitmapBuffer::drawCharWithCache(coord_t x, coord_t y, const BitmapBuffer * font, const uint16_t * spec, int index, LcdFlags flags) { coord_t offset = spec[index]; coord_t width = spec[index+1] - offset; drawBitmap(x, y, font, offset, 0, width); - lcdNextPos = x + width; + return width; } void BitmapBuffer::drawSizedText(coord_t x, coord_t y, const char * s, uint8_t len, LcdFlags flags) { +#define INCREMENT_POS(delta) \ + do { if (flags & VERTICAL) y -= delta; else x += delta; } while(0) + int width = getTextWidth(s, len, flags); int height = getFontHeight(flags); int fontindex = FONTSIZE(flags) >> 8; @@ -302,9 +309,11 @@ void BitmapBuffer::drawSizedText(coord_t x, coord_t y, const char * s, uint8_t l BitmapBuffer * fontcache = NULL; if (flags & RIGHT) - x -= width; + INCREMENT_POS(-width); else if (flags & CENTERED) - x -= width/2; + INCREMENT_POS(-width/2); + + coord_t & pos = (flags & VERTICAL) ? y : x; if ((flags&INVERS) && ((~flags & BLINK) || BLINK_ON_PHASE)) { flags = TEXT_INVERTED_COLOR | (flags & 0x0ffff); @@ -339,19 +348,14 @@ void BitmapBuffer::drawSizedText(coord_t x, coord_t y, const char * s, uint8_t l } } - const coord_t orig_x = x; - bool setx = false; + const coord_t orig_pos = pos; while (len--) { unsigned char c; if (flags & ZCHAR) c = idx2char(*s); else c = pgm_read_byte(s); - if (setx) { - x = c; - setx = false; - } - else if (!c) { + if (!c) { break; } else if (c >= 0x20) { @@ -359,31 +363,34 @@ void BitmapBuffer::drawSizedText(coord_t x, coord_t y, const char * s, uint8_t l if (c >= 0x80 && c <= 0x85) { c = 0x20 + 115 + c - 0x80; } +#elif defined(TRANSLATIONS_DE) + if (c >= 0x80 && c <= 0x86) { + c = 0x20 + 121 + c - 0x80; + } #endif - if (fontcache) { - drawCharWithCache(x, y, fontcache, fontspecs, getMappedChar(c), flags); - } - else { - drawCharWithoutCache(x, y, font, fontspecs, getMappedChar(c), flags); - } - x = lcdNextPos; - } - else if (c == 0x1F) { // X-coord prefix - setx = true; + uint8_t width; + if (fontcache) + width = drawCharWithCache(x, y, fontcache, fontspecs, getMappedChar(c), flags); + else + width = drawCharWithoutCache(x, y, font, fontspecs, getMappedChar(c), flags); + INCREMENT_POS(width); } else if (c == 0x1E) { - x = orig_x; - y += height; + pos = orig_pos; + if (flags & VERTICAL) + x += height; + else + y += height; } else if (c == 1) { - x += 1; + INCREMENT_POS(1); } else { - x += 2*(c-1); + INCREMENT_POS(2*(c-1)); } s++; } - lcdNextPos = x; + lcdNextPos = pos; } void BitmapBuffer::drawBitmapPie(int x0, int y0, const uint16_t * img, int startAngle, int endAngle) diff --git a/radio/src/gui/horus/bitmapbuffer.h b/radio/src/gui/horus/bitmapbuffer.h index 2d56de2e8..6a6640195 100644 --- a/radio/src/gui/horus/bitmapbuffer.h +++ b/radio/src/gui/horus/bitmapbuffer.h @@ -180,9 +180,9 @@ class BitmapBuffer: public BitmapBufferBase void drawBitmapPattern(coord_t x, coord_t y, const uint8_t * bmp, LcdFlags flags, coord_t offset=0, coord_t width=0); - void drawCharWithoutCache(coord_t x, coord_t y, const uint8_t * font, const uint16_t * spec, int index, LcdFlags flags); + uint8_t drawCharWithoutCache(coord_t x, coord_t y, const uint8_t * font, const uint16_t * spec, int index, LcdFlags flags); - void drawCharWithCache(coord_t x, coord_t y, const BitmapBuffer * font, const uint16_t * spec, int index, LcdFlags flags); + uint8_t drawCharWithCache(coord_t x, coord_t y, const BitmapBuffer * font, const uint16_t * spec, int index, LcdFlags flags); void drawText(coord_t x, coord_t y, const char * s, LcdFlags flags) { diff --git a/radio/src/gui/horus/bitmaps.cpp b/radio/src/gui/horus/bitmaps.cpp index aaabdbba2..8b2fcb18f 100644 --- a/radio/src/gui/horus/bitmaps.cpp +++ b/radio/src/gui/horus/bitmaps.cpp @@ -24,10 +24,6 @@ * Header bitmaps */ -const uint8_t LBM_TOPMENU_POLYGON[] = { -#include "mask_topmenu_polygon.lbm" -}; - const uint8_t LBM_DOT[] = { #include "mask_dot.lbm" }; diff --git a/radio/src/gui/horus/bitmaps.h b/radio/src/gui/horus/bitmaps.h index 2b735c9f8..78180ca4e 100644 --- a/radio/src/gui/horus/bitmaps.h +++ b/radio/src/gui/horus/bitmaps.h @@ -22,7 +22,6 @@ #define _BITMAPS_H_ // Header bitmaps -extern const uint8_t LBM_TOPMENU_POLYGON[]; extern const uint8_t LBM_DOT[]; // Main view icons diff --git a/radio/src/gui/horus/view_main.cpp b/radio/src/gui/horus/view_main.cpp index d55d183ca..61c2c7e0a 100644 --- a/radio/src/gui/horus/view_main.cpp +++ b/radio/src/gui/horus/view_main.cpp @@ -65,14 +65,21 @@ void drawTrims(uint8_t flightMode) if (vert[i]) { drawVerticalSlider(xm, TRIM_V_Y, 160, trim, -125, 125, 0, OPTION_SLIDER_EMPTY_BAR|OPTION_SLIDER_TRIM_BUTTON); + if (g_model.displayTrims != DISPLAY_TRIMS_NEVER && trim != 0) { + if (g_model.displayTrims == DISPLAY_TRIMS_ALWAYS || (trimsDisplayTimer > 0 && (trimsDisplayMask & (1< 0 && (trimsDisplayMask & (1<0 ? -20 : 50), ym+1, trim, TINSIZE); + uint16_t x = xm + TRIM_LEN + (trim>0 ? -TRIM_LEN/2 : TRIM_LEN/2); + lcdDrawNumber(x, TRIM_H_Y+2, trim, TINSIZE | CENTERED); } - }*/ + } } } } diff --git a/radio/src/gui/taranis/lcd.cpp b/radio/src/gui/taranis/lcd.cpp index fd433ea73..26f64ef84 100644 --- a/radio/src/gui/taranis/lcd.cpp +++ b/radio/src/gui/taranis/lcd.cpp @@ -18,8 +18,8 @@ * GNU General Public License for more details. */ -#include "../../opentx.h" -#include "../../timers.h" +#include "opentx.h" +#include "timers.h" #if defined(REVPLUS) && defined(LCD_DUAL_BUFFER) display_t displayBuf1[DISPLAY_BUFFER_SIZE] __DMA; diff --git a/radio/src/storage/sdcard_raw.cpp b/radio/src/storage/sdcard_raw.cpp index ea670546f..d76ffdabc 100644 --- a/radio/src/storage/sdcard_raw.cpp +++ b/radio/src/storage/sdcard_raw.cpp @@ -234,6 +234,11 @@ void storageEraseAll(bool warn) { TRACE("storageEraseAll()"); +#if defined(COLORLCD) + // the theme has not been loaded before + theme->load(); +#endif + generalDefault(); modelDefault(1);