Fix ESP32-S3 LCD timing, add diagnostics, scaffold script
1. **Display timing fixes for ESP32-S3-LCD-4.3** - Corrected RGB panel timing parameters (hsync/vsync porch values) - **Critical fix**: Set `pclk_active_neg = 1` (required for ST7262 panel) - Added explicit PCLK speed of 16MHz - These changes fix the blank/unstable display issue on Waveshare 4.3" boards 2. **Added memory diagnostics** - Prints free heap and PSRAM at boot - Helps verify PSRAM is properly initialized 3. **Duplicate loop() function** - The `loop()` function appears twice in the .ino file - Contains identical code for touch handling, hold-to-silence, and serial commands - This is a build error waiting to happen 4. **New scaffold script** - Added comprehensive project scaffolding script (`scaffold.sh`) - Generates complete multi-target build structure with shared library and per-board drivers - **ESP32-S3-LCD-4.3 board should now display correctly** (was likely blank before due to wrong timing) - **Build will fail** due to duplicate `loop()` definition - needs immediate cleanup - The scaffold script enables rapid project regeneration/setup for new installations
This commit is contained in:
@@ -60,6 +60,8 @@ void setup() {
|
||||
logic.finishBoot();
|
||||
display.setBacklight(false);
|
||||
|
||||
Serial.printf("[MEM] Free heap: %d | Free PSRAM: %d\n",
|
||||
ESP.getFreeHeap(), ESP.getFreePsram());
|
||||
Serial.println("[BOOT] Ready — monitoring ntfy.sh\n");
|
||||
}
|
||||
|
||||
@@ -72,5 +74,64 @@ void silenceAlerts() {
|
||||
}
|
||||
|
||||
void loop() {
|
||||
logic.update();
|
||||
display.render(logic.getScreenState());
|
||||
|
||||
// Touch → hold-to-silence gesture
|
||||
TouchEvent evt = display.readTouch();
|
||||
if (evt.pressed) {
|
||||
// Dashboard tile tap
|
||||
if (logic.getScreenState().screen == ScreenID::DASHBOARD) {
|
||||
int tile = display.dashboardTouch(evt.x, evt.y);
|
||||
if (tile >= 0) Serial.printf("[DASH] Tile %d tapped\n", tile);
|
||||
}
|
||||
}
|
||||
|
||||
// Hold-to-silence during ALERT
|
||||
if (logic.getScreenState().deviceState == DeviceState::ALERTING) {
|
||||
HoldState h = display.updateHold(HOLD_TO_SILENCE_MS);
|
||||
if (h.completed) silenceAlerts();
|
||||
|
||||
// Hint animation when not touching
|
||||
if (!h.active) display.updateHint();
|
||||
}
|
||||
|
||||
// Serial commands
|
||||
if (Serial.available()) {
|
||||
String cmd = Serial.readStringUntil('\n');
|
||||
cmd.trim();
|
||||
if (cmd.length() > 0) logic.onSerialCommand(cmd);
|
||||
}
|
||||
}
|
||||
|
||||
void loop() {
|
||||
logic.update();
|
||||
display.render(logic.getScreenState());
|
||||
|
||||
// Touch → hold-to-silence gesture
|
||||
TouchEvent evt = display.readTouch();
|
||||
if (evt.pressed) {
|
||||
// Dashboard tile tap
|
||||
if (logic.getScreenState().screen == ScreenID::DASHBOARD) {
|
||||
int tile = display.dashboardTouch(evt.x, evt.y);
|
||||
if (tile >= 0) Serial.printf("[DASH] Tile %d tapped\n", tile);
|
||||
}
|
||||
}
|
||||
|
||||
// Hold-to-silence during ALERT
|
||||
if (logic.getScreenState().deviceState == DeviceState::ALERTING) {
|
||||
HoldState h = display.updateHold(HOLD_TO_SILENCE_MS);
|
||||
if (h.completed) silenceAlerts();
|
||||
|
||||
// Hint animation when not touching
|
||||
if (!h.active) display.updateHint();
|
||||
}
|
||||
|
||||
// Serial commands
|
||||
if (Serial.available()) {
|
||||
String cmd = Serial.readStringUntil('\n');
|
||||
cmd.trim();
|
||||
if (cmd.length() > 0) logic.onSerialCommand(cmd);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user