380 lines
11 KiB
Markdown
380 lines
11 KiB
Markdown
# HS-S43A Touch Migration + S3R Cleanup Implementation Plan
|
|
|
|
> **For agentic workers:** REQUIRED SUB-SKILL: Use superpowers:subagent-driven-development (recommended) or superpowers:executing-plans to implement this plan task-by-task. Steps use checkbox (`- [ ]`) syntax for tracking.
|
|
|
|
**Goal:** Remove internal pullups for HS-S43A touch sensors (invert logic), and purge all obsolete "Atom S3R Voice" references from code and docs.
|
|
|
|
**Architecture:** Two firmware files get identical pinMode+logic changes. Six documentation/config files get S3R→S3 Lite corrections. Compile verification via `pio run` for both environments.
|
|
|
|
**Tech Stack:** C++/Arduino, PlatformIO, Markdown docs, Bash scripts, YAML CI
|
|
|
|
---
|
|
|
|
### Task 1: Firmware — remove pullups and invert touch logic
|
|
|
|
**Files:**
|
|
- Modify: `src/main.cpp:400-401,561-562`
|
|
- Modify: `src/client.cpp:220-221,349-350`
|
|
|
|
- [ ] **Step 1: Change pinMode from INPUT_PULLUP to INPUT in main.cpp**
|
|
|
|
In `src/main.cpp`, change lines 400-401:
|
|
|
|
```
|
|
pinMode(TOUCH1_PIN, INPUT_PULLUP);
|
|
pinMode(TOUCH2_PIN, INPUT_PULLUP);
|
|
```
|
|
→
|
|
```
|
|
pinMode(TOUCH1_PIN, INPUT);
|
|
pinMode(TOUCH2_PIN, INPUT);
|
|
```
|
|
|
|
- [ ] **Step 2: Change pinMode from INPUT_PULLUP to INPUT in client.cpp**
|
|
|
|
In `src/client.cpp`, change lines 220-221:
|
|
|
|
```
|
|
pinMode(TOUCH1_PIN, INPUT_PULLUP);
|
|
pinMode(TOUCH2_PIN, INPUT_PULLUP);
|
|
```
|
|
→
|
|
```
|
|
pinMode(TOUCH1_PIN, INPUT);
|
|
pinMode(TOUCH2_PIN, INPUT);
|
|
```
|
|
|
|
- [ ] **Step 3: Invert touch read logic in main.cpp**
|
|
|
|
In `src/main.cpp`, change lines 561-562:
|
|
|
|
```
|
|
bool t1Raw = (digitalRead(TOUCH1_PIN) == LOW);
|
|
bool t2Raw = (digitalRead(TOUCH2_PIN) == LOW);
|
|
```
|
|
→
|
|
```
|
|
bool t1Raw = (digitalRead(TOUCH1_PIN) == HIGH);
|
|
bool t2Raw = (digitalRead(TOUCH2_PIN) == HIGH);
|
|
```
|
|
|
|
- [ ] **Step 4: Invert touch read logic in client.cpp**
|
|
|
|
In `src/client.cpp`, change lines 349-350:
|
|
|
|
```
|
|
bool t1Raw = (digitalRead(TOUCH1_PIN) == LOW);
|
|
bool t2Raw = (digitalRead(TOUCH2_PIN) == LOW);
|
|
```
|
|
→
|
|
```
|
|
bool t1Raw = (digitalRead(TOUCH1_PIN) == HIGH);
|
|
bool t2Raw = (digitalRead(TOUCH2_PIN) == HIGH);
|
|
```
|
|
|
|
- [ ] **Step 5: Compile both firmware environments**
|
|
|
|
Run: `pio run`
|
|
Expected: SUCCESS for both `s3lite-server` and `s3lite-client`
|
|
|
|
- [ ] **Step 6: Commit firmware changes**
|
|
|
|
```bash
|
|
git add src/main.cpp src/client.cpp
|
|
git commit -m "fix: remove pullups, invert touch logic for HS-S43A sensors"
|
|
```
|
|
|
|
---
|
|
|
|
### Task 2: AGENTS.md — update board, pins, flash command
|
|
|
|
**Files:**
|
|
- Modify: `AGENTS.md:3,7,8,9,16,23`
|
|
|
|
- [ ] **Step 1: Update line 3 (project summary)**
|
|
|
|
```
|
|
ESP32-S3-PICO-1-N8R8 (Atom S3R Voice), 2 relais, 2 touch sensors (JR223B), BLE, Android app USB OTG.
|
|
```
|
|
→
|
|
```
|
|
M5Stack Atom S3 Lite (ESP32-S3), 2 relais, 2 touch sensors (HS-S43A), BLE, Android app USB OTG.
|
|
```
|
|
|
|
- [ ] **Step 2: Update line 7 (board spec)**
|
|
|
|
```
|
|
- **Board:** Atom S3R Voice (ESP32-S3-PICO-1-N8R8), 16MB OPI flash
|
|
```
|
|
→
|
|
```
|
|
- **Board:** M5Stack Atom S3 Lite (ESP32-S3)
|
|
```
|
|
|
|
- [ ] **Step 3: Update line 8 (pin definitions)**
|
|
|
|
```
|
|
- **Pinnen:** G1=RELAY1, G2=RELAY2, G8+pullup=TOUCH1, G6+pullup=TOUCH2, G41=BUTTON (active low), G46=LED
|
|
```
|
|
→
|
|
```
|
|
- **Pinnen:** G1=RELAY1, G2=RELAY2, G8=TOUCH1, G6=TOUCH2, G41=BUTTON (active low), G46=LED
|
|
```
|
|
|
|
- [ ] **Step 4: Update line 9 (touch sensor type)**
|
|
|
|
```
|
|
- **Touch:** DC3-24V Capacitieve Touch Schakelaar JR223B (GEEN TTP223). Minder C op punt A = gevoeliger = meer false triggers.
|
|
```
|
|
→
|
|
```
|
|
- **Touch:** HS-S43A Digital Capacitive Switch Module (epenelab.io), actief HIGH, geen pullup nodig.
|
|
```
|
|
|
|
- [ ] **Step 5: Update line 16 (workspace description)**
|
|
|
|
```
|
|
`/home/eddy/src/Project_SylDa/` — S3R firmware + Android app
|
|
```
|
|
→
|
|
```
|
|
`/home/eddy/src/Project_SylDa/` — Atom S3 Lite firmware (server + client) + Android app
|
|
```
|
|
|
|
- [ ] **Step 6: Update line 23 (manual flash command)**
|
|
|
|
Replace the entire line 23 (manual flash command) to use s3lite-server build dir:
|
|
|
|
```
|
|
- **Direct flashen (handmatig):** `~/.platformio/packages/tool-esptoolpy/esptool.py --no-stub --chip esp32s3 --port /dev/ttyACM1 --baud 115200 --before default_reset --after hard_reset write_flash --flash_mode keep --flash_size keep 0x0 .pio/build/s3lite-server/bootloader.bin 0x8000 .pio/build/s3lite-server/partitions.bin 0xE000 ~/.platformio/packages/framework-arduinoespressif32/tools/partitions/boot_app0.bin 0x10000 .pio/build/s3lite-server/firmware.bin`
|
|
```
|
|
|
|
- [ ] **Step 7: Commit**
|
|
|
|
```bash
|
|
git add AGENTS.md
|
|
git commit -m "docs: update AGENTS.md for S3 Lite + HS-S43A touch sensors"
|
|
```
|
|
|
|
---
|
|
|
|
### Task 3: README.md — update all S3R references and touch sensor docs
|
|
|
|
**Files:**
|
|
- Modify: `README.md:5,13,17,18,24,27,28,45,134,138,140,184,197,380`
|
|
|
|
- [ ] **Step 1: Update line 5 (project description)**
|
|
|
|
```
|
|
BLE-gestuurde relais-switch voor de Atom S3R Voice (ESP32-S3-PICO-1-N8R8, 16MB OPI flash) met een bijbehorende Android-app. De relais kunnen worden bediend via capacitieve touch-sensoren (JR223B) óf via Bluetooth Low Energy vanaf een Android-telefoon.
|
|
```
|
|
→
|
|
```
|
|
BLE-gestuurde relais-switch voor de M5Stack Atom S3 Lite (ESP32-S3) met een bijbehorende Android-app. De relais kunnen worden bediend via capacitieve touch-sensoren (HS-S43A) óf via Bluetooth Low Energy vanaf een Android-telefoon.
|
|
```
|
|
|
|
- [ ] **Step 2: Update line 13 (board spec table)**
|
|
|
|
```
|
|
| Board | Atom S3R Voice (ESP32-S3-PICO-1-N8R8) |
|
|
```
|
|
→
|
|
```
|
|
| Board | M5Stack Atom S3 Lite (ESP32-S3) |
|
|
```
|
|
|
|
- [ ] **Step 3: Remove line 14 (SoC row — ESP32-S3-PICO-1-N8R8 detail)**
|
|
|
|
Delete line 14: `| SoC | ESP32-S3-PICO-1-N8R8 (8MB Flash, 8MB PSRAM, 16MB OPI flash) |`
|
|
|
|
- [ ] **Step 4: Update lines 17-18 (touch sensor table rows)**
|
|
|
|
```
|
|
| Touch sensor 1 | DC3-24V Capacitieve Touch Schakelaar JR223B op **G8** (interne pullup) |
|
|
| Touch sensor 2 | DC3-24V Capacitieve Touch Schakelaar JR223B op **G6** (interne pullup) |
|
|
```
|
|
→
|
|
```
|
|
| Touch sensor 1 | HS-S43A Digital Capacitive Switch Module op **G8** (actief HIGH) |
|
|
| Touch sensor 2 | HS-S43A Digital Capacitive Switch Module op **G6** (actief HIGH) |
|
|
```
|
|
|
|
- [ ] **Step 5: Update pinout diagram (lines 24-31)**
|
|
|
|
```
|
|
G6 = TOUCH2 (INPUT_PULLUP)
|
|
G8 = TOUCH1 (INPUT_PULLUP)
|
|
```
|
|
→
|
|
```
|
|
G6 = TOUCH2 (INPUT)
|
|
G8 = TOUCH1 (INPUT)
|
|
```
|
|
|
|
- [ ] **Step 6: Update line 44-45 (JR223B note)**
|
|
|
|
Replace the JR223B note block:
|
|
```
|
|
> **JR223B touch sensor:** Minder C op punt A = gevoeliger = meer false triggers. Bij lange draden of elektrische ruis een externe pullup plaatsen.
|
|
```
|
|
→
|
|
```
|
|
> **HS-S43A touch sensor:** Digitale output (actief HIGH). Geen pullup nodig — de sensor geeft actief 0V of 3.3V.
|
|
```
|
|
|
|
- [ ] **Step 7: Update relais logica tabel (lines 134, 138, 140)**
|
|
|
|
```
|
|
| Relais 1 | Touch sensor 1 | G8 = LOW (aanraken) | Relais 1 aan |
|
|
```
|
|
→
|
|
```
|
|
| Relais 1 | Touch sensor 1 | G8 = HIGH (aanraken) | Relais 1 aan |
|
|
```
|
|
|
|
```
|
|
| Relais 2 | Touch sensor 2 | G6 = LOW (aanraken) | Relais 2 aan |
|
|
```
|
|
→
|
|
```
|
|
| Relais 2 | Touch sensor 2 | G6 = HIGH (aanraken) | Relais 2 aan |
|
|
```
|
|
|
|
- [ ] **Step 8: Update serial monitor examples (lines 184, 197)**
|
|
|
|
```
|
|
=== Atom VoiceS3R BLE Relay ===
|
|
```
|
|
→ (both occurrences)
|
|
```
|
|
=== SylDa BLE Relay ===
|
|
```
|
|
|
|
- [ ] **Step 9: Update line 380 (technical notes)**
|
|
|
|
```
|
|
- De Atom S3R Voice gebruikt de ES8311 audio codec op G45/G0/G48/G4/G3/G17/G11, IR TX op G47, en de knop op G41. Deze pinnen zijn niet beschikbaar voor eigen gebruik (behalve G41 als input).
|
|
```
|
|
→
|
|
```
|
|
- De Atom S3 Lite heeft GPIO G1, G2, G5-G8, G38, G39 beschikbaar op de headers. G41 is de interne knop (active low). G46 is de interne LED.
|
|
```
|
|
|
|
- [ ] **Step 10: Commit**
|
|
|
|
```bash
|
|
git add README.md
|
|
git commit -m "docs: update README for S3 Lite + HS-S43A, remove S3R references"
|
|
```
|
|
|
|
---
|
|
|
|
### Task 4: CI and tools — fix build output paths
|
|
|
|
**Files:**
|
|
- Modify: `.forgejo/workflows/ci.yml:25-27`
|
|
- Modify: `tools/copy_firmware.sh:4`
|
|
|
|
- [ ] **Step 1: Fix ci.yml build paths**
|
|
|
|
In `.forgejo/workflows/ci.yml`, change lines 25-27:
|
|
|
|
```
|
|
cp .pio/build/m5stack-atoms3r/firmware.bin /tmp/ci-artifacts/firmware/
|
|
cp .pio/build/m5stack-atoms3r/bootloader.bin /tmp/ci-artifacts/firmware/
|
|
cp .pio/build/m5stack-atoms3r/partitions.bin /tmp/ci-artifacts/firmware/
|
|
```
|
|
→
|
|
```
|
|
cp .pio/build/s3lite-server/firmware.bin /tmp/ci-artifacts/firmware/
|
|
cp .pio/build/s3lite-server/bootloader.bin /tmp/ci-artifacts/firmware/
|
|
cp .pio/build/s3lite-server/partitions.bin /tmp/ci-artifacts/firmware/
|
|
```
|
|
|
|
- [ ] **Step 2: Fix copy_firmware.sh build path**
|
|
|
|
In `tools/copy_firmware.sh`, change line 4:
|
|
|
|
```
|
|
BINARY_DIR="$(cd "$(dirname "$0")/.." && pwd)/.pio/build/m5stack-atoms3r"
|
|
```
|
|
→
|
|
```
|
|
BINARY_DIR="$(cd "$(dirname "$0")/.." && pwd)/.pio/build/s3lite-server"
|
|
```
|
|
|
|
- [ ] **Step 3: Commit**
|
|
|
|
```bash
|
|
git add .forgejo/workflows/ci.yml tools/copy_firmware.sh
|
|
git commit -m "fix: update build paths m5stack-atoms3r → s3lite-server"
|
|
```
|
|
|
|
---
|
|
|
|
### Task 5: Historical docs — purge S3R references
|
|
|
|
**Files:**
|
|
- Modify: `docs/superpowers/specs/2026-07-28-esp32-pico-d4-port-design.md`
|
|
- Modify: `docs/superpowers/plans/2025-07-31-sylda-nimble-hmac-plan.md`
|
|
- Modify: `docs/superpowers/plans/2026-07-30-ble-ota.md`
|
|
- Modify: `docs/superpowers/plans/2025-07-28-esp32-pico-d4-port.md`
|
|
- Modify: `docs/superpowers/plans/2026-07-28-esp32-pico-d4-port.md`
|
|
|
|
- [ ] **Step 1: Fix `docs/superpowers/specs/2026-07-28-esp32-pico-d4-port-design.md`**
|
|
|
|
S3R references in this file (lines 3, 7, 48, 50, 116):
|
|
- Line 3: `Atom VoiceS3R` → `Atom S3 Lite`
|
|
- Line 7: `Atom VoiceS3R with ESP32-S3-PICO-1-N8R8 (8MB Flash, 8MB PSRAM)` → `Atom S3 Lite (ESP32-S3)`
|
|
- Line 48: BLE device name row — keep as-is (it documents the rename from S3R), no change needed
|
|
- Line 50: `"Atom VoiceS3R BLE Relay"` → keep as-is (documents the rename)
|
|
- Line 116: `m5stack-atoms3r` → `s3lite-server`
|
|
|
|
- [ ] **Step 2: Fix `docs/superpowers/plans/2025-07-31-sylda-nimble-hmac-plan.md`**
|
|
|
|
Line 115: `S3R pinmap + 1-client code` → `old pinmap + 1-client code`
|
|
|
|
- [ ] **Step 3: Fix `docs/superpowers/plans/2026-07-30-ble-ota.md`**
|
|
|
|
Line 331: `m5stack-atoms3r` → `s3lite-server`
|
|
|
|
- [ ] **Step 4: Fix `docs/superpowers/plans/2025-07-28-esp32-pico-d4-port.md`**
|
|
|
|
Line 170: `"AtomS3R-Relay"` → keep as-is (documents the old name)
|
|
|
|
- [ ] **Step 5: Fix `docs/superpowers/plans/2026-07-28-esp32-pico-d4-port.md`**
|
|
|
|
Line 140: `"=== Atom VoiceS3R BLE Relay ==="` → keep as-is (documents old serial banner)
|
|
Line 150: `"AtomS3R-Relay"` → keep as-is (documents old BLE name)
|
|
Line 160: `'AtomS3R-Relay'` → keep as-is (documents old BLE name)
|
|
Line 168: `S3-specific or AtomS3R references` → `S3-specific references`
|
|
Line 171: `"S3R\|S3\|Atom Voice\|46\|G38\|G1\b"` → `"S3\|Atom Voice\|46\|G38\|G1\b"`
|
|
Line 195: `m5stack-atoms3r` → `s3lite-server`
|
|
|
|
- [ ] **Step 6: Commit**
|
|
|
|
```bash
|
|
git add docs/superpowers/
|
|
git commit -m "docs: purge S3R references from historical design docs and plans"
|
|
```
|
|
|
|
---
|
|
|
|
### Task 6: Final verification
|
|
|
|
- [ ] **Step 1: Verify no remaining S3R references**
|
|
|
|
Run: `grep -rPn '(?i)s3r|atoms3r|m5stack-atoms3r|Atom S3R|VoiceS3R' --include='*.md' --include='*.cpp' --include='*.yml' --include='*.sh' .`
|
|
Expected: no output
|
|
|
|
- [ ] **Step 2: Verify firmware compiles**
|
|
|
|
Run: `pio run`
|
|
Expected: SUCCESS for both environments
|
|
|
|
- [ ] **Step 3: Commit design doc and spec**
|
|
|
|
```bash
|
|
git add docs/superpowers/specs/2026-08-01-hs-s43a-touch-migration-design.md docs/superpowers/plans/2026-08-01-hs-s43a-touch-migration.md
|
|
git commit -m "docs: add design spec and implementation plan for HS-S43A migration"
|
|
```
|