Remove legacy fonts and make the bootloader compile with LVGL
This commit is contained in:
committed by
Raphael Coeffic
parent
0404919667
commit
ee0c37157d
@@ -38,6 +38,15 @@ if(SIMU_LUA_COMPILER)
|
||||
add_definitions(-DLUA_COMPILER)
|
||||
endif()
|
||||
|
||||
if(SIMU_BOOTLOADER)
|
||||
add_definitions(-DSIMU_BOOTLOADER)
|
||||
set(SIMU_SRC ${SIMU_SRC}
|
||||
../../targets/common/arm/stm32/bootloader/bin_files.cpp
|
||||
../../targets/common/arm/stm32/bootloader/boot.cpp
|
||||
../../targets/${TARGET_DIR}/bootloader/boot_menu.cpp
|
||||
)
|
||||
endif()
|
||||
|
||||
if(Qt5Widgets_FOUND)
|
||||
set(SIMULATOR_FLAVOUR edgetx-${FLAVOUR})
|
||||
set(SIMULATOR_TARGET ${SIMULATOR_FLAVOUR}-simulator)
|
||||
|
||||
@@ -137,6 +137,15 @@ void simuSetSwitch(uint8_t swtch, int8_t state)
|
||||
switchesStates[swtch] = state;
|
||||
}
|
||||
|
||||
#if defined(SIMU_BOOTLOADER)
|
||||
int bootloaderMain();
|
||||
static void* bootloaderThread(void*)
|
||||
{
|
||||
bootloaderMain();
|
||||
return nullptr;
|
||||
}
|
||||
#endif
|
||||
|
||||
void simuStart(bool tests, const char * sdPath, const char * settingsPath)
|
||||
{
|
||||
if (simu_running)
|
||||
@@ -195,7 +204,18 @@ void simuStart(bool tests, const char * sdPath, const char * settingsPath)
|
||||
try {
|
||||
#endif
|
||||
|
||||
#if !defined(SIMU_BOOTLOADER)
|
||||
simuMain();
|
||||
#else
|
||||
pthread_attr_t attr;
|
||||
pthread_attr_init(&attr);
|
||||
struct sched_param sp;
|
||||
sp.sched_priority = SCHED_RR;
|
||||
pthread_attr_setschedparam(&attr, &sp);
|
||||
|
||||
pthread_t bl_pid;
|
||||
pthread_create(&bl_pid, &attr, &bootloaderThread, nullptr);
|
||||
#endif
|
||||
|
||||
simu_running = true;
|
||||
|
||||
@@ -464,24 +484,6 @@ void pwrInit() {}
|
||||
void pwrOn() {}
|
||||
void pwrOff() {}
|
||||
|
||||
void readKeysAndTrims()
|
||||
{
|
||||
uint8_t index = 0;
|
||||
auto keysInput = readKeys();
|
||||
for (auto mask = (1 << 0); mask < (1 << TRM_BASE); mask <<= 1) {
|
||||
keys[index++].input(keysInput & mask);
|
||||
}
|
||||
|
||||
auto trimsInput = readTrims();
|
||||
for (auto mask = (1 << 0); mask < (1 << NUM_TRIMS_KEYS); mask <<= 1) {
|
||||
keys[index++].input(trimsInput & mask);
|
||||
}
|
||||
|
||||
if (keysInput || trimsInput) {
|
||||
resetBacklightTimeout();
|
||||
}
|
||||
}
|
||||
|
||||
bool keyDown()
|
||||
{
|
||||
return readKeys();
|
||||
|
||||
@@ -59,9 +59,6 @@ void lcdRefresh()
|
||||
|
||||
pixel_t displayBuf1[DISPLAY_BUFFER_SIZE];
|
||||
pixel_t displayBuf2[DISPLAY_BUFFER_SIZE];
|
||||
pixel_t LCD_BACKUP_FRAME_BUFFER[DISPLAY_BUFFER_SIZE];
|
||||
|
||||
BitmapBuffer lcdBackup(BMP_RGB565, LCD_W, LCD_H, LCD_BACKUP_FRAME_BUFFER);
|
||||
|
||||
BitmapBuffer _lcd1(BMP_RGB565, LCD_W, LCD_H, displayBuf1);
|
||||
BitmapBuffer _lcd2(BMP_RGB565, LCD_W, LCD_H, displayBuf2);
|
||||
@@ -69,20 +66,6 @@ BitmapBuffer _lcd2(BMP_RGB565, LCD_W, LCD_H, displayBuf2);
|
||||
BitmapBuffer * lcd = &_lcd1;
|
||||
BitmapBuffer * lcdFront = &_lcd2;
|
||||
|
||||
|
||||
void lcdStoreBackupBuffer()
|
||||
{
|
||||
memcpy(simuLcdBackupBuf, lcd->getData(),
|
||||
DISPLAY_BUFFER_SIZE * sizeof(pixel_t));
|
||||
}
|
||||
|
||||
int lcdRestoreBackupBuffer()
|
||||
{
|
||||
memcpy(lcd->getData(), simuLcdBackupBuf,
|
||||
DISPLAY_BUFFER_SIZE * sizeof(pixel_t));
|
||||
return 1;
|
||||
}
|
||||
|
||||
void newLcdRefresh(uint16_t *buffer, const rect_t& copy_area)
|
||||
{
|
||||
|
||||
@@ -111,33 +94,6 @@ void newLcdRefresh(uint16_t *buffer, const rect_t& copy_area)
|
||||
|
||||
// Mark screen dirty for async refresh
|
||||
simuLcdRefresh = true;
|
||||
|
||||
// // .. and wait for refresh
|
||||
// auto start = RTOS_GET_MS();
|
||||
// while(simuLcdRefresh ||
|
||||
// (RTOS_GET_MS() - start <= 100));
|
||||
}
|
||||
void lcdRefresh()
|
||||
{
|
||||
// Mark screen dirty for async refresh
|
||||
simuLcdRefresh = true;
|
||||
|
||||
pixel_t* lcdData = lcd->getData();
|
||||
|
||||
#if defined(LCD_VERTICAL_INVERT)
|
||||
auto src = lcdData + DISPLAY_BUFFER_SIZE - 1;
|
||||
auto dst = simuLcdBuf;
|
||||
auto end = dst + DISPLAY_BUFFER_SIZE;
|
||||
|
||||
while (dst != end) {
|
||||
*(dst++) = *(src--);
|
||||
}
|
||||
#else
|
||||
memcpy(simuLcdBuf, lcdData, DISPLAY_BUFFER_SIZE * sizeof(pixel_t));
|
||||
#endif
|
||||
|
||||
// Swap back & front buffers
|
||||
std::swap(lcd, lcdFront);
|
||||
}
|
||||
|
||||
void lcdInit()
|
||||
|
||||
Reference in New Issue
Block a user