Commit graph

33 commits

Author SHA1 Message Date
cjkas
b6ed24f5bb fix: hook the log lock into log_printfv
The Arduino core already links with --wrap=log_printf for the ESP
Insights hook in libesp_diagnostics, so defining __wrap_log_printf
failed to link with a duplicate definition. That hook prints through
log_printfv, so wrap that instead and take the lock there.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-11 22:23:11 +02:00
cjkas
6b19d24eb4 fix: print each log line whole
The Arduino core's log_printf() has its UART lock commented out and
writes with ets_printf(), so lines logged at the same time from
async_tcp and loop() came out interleaved character by character. It
also formats short lines into one static buffer shared by every task.

Wrap log_printf at link time and hold a mutex around the core's
log_printfv(). It never blocks before the scheduler runs, in an ISR or
in a critical section, and waits at most 50ms before printing anyway.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-11 20:50:41 +02:00
cjkas
3a8736f4d4 refactor: share the shade travel maths in ShadeMotion.cpp
checkMovement worked out the position four times, nearly copy-pasted,
for lift down, lift up, tilt down and tilt up.  All four now call
travelPosition(), which keeps the same arithmetic, including how the
elapsed time wraps with millis().  Tilt up with no tilt time still
stops the tilt direction in the caller.

transformPosition and transformCommand keep their behaviour through
the new displayPosition() and flipCommand() helpers.  The native env
builds ShadeMotion.cpp so all of this can be unit tested on the PC.
No behaviour change.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-11 13:37:48 +02:00
cjkas
d723c1024d refactor: move JsonFormatter into JsonFormatter.cpp
JsonFormatter and BufferedJsonFormatter move verbatim out of
WResp.cpp/WResp.h, which now include JsonFormatter.h.  They don't need
the web server, so on their own they can be unit tested on the PC; the
native env builds the new file.  AsyncJsonResp and JsonSockEvent stay
in WResp.  No behaviour change.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-11 13:29:30 +02:00
cjkas
3774aba45c test: cover the frame codec and command names
Builds SomfyFrame.cpp in the native env, with a minimal String and
no-op ESP_LOGx in the stubs, and tests:

- a fixed 56-bit frame, byte for byte, so what goes on air is pinned
- encode/decode round trips for 56-bit, 80-bit (repeats, Favorite,
  Stop, steps, Toggle), RTW and RTV frames
- rejection of bad checksums, addresses, rolling codes, keys and
  80-bit parity
- repeat/synonym tracking in copy()
- parsing and naming of commands

The command-name round trip fails: names the firmware reports, such as
"Step Up" and "My+Up", parse back to the wrong command.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-11 13:20:39 +02:00
cjkas
52c67b12f8 test: add native Unity env with Utils tests
Adds an [env:native] for host-side unit tests (pio test -e native) with
a minimal Arduino.h stub, and covers the Utils helpers: _trim,
toBoolean, SETCHARPROP, sortArray and the Timestamp conversions.

The firmware envs now extend a shared [esp32] section instead of [env]
so the native env doesn't inherit the Arduino framework, the ESP32
libraries or the build scripts.

The half-hour calcTZOffset cases fail: +05:30 comes back as 2300.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-11 12:54:39 +02:00
cjkas
9a9afa5e86 fix: move radio TX to a dedicated task so HA WebSocket stays connected
Web command handlers ran on the async_tcp task and blocked up to 3s
waiting for loop() to bit-bang radio frames. async_tcp also services the
WebSocket on port 8080, so pongs stalled and Home Assistant
(ping_timeout=15) disconnected when several covers were commanded.

- Add a radio_tx FreeRTOS task with a job queue; sendFrame/repeatFrame
  and repeater frames enqueue instead of transmitting inline.
- Serialize CC1101 access with a recursive mutex (TX task, apply, end,
  frequency scan, RSSI read).
- Make Web::queueCommand fire-and-forget; drop the done semaphore.
- Route /setMyPosition and /unpairShade through the command queue.
- Clamp repeats to MAX_TX_REPEATS (40).
- Pin AsyncTCP to core 0 on dual-core targets.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-10 20:13:31 +02:00
Shailen Sobhee
25f6195bbc build pass for esp32c6, added dependencies.lock 2026-04-05 21:06:48 +02:00
Shailen Sobhee
7524ce1d60 updated platformio.ini + add -D CHIP_ESP32C6 2026-04-05 20:19:23 +02:00
Shailen Sobhee
3e60dfeb21 updated platformio.ini to pass build tests 2026-04-05 20:08:53 +02:00
Shailen Sobhee
3d642509a5 updated platformio.ini to pass build tests 2026-04-05 20:02:59 +02:00
Shailen Sobhee
51109a16c5 updated gitignore file 2026-04-05 19:55:09 +02:00
Shailen Sobhee
3271327208 merge conflicts from 05.04 2026-04-05 19:08:01 +02:00
cjkas
3a3ce2ae6a Update platform to espressif32 @ 6.13.0. SSID scan interval increased to 10 minutes to offload ESP. 2026-04-04 19:58:38 +02:00
Shailen Sobhee
fe4aa83ed2 updated code logic to pic FW/App version from appversion instead of hard-coding in js/html/cpp files 2026-03-30 22:41:08 +02:00
Shailen Sobhee
bb61a1703d fixed esp32-c6 platform detection issue 2026-03-30 21:04:59 +02:00
Shailen Sobhee
ff1bb80adf huge app due to partition size issues 2026-03-30 14:52:40 +02:00
cjkas
72bfd26443 Added c6 support 2026-03-29 21:53:57 +02:00
cjkas
aa81b95bee Added OTA partition 1.5MB per app. Fixed s3 wrong partition for spiffs 2026-03-29 21:10:02 +02:00
cjkas
76bb0627af ci builds now all variants 2026-03-28 08:47:42 +01:00
cjkas
233d6abe62 Fix esp32c3 build 2026-03-27 20:21:56 +01:00
cjkas
4fd95a055f Improve release build suport for multiple esp32 chips 2026-03-27 08:49:33 +01:00
cjkas
9c17aa4642 added c3,s3 builds 2026-03-27 08:24:08 +01:00
cjkas
a220b9ecc2 replace Serial.print with logger 2026-03-24 20:28:06 +01:00
cjkas
f38dcea1f1 add archive for last 10 builds 2026-03-24 20:08:17 +01:00
cjkas
07e2e45333 update CI build scripts 2026-03-24 19:35:45 +01:00
cjkas
ed8137e686 replace sync sockets 2026-03-24 19:23:35 +01:00
cjkas
8c51e1a518 up 2026-03-24 19:23:35 +01:00
cjkas
9ccc2d4ff5 async server introduction 2026-03-24 19:22:57 +01:00
cjkas
88fdfa577a improve logging 2026-03-17 14:27:57 +01:00
cjkas
2509030c49 backup with RAM 2026-03-13 18:40:34 +01:00
cjkas
96d66c1b45 add gzip support 2026-03-12 13:59:17 +01:00
cjkas
a64b648f7a init 2026-03-10 20:23:48 +01:00