feat(boards): add device detection and text scrolling support
This commit is contained in:
@@ -395,16 +395,37 @@ void DisplayDriverGFX::drawAlert(const ScreenState& state) {
|
||||
void DisplayDriverGFX::drawDashboard(const ScreenState& state) {
|
||||
_gfx->fillScreen(STYLE_COLOR_BG);
|
||||
|
||||
// Header
|
||||
// Header - use Layout for safe positioning
|
||||
_gfx->fillRect(0, 0, DISP_W, STYLE_HEADER_HEIGHT, STYLE_COLOR_HEADER);
|
||||
Layout header = Layout::header(DISP_W, STYLE_HEADER_HEIGHT);
|
||||
Layout safeText = header.padded(STYLE_SPACING_X);
|
||||
|
||||
setBodyFont();
|
||||
_gfx->setTextColor(STYLE_COLOR_FG);
|
||||
_gfx->setCursor(STYLE_SPACING_X, 12);
|
||||
_gfx->printf("KLUBHAUS");
|
||||
|
||||
// WiFi status
|
||||
_gfx->setCursor(DISP_W - 120, 12);
|
||||
_gfx->printf("WiFi:%s", state.wifiSsid.length() > 0 ? "ON" : "OFF");
|
||||
// Title with scrolling support
|
||||
_headerScroller.setText("KLUBHAUS");
|
||||
_headerScroller.setScrollSpeed(80);
|
||||
_headerScroller.setPauseDuration(2000);
|
||||
_headerScroller.render(
|
||||
[&](int16_t x, const char* s) {
|
||||
_gfx->setCursor(safeText.x + x, safeText.y + 4);
|
||||
_gfx->print(s);
|
||||
},
|
||||
safeText.w);
|
||||
|
||||
// WiFi status - right aligned with scrolling
|
||||
Layout wifiArea(DISP_W - 150, 0, 140, STYLE_HEADER_HEIGHT);
|
||||
Layout safeWifi = wifiArea.padded(4);
|
||||
_wifiScroller.setText(state.wifiSsid.length() > 0 ? state.wifiSsid.c_str() : "WiFi: OFF");
|
||||
_wifiScroller.setScrollSpeed(60);
|
||||
_wifiScroller.setPauseDuration(1500);
|
||||
_wifiScroller.render(
|
||||
[&](int16_t x, const char* s) {
|
||||
_gfx->setCursor(safeWifi.x + x, safeWifi.y + 4);
|
||||
_gfx->print(s);
|
||||
},
|
||||
safeWifi.w);
|
||||
|
||||
// Get tile layouts from library helper
|
||||
int tileCount = display.calculateDashboardLayouts(STYLE_HEADER_HEIGHT, STYLE_TILE_GAP);
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
#pragma once
|
||||
|
||||
#include "IDisplayDriver.h"
|
||||
#include "Style.h"
|
||||
|
||||
#include <Arduino.h>
|
||||
|
||||
@@ -54,4 +55,8 @@ private:
|
||||
ScreenID _lastScreen = ScreenID::BOOT;
|
||||
BootStage _lastBootStage = BootStage::SPLASH;
|
||||
bool _needsRedraw = true;
|
||||
|
||||
// Text scrollers for scrolling elements
|
||||
TextScroller _headerScroller;
|
||||
TextScroller _wifiScroller;
|
||||
};
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
FQBN="esp32:esp32:waveshare_esp32_s3_touch_lcd_43:PSRAM=enabled,FlashSize=16M,USBMode=hwcdc,PartitionScheme=app3M_fat9M_16MB"
|
||||
PORT="/dev/ttyACM0"
|
||||
PORT="/dev/ttyUSB0"
|
||||
LIBS="--library ./vendor/esp32-s3-lcd-43/LovyanGFX"
|
||||
OPTS="-DDEBUG_MODE -DBOARD_HAS_PSRAM -DLGFX_USE_V1 -DLOCAL_SECRETS"
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
#pragma once
|
||||
|
||||
#define BOARD_NAME "WS_S3_43"
|
||||
#define BOARD_NAME "esp32-s3-lcd-43"
|
||||
#define DISPLAY_WIDTH 800
|
||||
#define DISPLAY_HEIGHT 480
|
||||
#define DISPLAY_ROTATION 0
|
||||
|
||||
Reference in New Issue
Block a user