Commit graph

203 commits

Author SHA1 Message Date
eddy
3b17f1fe50 touch: INPUT_PULLUP, !t1Active logica (sensor actief LOW)
Some checks failed
CI / build (push) Has been cancelled
2026-08-04 01:20:47 +02:00
eddy
3c87990a9c fix(client): connectTimeout in ms, NVS addr byte order, onScanEnd callback
All checks were successful
CI / build (push) Successful in 1m14s
- setConnectTimeout(5000ms) instead of 10ms (NimBLE-Arduino v2 uses ms)
- Fix NVS stored address: use ble_addr_t struct constructor to avoid
  double byte-reversal, and correct type BLE_ADDR_PUBLIC
- Use onScanEnd callback to defer connect until scan fully terminated
- Separate foundAddr to avoid race between scan callback and loop
2026-08-04 01:00:35 +02:00
eddy
a51936f819 feat(client): scan+connect statemachine replaces hardcoded MAC 2026-08-04 00:31:38 +02:00
eddy
67979ecce6 feat(client): extend MyScanCallbacks with UUID prefix matching 2026-08-04 00:29:32 +02:00
eddy
f07d305621 feat(client): add scan constants, NVS addr key, and state globals 2026-08-04 00:29:07 +02:00
eddy
3be06b7469 Fix BLE ECDH handshake: wait for CCCD write before sending pubkey
All checks were successful
CI / build (push) Successful in 1m5s
BleRelayManager.kt: Android's gatt.writeCharacteristic() returns false when a
previous GATT operation (CCCD writeDescriptor) is still pending. Split
startEcdhHandshake() into two phases: CCCD setup (with ecdhCccdPending flag)
and sendEcdhHandshake() triggered from onDescriptorWrite callback.

main.cpp: After SET_ID over USB, update BLE advertising scan response
manufacturer data so Android can find the server by its new UUID prefix.
2026-08-04 00:11:36 +02:00
eddy
a242bfa58a Merge branch 'feature/aes-ecdh-ble' into main
- AES-256-GCM + ECDH key exchange vervangt HMAC-SHA256 (issue #2)
- NVS namespace 'hmac' -> 'syl', key 'key' -> 'psk'
- ECDH-UUID characteristic toegevoegd voor key agreement
- Android: PSK key exchange via USB CDC, ECDH handshake in BleRelayManager
- Conflictoplossingen:
  - pUuidChar + pEcdhChar beide globaal, INPUT voor touch pins
  - client.cpp: serverFound + MyScanCallbacks behouden voor ECDH compat
  - SettingsActivity.kt: PSK detectie + debug log gecombineerd
  - version.txt: HEAD versie (20/5) behouden
  - version.h: verwijderd (auto-gegenereerd)
2026-08-03 23:45:15 +02:00
eddy
c1729e17d1 Revert "Add auto-detected upload_port for both ESP32s"
All checks were successful
CI / build (push) Successful in 1m14s
This reverts commit 5b05fabdae.
2026-08-03 23:34:31 +02:00
eddy
5b05fabdae Add auto-detected upload_port for both ESP32s
Some checks failed
CI / build (push) Has been cancelled
2026-08-03 23:34:04 +02:00
eddy
3cd4a6211d Add device UUID prefix to BLE scan response and filter in scan callback
All checks were successful
CI / build (push) Successful in 1m6s
ESP32 server: include 4-byte device UUID prefix as manufacturer data
(company 0xFFFF) in BLE scan response, allowing pre-connection filtering.

Android: check manufacturer data in ScanCallback.onScanResult before
connecting. Skips devices with non-matching UUID prefix, preventing
wasted connections to wrong SylDa devices. Backward compatible with
old firmware (proceeds if no manufacturer data present).
2026-08-03 23:30:35 +02:00
eddy
290ce0a027 Remove version check from CI (needs Gradle, not available)
All checks were successful
CI / build (push) Successful in 1m31s
2026-08-03 16:55:32 +02:00
eddy
62d27bf8b4 Simplify CI to firmware build + version check only
Some checks failed
CI / build (push) Failing after 1m26s
2026-08-03 16:53:00 +02:00
eddy
cc1de38ca4 Fix release artifact paths for firmware subdirectories
Some checks failed
CI / firmware (push) Failing after 1m32s
CI / android (push) Has been skipped
Release / build (push) Successful in 1m47s
v1.2
2026-08-03 16:44:46 +02:00
eddy
2eccced6fb Remove debug logging from scan callback
Some checks failed
CI / firmware (push) Failing after 1m45s
CI / android (push) Has been skipped
Release / build (push) Failing after 1m23s
2026-08-03 16:39:36 +02:00
eddy
cd2d949f87 Fix BLE scan + touch logic + UUID + version read
Some checks failed
CI / android (push) Has been cancelled
CI / firmware (push) Has been cancelled
- Client: change passive BLE scan to active scan (setActiveScan(true))
  Server puts name/UUID in scan response; passive scan never
  received them, so isAdvertisingService() and getName() failed.
- Server: add INPUT_PULLUP on touch pins to prevent floating
  triggers when sensors disconnected
- Server: update BLE UUID characteristic in SET_ID handler
  (pUuidChar->setValue) so reconnecting clients see correct UUID
- Server: touch logic changed from t1Active/t2Active to
  !t1Active/!t2Active (door closed = relay ON)
- Android: flushReadBuffer before VERSION? to discard stale
  boot log output; use Regex for BUILD_NR parsing
- copy_firmware.sh: copy to firmware/server/ and firmware/client/
  subdirectories to match EspFlasher.assetPath()
- version.txt: server=20 client=5
2026-08-03 16:38:26 +02:00
eddy
6a07505d02 ci: add version consistency check and fully automate release pipeline
Some checks failed
CI / firmware (push) Successful in 1m13s
CI / android (push) Failing after 13s
- New tools/check_versions.sh: verifies version.txt, version.h, SylDaVersions.kt match
- release.yml: 'Verify version consistency' step after build, aborts release if mismatch
- ci.yml: same check after debug APK build
- scripts/release.sh: now runs full pipeline (pio run -> copy firmware -> gradle -> check)
  and refuses dirty working tree
- Untrack version.h, SylDaVersions.kt, release/ — always regenerated fresh from version.txt

Prevents the v1.1 bug where stale generated files caused version mismatch
and infinite re-flash loop.
2026-08-03 15:28:00 +02:00
eddy
1d94f088fd chore: update v1.1 release AAB and checksums
Some checks failed
CI / firmware (push) Successful in 1m36s
Release / build (push) Failing after 1m33s
CI / android (push) Successful in 11s
v1.1
2026-08-03 15:20:33 +02:00
eddy
07a2d22f76 fix: sync firmware version.h (16->17) and SylDaVersions.kt (18->17) with version.txt
Some checks failed
CI / firmware (push) Has been cancelled
CI / android (push) Has been cancelled
Release / build (push) Has been cancelled
Root cause: version.h and SylDaVersions.kt were stale, causing
app to expect BUILD_NR:18 while firmware reports BUILD_NR:16.
This triggered infinite re-flash loop on every 'Module bijwerken'.

Rebuilt firmware and APK so all versions agree on server=17/client=3.
Replace v1.1 release with corrected builds.
2026-08-03 15:19:12 +02:00
eddy
d952730566 fix(workflow): match signing.properties keys with build.gradle
All checks were successful
CI / firmware (push) Successful in 1m24s
CI / android (push) Successful in 14s
Release / build (push) Successful in 1m44s
2026-08-03 14:47:16 +02:00
eddy
edd391620a fix(workflow): create keystore dir before decoding
Some checks failed
CI / firmware (push) Successful in 1m32s
Release / build (push) Failing after 1m24s
CI / android (push) Successful in 21s
2026-08-03 14:43:00 +02:00
eddy
e4c80d4955 fix(release): replace missing forgejo-release action with direct Forgejo API calls
Some checks failed
CI / firmware (push) Successful in 58s
CI / android (push) Successful in 51s
Release / build (push) Failing after 1m17s
The forgejo-release@v1 action was never published to the Forgejo
packages registry, causing the release workflow to fail with a 404
when cloning the action. Replace it with curl calls to the Forgejo
API: POST /releases to create the release, then POST /assets for
each artifact file.
2026-08-03 14:24:21 +02:00
eddy
2b7c2b8450 fix(release): replace missing forgejo-release action with direct Forgejo API calls
The forgejo-release@v1 action was never published to the Forgejo
packages registry, causing the release workflow to fail with a 404
when cloning the action. Replace it with curl calls to the Forgejo
API: POST /releases to create the release, then POST /assets for
each artifact file.
2026-08-03 14:23:20 +02:00
eddy
d6f1062a44 Replace HMAC-SHA256 with AES-256-GCM + ECDH key exchange for BLE relay commands (issue #2)
- New: src/ecdh_helper.h — ECDH keypair gen, shared secret, pubkey HMAC sign/verify
- Server (src/main.cpp): ECDH handshake callback, AES-GCM decrypt, PSK from NVS
- Client (src/main.cpp→client.cpp): ECDH after connect, AES-GCM encrypt, PSK from NVS
- Android: ECDH (KeyAgreement) + AES-GCM (Cipher) in BleRelayManager.kt
- PSK provisioned via USB CDC SET_KEY (SettingsActivity.kt)
- PrefsHelper: hmac_key → psk
- Bumped versions: server=18, client=4
- NVS namespace: hmac→syl, key:hmac_key→psk
- BLE ECDH characteristic: beb5483e-...-f26dc (WRITE_NR|NOTIFY)
2026-08-03 04:34:26 +02:00
eddy
8b2dfcbfd0 Add app icon from icon.png (all densities)
All checks were successful
CI / firmware (push) Successful in 1m16s
CI / android (push) Successful in 5s
2026-08-02 21:37:05 +02:00
eddy
d0cf506fbe Release v1.1: server=17 client=3
Some checks failed
CI / firmware (push) Successful in 1m23s
CI / android (push) Successful in 5s
Release / build (push) Failing after 1s
2026-08-02 21:31:25 +02:00
68aec28fe2 Merge pull request 'Scan on service UUID instead of device name (issue #10)' (#14) from fix/issue-10-ble-scan-service-uuid into main
All checks were successful
CI / firmware (push) Successful in 1m11s
CI / android (push) Successful in 5s
2026-08-02 21:28:00 +02:00
eddy
7bdd50b16e Scan on service UUID instead of device name (issue #10)
All checks were successful
CI / firmware (pull_request) Successful in 1m16s
CI / android (pull_request) Successful in 5s
- Replace name-based scan filter (getName() == 'SylDa_Server') with
  isAdvertisingService(SERVICE_UUID) to prevent BLE name spoofing
- Post-connect UUID verification via UUID_CHAR_UUID was already in place
- Update log messages to reflect service-UUID-based scanning
2026-08-02 21:27:19 +02:00
eddy
faa4011fd1 Skip auto-detect when UPLOAD_PORT already set via CLI or config
All checks were successful
CI / firmware (push) Successful in 1m11s
CI / android (push) Successful in 5s
2026-08-02 21:23:44 +02:00
87eefe4a3c Merge pull request 'Auto-detect upload port via ID? serial query (issue #11)' (#13) from fix/issue-11-portable-upload-port into main
All checks were successful
CI / firmware (push) Successful in 1m27s
CI / android (push) Successful in 6s
2026-08-02 21:19:04 +02:00
eddy
bf6619aa54 Auto-detect upload port via ID? serial query (issue #11)
All checks were successful
CI / firmware (pull_request) Successful in 1m22s
CI / android (pull_request) Successful in 7s
- Add ID? command to firmware: server responds 'SylDa_Server', client 'SylDa_Client'
- Add tools/pio_upload_port.py POST-script that queries connected ESP32s
- Remove hardcoded upload_port from platformio.ini
- Script logic: 1 ESP32 → use directly, 2+ → ID? query, no match → prompt user
- Requires pyserial for serial queries (graceful fallback if missing)
2026-08-02 21:18:26 +02:00
f8d4e96241 Merge pull request 'Replace Serial.* logging with ESP_LOG* macros (issue #8)' (#12) from fix/issue-8-cleanup-logging into main
All checks were successful
CI / firmware (push) Successful in 1m12s
CI / android (push) Successful in 7s
2026-08-02 20:57:40 +02:00
eddy
4aa2a750d9 Review fixes: Serial ERROR→ESP_LOGE, heartbeat→ESP_LOGD
All checks were successful
CI / firmware (pull_request) Successful in 1m26s
CI / android (pull_request) Successful in 5s
- Replace remaining Serial.println("ERROR:...") with ESP_LOGE in client.cpp
- Add Serial.println("ERROR") for protocol response where needed
- Downgrade heartbeat from ESP_LOGI to ESP_LOGD (not needed in production)
2026-08-02 20:56:37 +02:00
eddy
32489fbabb Replace Serial.* logging with ESP_LOG* macros (issue #8)
All checks were successful
CI / firmware (pull_request) Successful in 1m21s
CI / android (pull_request) Successful in 7s
- Convert all Serial.println/printf debug logging to ESP_LOGE/W/I/D
- Add TAG-based log identification (server/client)
- Lower CORE_DEBUG_LEVEL from 5 to 3 for production
- Keep Serial.printf for USB serial protocol commands (KEY?, VERSION?, etc.)
2026-08-02 20:51:21 +02:00
eddy
0261c73746 docs: update README — LED signaling, dual-target, BLE spoofing issue, version.txt
All checks were successful
CI / firmware (push) Successful in 1m4s
CI / android (push) Successful in 6s
2026-08-02 20:34:42 +02:00
eddy
1d4991f77f Merge PR #9: LED uniforme signalering, uit na 60s stabiele verbinding (fixes #4)
All checks were successful
CI / firmware (push) Successful in 1m5s
CI / android (push) Successful in 9s
2026-08-02 20:20:50 +02:00
eddy
95f440eec8 fix: relay buttons always enabled, touch sensor inversion, version bump
All checks were successful
CI / firmware (pull_request) Successful in 1m19s
CI / android (pull_request) Successful in 9s
- MainActivity: remove isServer check — relay buttons always enabled when
  connected, regardless of device mode (fixes silently broken buttons when
  device mode accidentally set to 'client')
- client.cpp: invert HS-S43A touch sensor readings (!tActive) — sensors
  are active LOW
- build.gradle: bump versionCode 2, versionName 1.1
- platformio.ini: use stable by-id port for server ESP32
- firmware/*.bin: rebuilt with LED signaling and touch fixes
2026-08-02 20:12:07 +02:00
eddy
84e6ca8100 fix(server): defer 0xFF OTA confirm to fix race condition
All checks were successful
CI / firmware (pull_request) Successful in 1m4s
CI / android (pull_request) Successful in 8s
2026-08-02 18:42:07 +02:00
eddy
5fe5879873 docs: document version.txt as single source of truth for firmware versions
All checks were successful
CI / firmware (pull_request) Successful in 1m4s
CI / android (pull_request) Successful in 11s
2026-08-02 18:30:22 +02:00
eddy
b233ba0ac4 chore: bump versions to server v16, client v2 2026-08-02 18:29:10 +02:00
eddy
6d027fd35b chore: bump server v16, client v2
All checks were successful
CI / firmware (pull_request) Successful in 1m1s
CI / android (pull_request) Successful in 48s
2026-08-02 18:21:05 +02:00
eddy
ebaaa8cc4b feat(client): uniform LED signaling — off after 60s stable connection 2026-08-02 18:20:55 +02:00
eddy
d9ac8a578b feat(server): uniform LED signaling — off after 60s stable connection 2026-08-02 18:20:30 +02:00
eddy
ff99fe0a90 docs: LED stable connection implementation plan (#4) 2026-08-02 18:19:20 +02:00
eddy
bb9701dac5 docs: LED stable connection design spec (#4) 2026-08-02 18:15:09 +02:00
eddy
0bf2dcd00f Merge fix/issue-5-hs-s43a-s3r-cleanup: HS-S43A touch migration + S3R cleanup (closes #5)
All checks were successful
CI / firmware (push) Successful in 1m18s
CI / android (push) Successful in 14s
2026-08-02 00:54:12 +02:00
eddy
109088cf52 Merge branch 'fix/issue-5-hs-s43a-s3r-cleanup' 2026-08-02 00:53:03 +02:00
eddy
b192c26ff6 Merge fix/issue-1-ota-ack: OTA confirm protocol, version 15
Some checks failed
CI / firmware (push) Failing after 58s
CI / android (push) Has been skipped
2026-08-02 00:48:32 +02:00
eddy
516a938c7b fix: OTA wait for 0xFF confirm before reboot, version bump to 15, improved logging 2026-08-02 00:48:28 +02:00
eddy
f74a4a5420 fix: Android send 0xFF reboot confirmation after OTA COMPLETE (closes #1)
Some checks failed
CI / firmware (pull_request) Failing after 1m13s
CI / android (pull_request) Has been skipped
2026-08-01 23:14:29 +02:00
eddy
e5bb09e96e docs: purge remaining S3R references from historical docs and handleiding
All checks were successful
CI / firmware (pull_request) Successful in 1m20s
CI / android (pull_request) Successful in 13s
2026-08-01 22:57:40 +02:00