refactor(doorbell): migrate ESP32-S3 to ESP_IOExpander library

This commit is contained in:
2026-02-16 20:51:56 -08:00
parent c7ea8d5817
commit 89f3248747
6 changed files with 225 additions and 2126 deletions

View File

@@ -1,9 +1,7 @@
#pragma once
#include <KlubhausCore.h>
#include <IDisplayDriver.h>
#include <Arduino_GFX_Library.h>
#include <Wire.h>
#include "board_config.h"
class DisplayDriverGFX : public IDisplayDriver {
public:
@@ -14,33 +12,18 @@ public:
int dashboardTouch(int x, int y) override;
HoldState updateHold(unsigned long holdMs) override;
void updateHint() override;
int width() override { return DISPLAY_WIDTH; }
int height() override { return DISPLAY_HEIGHT; }
int width() override;
int height() override;
private:
// CH422G helpers
void ch422gInit();
void ch422gWrite(uint8_t val);
uint8_t _exioBits = 0;
void exioSet(uint8_t bit, bool on);
// GT911 helpers
void gt911Init();
bool gt911Read(int& x, int& y);
// Rendering
void expanderInit();
void touchInit();
void drawBoot();
void drawAlert(const ScreenState& st);
void drawDashboard(const ScreenState& st);
Arduino_GFX* _gfx = nullptr;
// Hold-to-silence tracking
bool _holdActive = false;
uint32_t _holdStartMs = 0;
bool _lastTouched = false;
// Render-change tracking
ScreenID _lastScreen = ScreenID::BOOT;
bool _needsRedraw = true;
void drawDashboard(const ScreenState& state);
void drawAlert(const ScreenState& state);
void drawOff();
Arduino_RGB_Display* _gfx = nullptr;
bool _lastTouched = false;
unsigned long _holdStart = 0;
};