feat: WASM modules based simulation in Companion (#6435)

This commit is contained in:
Raphael Coeffic
2026-03-20 12:19:17 +10:00
committed by GitHub
parent 5f8a38bb18
commit 04a2231aee
80 changed files with 3126 additions and 2220 deletions
@@ -529,6 +529,12 @@ coord_t BitmapBuffer::drawSizedText(coord_t x, coord_t y, const char *s,
return ((flags & RIGHT) ? orig_pos : pos) - offsetX;
}
coord_t BitmapBuffer::drawText(coord_t x, coord_t y, const char* s, LcdFlags flags)
{
if (!s) return x;
return drawSizedText(x, y, s, strlen(s), flags);
}
// Resize and convert to LVGL image data format with alpha blending to
// background color
void BitmapBuffer::resizeToLVGL(coord_t w, coord_t h)
+1 -5
View File
@@ -132,11 +132,7 @@ class BitmapBuffer
coord_t drawSizedText(coord_t x, coord_t y, const char* s, uint8_t len,
LcdFlags flags = 0);
coord_t drawText(coord_t x, coord_t y, const char* s, LcdFlags flags = 0)
{
if (!s) return x;
return drawSizedText(x, y, s, strlen(s), flags);
}
coord_t drawText(coord_t x, coord_t y, const char* s, LcdFlags flags = 0);
void drawBitmap(coord_t x, coord_t y, const BitmapBuffer* bmp,
coord_t srcx = 0, coord_t srcy = 0, coord_t srcw = 0,
+1 -3
View File
@@ -176,9 +176,7 @@ LabelDialog::LabelDialog(const char *label, int length, const char* title,
std::function<void(std::string)> _saveHandler) :
ModalWindow(false), saveHandler(std::move(_saveHandler))
{
assert(length <= MAX_LABEL_LENGTH);
strncpy(this->label, label, length);
strncpy(this->label, label, std::min(length, MAX_LABEL_LENGTH));
this->label[length] = '\0';
auto form = new Window(this, rect_t{});
+5 -6
View File
@@ -25,12 +25,11 @@
#include "layout.h"
#include "LvglWrapper.h"
#include "etx_lv_theme.h"
#include "os/sleep.h"
#include "sdcard.h"
#include "view_main.h"
// timers_driver.h
uint32_t timersGetMsTick();
#include "os/sleep.h"
#include "os/time.h"
#include "sdcard.h"
MainWindow* MainWindow::_instance = nullptr;
@@ -63,7 +62,7 @@ void MainWindow::run(bool trash)
LvglWrapper::instance()->run();
#if defined(DEBUG_WINDOWS)
auto start = timersGetMsTick();
auto start = time_get_ms();
#endif
if (widgetRefreshEnable)
@@ -85,7 +84,7 @@ void MainWindow::run(bool trash)
emptyTrash();
#if defined(DEBUG_WINDOWS)
auto delta = timersGetMsTick() - start;
auto delta = time_get_ms() - start;
if (delta > 10) {
TRACE_WINDOWS("MainWindow::run took %dms", delta);
}
@@ -27,6 +27,7 @@
#define SET_DIRTY() storageDirty(EE_MODEL)
#if defined(EXTERNAL_ANTENNA)
PXX1AntennaSettings::PXX1AntennaSettings(Window* parent,
const FlexGridLayout& g,
uint8_t moduleIdx) :
@@ -62,3 +63,4 @@ PXX1AntennaSettings::PXX1AntennaSettings(Window* parent,
antennaChoice->setAvailableHandler(
[=](int8_t mode) { return mode != ANTENNA_MODE_PER_MODEL; });
}
#endif
+2 -3
View File
@@ -30,8 +30,8 @@ uint8_t menuLevel = 0;
void popMenu()
{
killEvents(KEY_EXIT);
if (menuLevel == 0) return;
assert(menuLevel > 0);
menuLevel = menuLevel - 1;
menuEvent = EVT_ENTRY_UP;
// TODO ? AUDIO_KEY_PRESS();
@@ -57,6 +57,7 @@ void chainMenu(MenuHandlerFunc newMenu)
void pushMenu(MenuHandlerFunc newMenu)
{
killAllEvents();
if (menuLevel == DIM(menuHandlers) - 1) return;
if (menuLevel == 0) {
if (newMenu == menuTabGeneral[0].menuFunc)
@@ -71,8 +72,6 @@ void pushMenu(MenuHandlerFunc newMenu)
menuLevel++;
assert(menuLevel < DIM(menuHandlers));
menuHandlers[menuLevel] = newMenu;
menuEvent = EVT_ENTRY;
// ? AUDIO_KEY_PRESS();