Now uses the external libopenui

This commit is contained in:
Bertrand Songis
2019-10-02 14:41:52 +02:00
parent 5b568cd40c
commit 3e2cb83991
250 changed files with 76326 additions and 11869 deletions
+1 -1
View File
@@ -166,7 +166,7 @@ add_definitions(-g)
add_definitions(-DCPUARM)
add_definitions(-DGPS)
add_definitions(-DBOLD_FONT -DBATTGRAPH -DTHRTRACE)
add_definitions(-DBATTGRAPH -DTHRTRACE)
add_definitions(-DREQUIRED_SDCARD_VERSION="${SDCARD_VERSION}")
include_directories(${COOS_DIR} ${COOS_DIR}/kernel ${COOS_DIR}/portable)
@@ -50,7 +50,7 @@ endif()
set(BOOTLOADER_SRC
${BOOTLOADER_SRC}
../../../../../gui/${GUI_DIR}/lcd.cpp
../../../../../gui/${GUI_DIR}/fonts.cpp
../../../../../gui/common/stdlcd/fonts.cpp
../../../../../keys.cpp
../../../../../strhelpers.cpp
../../../../../stamp.cpp
@@ -102,11 +102,10 @@ endif()
if(PCB STREQUAL X10 OR PCB STREQUAL X12S OR PCB STREQUAL NV14)
set(BOOTLOADER_SRC
${BOOTLOADER_SRC}
../../../../../gui/libopenui/bitmapbuffer.cpp
../../../../../thirdparty/libopenui/src/bitmapbuffer.cpp
../../../../../targets/${TARGET_DIR}/sdram_driver.c
../../../../../targets/common/arm/stm32/sdio_sd.c
../../../../../targets/${TARGET_DIR}/haptic_driver.cpp
../../../../../gui/${GUI_DIR}/rle.cpp
../../../../../syscalls.c
)
@@ -54,13 +54,13 @@ void bootloaderInitScreen()
static void bootloaderDrawTitle(unsigned int x, const char* text)
{
lcdDrawText(x, 28, text);
lcdDrawSolidFilledRect(28, 56, 422, 2, TEXT_COLOR);
lcd->drawText(x, 28, text);
lcd->drawSolidFilledRect(28, 56, 422, 2, TEXT_COLOR);
}
static void bootloaderDrawFooter()
{
lcdDrawSolidFilledRect(28, 234, 422, 2, TEXT_COLOR);
lcd->drawSolidFilledRect(28, 234, 422, 2, TEXT_COLOR);
}
void bootloaderDrawScreen(BootloaderState st, int opt, const char* str)
@@ -74,32 +74,32 @@ void bootloaderDrawScreen(BootloaderState st, int opt, const char* str)
if (st == ST_START) {
bootloaderDrawTitle(88, "HORUS BOOTLOADER");
lcdDrawBitmapPattern(90, 72, LBM_FLASH, TEXT_COLOR);
lcdDrawText(124, 75, "Write Firmware");
lcd->drawBitmapPattern(90, 72, LBM_FLASH, TEXT_COLOR);
lcd->drawText(124, 75, "Write Firmware");
lcdDrawBitmapPattern(90, 107, LBM_EXIT, TEXT_COLOR);
lcdDrawText(124, 110, "Exit");
lcd->drawBitmapPattern(90, 107, LBM_EXIT, TEXT_COLOR);
lcd->drawText(124, 110, "Exit");
lcdDrawSolidRect(119, (opt == 0) ? 72 : 107, 270, 26, 2, LINE_COLOR);
lcd->drawSolidRect(119, (opt == 0) ? 72 : 107, 270, 26, 2, LINE_COLOR);
lcd->drawBitmap(60, 166, &BMP_PLUG_USB);
lcdDrawText(195, 175, "Or plug in a USB cable");
lcdDrawText(195, 200, "for mass storage");
lcd->drawText(195, 175, "Or plug in a USB cable");
lcd->drawText(195, 200, "for mass storage");
bootloaderDrawFooter();
lcdDrawText( 36, 242, "Current Firmware:");
lcdDrawText(200, 242, getOtherVersion(nullptr));
lcd->drawText( 36, 242, "Current Firmware:");
lcd->drawText(200, 242, getOtherVersion(nullptr));
}
else if (st == ST_USB) {
lcd->drawBitmap(136, 98, &BMP_USB_PLUGGED);
lcdDrawText(195, 128, "USB Connected");
lcd->drawText(195, 128, "USB Connected");
}
else if (st == ST_FILE_LIST || st == ST_DIR_CHECK || st == ST_FLASH_CHECK ||
st == ST_FLASHING || st == ST_FLASH_DONE) {
bootloaderDrawTitle(126, "SD>FIRMWARE");
lcdDrawBitmapPattern(87, 16, LBM_SD, TEXT_COLOR);
lcd->drawBitmapPattern(87, 16, LBM_SD, TEXT_COLOR);
if (st == ST_FLASHING || st == ST_FLASH_DONE) {
@@ -110,39 +110,39 @@ void bootloaderDrawScreen(BootloaderState st, int opt, const char* str)
opt = 100; // Completed > 100%
}
lcdDrawRect(70, 120, 340, 31, 2);
lcdDrawSolidFilledRect(74, 124, (332 * opt) / 100, 23, color);
lcd->drawRect(70, 120, 340, 31, 2);
lcd->drawSolidFilledRect(74, 124, (332 * opt) / 100, 23, color);
}
else if (st == ST_DIR_CHECK) {
if (opt == FR_NO_PATH) {
lcdDrawText(90, 168, "Directory is missing");
lcd->drawText(90, 168, "Directory is missing");
}
else {
lcdDrawText(90, 168, "Directory is empty");
lcd->drawText(90, 168, "Directory is empty");
}
lcdDrawBitmapPattern(356, 158, LBM_ERROR, BARGRAPH1_COLOR);
lcd->drawBitmapPattern(356, 158, LBM_ERROR, BARGRAPH1_COLOR);
}
else if (st == ST_FLASH_CHECK) {
bootloaderDrawFilename(str, 0, true);
if (opt == FC_ERROR) {
lcdDrawText(94, 168, STR_INVALID_FIRMWARE);
lcdDrawBitmapPattern(356, 158, LBM_ERROR, BARGRAPH1_COLOR);
lcd->drawText(94, 168, STR_INVALID_FIRMWARE);
lcd->drawBitmapPattern(356, 158, LBM_ERROR, BARGRAPH1_COLOR);
}
else if (opt == FC_OK) {
VersionTag tag;
extractFirmwareVersion(&tag);
lcdDrawText(168, 158, "Version:", RIGHT);
lcdDrawText(174, 158, tag.version);
lcd->drawText(168, 158, "Version:", RIGHT);
lcd->drawText(174, 158, tag.version);
lcdDrawText(168, 178, "Radio:", RIGHT);
lcdDrawText(174, 178, tag.flavour);
lcd->drawText(168, 178, "Radio:", RIGHT);
lcd->drawText(174, 178, tag.flavour);
lcdDrawBitmapPattern(356, 158, LBM_OK, BARGRAPH2_COLOR);
lcd->drawBitmapPattern(356, 158, LBM_OK, BARGRAPH2_COLOR);
}
}
@@ -150,35 +150,35 @@ void bootloaderDrawScreen(BootloaderState st, int opt, const char* str)
if ( st != ST_DIR_CHECK && (st != ST_FLASH_CHECK || opt == FC_OK)) {
lcdDrawBitmapPattern(28, 242, LBM_FLASH, TEXT_COLOR);
lcd->drawBitmapPattern(28, 242, LBM_FLASH, TEXT_COLOR);
if (st == ST_FILE_LIST) {
lcdDrawText(56, 244, "[ENT] to select file");
lcd->drawText(56, 244, "[ENT] to select file");
}
else if (st == ST_FLASH_CHECK && opt == FC_OK) {
lcdDrawText(56, 244, "Hold [ENT] long to flash");
lcd->drawText(56, 244, "Hold [ENT] long to flash");
}
else if (st == ST_FLASHING) {
lcdDrawText(56, 244, "Writing Firmware ...");
lcd->drawText(56, 244, "Writing Firmware ...");
}
else if (st == ST_FLASH_DONE) {
lcdDrawText(56, 244, "Writing Completed");
lcd->drawText(56, 244, "Writing Completed");
}
}
if (st != ST_FLASHING) {
lcdDrawBitmapPattern(305, 242, LBM_EXIT, TEXT_COLOR);
lcdDrawText(335, 244, "[RTN] to exit");
lcd->drawBitmapPattern(305, 242, LBM_EXIT, TEXT_COLOR);
lcd->drawText(335, 244, "[RTN] to exit");
}
}
}
void bootloaderDrawFilename(const char* str, uint8_t line, bool selected)
{
lcdDrawBitmapPattern(94, 76 + (line * 25), LBM_FILE, TEXT_COLOR);
lcdDrawText(124, 75 + (line * 25), str);
lcd->drawBitmapPattern(94, 76 + (line * 25), LBM_FILE, TEXT_COLOR);
lcd->drawText(124, 75 + (line * 25), str);
if (selected) {
lcdDrawSolidRect(119, 72 + (line * 25), 278, 26, 2, LINE_COLOR);
lcd->drawSolidRect(119, 72 + (line * 25), 278, 26, 2, LINE_COLOR);
}
}
+3 -3
View File
@@ -32,9 +32,9 @@
#define LCD_FIRST_LAYER 0
#define LCD_SECOND_LAYER 1
uint8_t LCD_FIRST_FRAME_BUFFER[DISPLAY_BUFFER_SIZE * sizeof(display_t)] __SDRAM;
uint8_t LCD_SECOND_FRAME_BUFFER[DISPLAY_BUFFER_SIZE * sizeof(display_t)] __SDRAM;
uint8_t LCD_BACKUP_FRAME_BUFFER[DISPLAY_BUFFER_SIZE * sizeof(display_t)] __SDRAM;
uint8_t LCD_FIRST_FRAME_BUFFER[DISPLAY_BUFFER_SIZE * sizeof(pixel_t)] __SDRAM;
uint8_t LCD_SECOND_FRAME_BUFFER[DISPLAY_BUFFER_SIZE * sizeof(pixel_t)] __SDRAM;
uint8_t LCD_BACKUP_FRAME_BUFFER[DISPLAY_BUFFER_SIZE * sizeof(pixel_t)] __SDRAM;
uint8_t currentLayer = LCD_FIRST_LAYER;
BitmapBuffer lcdBuffer1(BMP_RGB565, LCD_W, LCD_H, (uint16_t *)LCD_FIRST_FRAME_BUFFER);
+63 -4
View File
@@ -21,7 +21,13 @@
#ifndef _LIBOPENUI_CONFIG_H_
#define _LIBOPENUI_CONFIG_H_
#include "lcd.h"
#include "debug.h"
#include "libopenui_types.h"
#include "colors.h"
#include "board.h"
#include "keys.h"
typedef uint16_t pixel_t;
constexpr uint32_t MENU_HEADER_BUTTON_WIDTH = 33;
constexpr uint32_t MENU_HEADER_BUTTONS_LEFT = 47;
@@ -63,12 +69,65 @@ constexpr uint32_t CURVE_COORD_WIDTH = 36;
constexpr uint32_t CURVE_COORD_HEIGHT = 17;
constexpr uint32_t DATETIME_SEPARATOR_X = LCD_W - 53;
constexpr uint32_t DATETIME_LINE1 = 9;
constexpr uint32_t DATETIME_LINE2 = 23;
constexpr uint32_t DATETIME_MIDDLE = (LCD_W + DATETIME_SEPARATOR_X + 4) / 2;
constexpr uint32_t DATETIME_LINE1 = 7;
constexpr uint32_t DATETIME_LINE2 = 22;
constexpr uint32_t DATETIME_MIDDLE = (LCD_W + DATETIME_SEPARATOR_X + 1) / 2;
constexpr uint32_t MENUS_TOOLBAR_BUTTON_WIDTH = 30;
constexpr uint32_t MENUS_TOOLBAR_BUTTON_PADDING = 3;
constexpr rect_t MENUS_TOOLBAR_RECT = { 100, 51, 30, 209 };
constexpr uint32_t ALERT_FRAME_TOP = 70;
constexpr uint32_t ALERT_FRAME_HEIGHT = (LCD_H - 2 * ALERT_FRAME_TOP);
constexpr uint32_t ALERT_BITMAP_TOP = ALERT_FRAME_TOP + 15;
constexpr uint32_t ALERT_BITMAP_LEFT = 40;
constexpr uint32_t ALERT_TITLE_TOP = ALERT_FRAME_TOP + 10;
constexpr uint32_t ALERT_TITLE_LEFT = 186;
constexpr uint32_t ALERT_TITLE_LINE_HEIGHT = 30;
constexpr uint32_t ALERT_MESSAGE_TOP = ALERT_TITLE_TOP + 90;
constexpr uint32_t ALERT_MESSAGE_LEFT = ALERT_TITLE_LEFT;
constexpr uint32_t ALERT_ACTION_TOP = 240;
// TODO common code, not in target
enum LcdColorIndex
{
TEXT_COLOR_INDEX,
TEXT_BGCOLOR_INDEX,
TEXT_INVERTED_COLOR_INDEX,
TEXT_INVERTED_BGCOLOR_INDEX,
TEXT_STATUSBAR_COLOR_INDEX,
LINE_COLOR_INDEX,
SCROLLBOX_COLOR_INDEX,
MENU_TITLE_BGCOLOR_INDEX,
MENU_TITLE_COLOR_INDEX,
MENU_TITLE_DISABLE_COLOR_INDEX,
HEADER_COLOR_INDEX,
ALARM_COLOR_INDEX,
WARNING_COLOR_INDEX,
TEXT_DISABLE_COLOR_INDEX,
CURVE_AXIS_COLOR_INDEX,
CURVE_COLOR_INDEX,
CURVE_CURSOR_COLOR_INDEX,
HEADER_BGCOLOR_INDEX,
HEADER_ICON_BGCOLOR_INDEX,
HEADER_CURRENT_BGCOLOR_INDEX,
TITLE_BGCOLOR_INDEX,
TRIM_BGCOLOR_INDEX,
TRIM_SHADOW_COLOR_INDEX,
MAINVIEW_PANES_COLOR_INDEX,
MAINVIEW_GRAPHICS_COLOR_INDEX,
OVERLAY_COLOR_INDEX,
CUSTOM_COLOR_INDEX,
BARGRAPH1_COLOR_INDEX,
BARGRAPH2_COLOR_INDEX,
BARGRAPH_BGCOLOR_INDEX,
LCD_COLOR_COUNT
};
#if !defined(BOOT)
#define FONT_TABLE_SIZE 16
#else
#define FONT_TABLE_SIZE 1
#endif
#endif // _LIBOPENUI_CONFIG_H_
+3 -3
View File
@@ -22,9 +22,9 @@
uint8_t LCD_FIRST_FRAME_BUFFER[DISPLAY_BUFFER_SIZE * sizeof(display_t)] __SDRAM;
uint8_t LCD_SECOND_FRAME_BUFFER[DISPLAY_BUFFER_SIZE * sizeof(display_t)] __SDRAM;
uint8_t LCD_BACKUP_FRAME_BUFFER[DISPLAY_BUFFER_SIZE * sizeof(display_t)] __SDRAM;
uint8_t LCD_FIRST_FRAME_BUFFER[DISPLAY_BUFFER_SIZE * sizeof(pixel_t)] __SDRAM;
uint8_t LCD_SECOND_FRAME_BUFFER[DISPLAY_BUFFER_SIZE * sizeof(pixel_t)] __SDRAM;
uint8_t LCD_BACKUP_FRAME_BUFFER[DISPLAY_BUFFER_SIZE * sizeof(pixel_t)] __SDRAM;
uint8_t currentLayer = LCD_FIRST_LAYER;
lcdSpiInitFucPtr lcdSpiInitFuc;
+61 -2
View File
@@ -21,7 +21,13 @@
#ifndef _LIBOPENUI_CONFIG_H_
#define _LIBOPENUI_CONFIG_H_
#include "lcd.h"
#include "debug.h"
#include "libopenui_types.h"
#include "colors.h"
#include "board.h"
#include "keys.h"
typedef uint16_t pixel_t;
constexpr uint32_t MENU_HEADER_BUTTON_WIDTH = 60;
constexpr uint32_t MENU_HEADER_BUTTONS_LEFT = MENU_HEADER_BUTTON_WIDTH;
@@ -67,6 +73,59 @@ constexpr uint32_t MENUS_TOOLBAR_BUTTON_WIDTH = 50;
constexpr uint32_t MENUS_TOOLBAR_BUTTON_PADDING = 11;
constexpr rect_t MENUS_TOOLBAR_RECT = { 35, 95, 50, 370 };
constexpr uint32_t SUBMENU_LINE_WIDTH = 230;
//constexpr uint32_t SUBMENU_LINE_WIDTH = 230;
constexpr uint32_t ALERT_FRAME_TOP = 70;
constexpr uint32_t ALERT_FRAME_HEIGHT = (LCD_H - 2 * ALERT_FRAME_TOP);
constexpr uint32_t ALERT_BITMAP_TOP = ALERT_FRAME_TOP + 15;
constexpr uint32_t ALERT_BITMAP_LEFT = 40;
constexpr uint32_t ALERT_TITLE_TOP = ALERT_FRAME_TOP + 10;
constexpr uint32_t ALERT_TITLE_LEFT = 186;
constexpr uint32_t ALERT_TITLE_LINE_HEIGHT = 30;
constexpr uint32_t ALERT_MESSAGE_TOP = ALERT_TITLE_TOP + 90;
constexpr uint32_t ALERT_MESSAGE_LEFT = ALERT_TITLE_LEFT;
constexpr uint32_t ALERT_ACTION_TOP = 240;
constexpr uint32_t ALERT_BUTTON_TOP = 300;
enum LcdColorIndex
{
TEXT_COLOR_INDEX,
TEXT_BGCOLOR_INDEX,
TEXT_INVERTED_COLOR_INDEX,
TEXT_INVERTED_BGCOLOR_INDEX,
TEXT_STATUSBAR_COLOR_INDEX,
LINE_COLOR_INDEX,
SCROLLBOX_COLOR_INDEX,
MENU_TITLE_BGCOLOR_INDEX,
MENU_TITLE_COLOR_INDEX,
MENU_TITLE_DISABLE_COLOR_INDEX,
HEADER_COLOR_INDEX,
ALARM_COLOR_INDEX,
WARNING_COLOR_INDEX,
TEXT_DISABLE_COLOR_INDEX,
CURVE_AXIS_COLOR_INDEX,
CURVE_COLOR_INDEX,
CURVE_CURSOR_COLOR_INDEX,
HEADER_BGCOLOR_INDEX,
HEADER_ICON_BGCOLOR_INDEX,
HEADER_CURRENT_BGCOLOR_INDEX,
TITLE_BGCOLOR_INDEX,
TRIM_BGCOLOR_INDEX,
TRIM_SHADOW_COLOR_INDEX,
MAINVIEW_PANES_COLOR_INDEX,
MAINVIEW_GRAPHICS_COLOR_INDEX,
OVERLAY_COLOR_INDEX,
CUSTOM_COLOR_INDEX,
BARGRAPH1_COLOR_INDEX,
BARGRAPH2_COLOR_INDEX,
BARGRAPH_BGCOLOR_INDEX,
LCD_COLOR_COUNT
};
#if !defined(BOOT)
#define FONT_TABLE_SIZE 16
#else
#define FONT_TABLE_SIZE 1
#endif
#endif // _LIBOPENUI_CONFIG_H_
+4 -4
View File
@@ -405,7 +405,7 @@ void StopAudioThread()
#endif // #if defined(SIMU_AUDIO)
bool simuLcdRefresh = true;
display_t simuLcdBuf[DISPLAY_BUFFER_SIZE];
pixel_t simuLcdBuf[DISPLAY_BUFFER_SIZE];
#if !defined(COLORLCD)
void lcdSetRefVolt(uint8_t val)
@@ -423,8 +423,8 @@ void lcdRefresh()
{
static bool lightEnabled = (bool)isBacklightEnabled();
if (bool(isBacklightEnabled()) != lightEnabled || memcmp(simuLcdBuf, displayBuf, DISPLAY_BUFFER_SIZE * sizeof(display_t))) {
memcpy(simuLcdBuf, displayBuf, DISPLAY_BUFFER_SIZE * sizeof(display_t));
if (bool(isBacklightEnabled()) != lightEnabled || memcmp(simuLcdBuf, displayBuf, DISPLAY_BUFFER_SIZE * sizeof(pixel_t))) {
memcpy(simuLcdBuf, displayBuf, DISPLAY_BUFFER_SIZE * sizeof(pixel_t));
lightEnabled = (bool)isBacklightEnabled();
simuLcdRefresh = true;
}
@@ -450,7 +450,7 @@ void boardInit()
{
}
display_t simuLcdBackupBuf[DISPLAY_BUFFER_SIZE];
pixel_t simuLcdBackupBuf[DISPLAY_BUFFER_SIZE];
void lcdStoreBackupBuffer()
{
memcpy(simuLcdBackupBuf, displayBuf, sizeof(simuLcdBackupBuf));
+1 -1
View File
@@ -25,6 +25,6 @@
extern int g_snapshot_idx;
extern bool simuLcdRefresh;
extern display_t simuLcdBuf[DISPLAY_BUFFER_SIZE];
extern pixel_t simuLcdBuf[DISPLAY_BUFFER_SIZE];
#endif // _SIMULCD_H_