Merge cjkas upstream v3.0.13, bump to v3.2.0#1
Merged
Conversation
The RTW decoder formula encKey - 133 was off by one versus the RTW encoder (which maps command N to encKey N + 132). This caused every non-My RTW command to decode as the wrong button (e.g. Up decoded as My, Down as MyUp). Also adds rawCmd diagnostic field to received frames for protocol debugging.
Fix off-by-one bug in RTW protocol decoder.
…ayload one small unit at a time into a fixed 3KB buffer, so a chunked HTTP response can drain it as the TCP send window allows — no growing cbuf in the async response stream.
Memory-bounded streaming builder for /controller. Produces the JSON p…
…unctionality in browser.
fix the version number in UI. Enable the remember username/password functionality in browser.
# Conflicts: # data-src/appversion # data-src/index.html # data-src/index.js # src/ConfigSettings.h # src/Web.cpp
Marker bump alongside the upstream merge in 4969720, which pulled in 8 commits from https://github.com/cjkas/ESPSomfy-RTS up to upstream v3.0.13. Detailed inventory of what was taken: * 26400c5 Fix off-by-one bug in RTW protocol decoder src/Somfy.cpp:177 — replaces the special-case `cmd = encKey == 133 ? My : (encKey - 133)` with the symmetric inverse of the encoder (`encKey - 132`). The old formula decoded every non-My RTW command one slot too low (Up read as My, Down as MyUp, etc.). src/Somfy.h:192 — adds `uint8_t rawCmd` to somfy_frame_t so the raw command nibble (decoded[1] >> 4) is preserved before any protocol-classification rewriting of `cmd`. src/Somfy.cpp:164-165 — populate rawCmd in decodeFrame. src/Somfy.cpp:4434-4437 — new ESP_LOGI on every valid RX showing ADDR / CMD / RAW_CMD / KEY / PROTO for protocol debugging. src/Somfy.cpp:4451 — emit `rawCmd` in the WebSocket frame event. data-src/index.html:1030 — add "Raw" header span to frame log. data-src/index.js:2956-2957 — render rawCmd as uppercase hex (`0x{N}`) in the new column; blank if older firmware. data-src/main.css:835-839 — size and center the new column. * 5c90715 Merge PR cjkas#24 (the merge of 26400c5 onto upstream main). * f51e90b chore: bump version to v3.0.12 (upstream marker only). * 6365f16 Memory-bounded streaming builder for /controller src/WResp.h:55-60, src/WResp.cpp — new BufferedJsonFormatter subclass of JsonFormatter that writes into a caller-supplied fixed buffer with size tracking (`setBuffer`, `length`). src/Web.cpp:428 — new ControllerChunker class that owns a 3072 byte buffer and produces the /controller JSON one section at a time across calls (HEADER → ROOMS → SHADES → GROUPS → REPEATERS → DONE), so the response can drain over the TCP send window without growing a heap cbuf. src/Web.cpp:699-700 — handleController rewritten to drive the chunker via `request->beginChunkedResponse(...)`. Eliminates the OOM that hit users with many shades/groups. * 15e7dd1 Merge PR cjkas#25 (merge of 6365f16). * 4f7fa73 Login UX data-src/login.html — wraps login in a real <form> and tags the inputs with `autocomplete="username"` / `"current-password"` so password managers and the browser key-fob UI work. data-src/index.js:1260-1262 — on successful login, store the credential via `new PasswordCredential(...)` + `navigator.credentials.store(...)` when the API is available. data-src/index.js / appversion — the appversion fetch is now properly awaited so the version string in the UI no longer flashes the placeholder. * 6f856ff Merge PR cjkas#26 (merge of 4f7fa73). * 3ba27ad chore: bump version to v3.0.13 (upstream marker only). What we kept over upstream: * FW_VERSION / appversion / cache-bust strings → v3.2.0 (this commit). Our fork is intentionally ahead of upstream's v3.0.13. * src/ESPNetwork.cpp SSDP fields → kept the `shailensobhee` branding from 74d126c (upstream didn't touch those lines after our fork point, so no conflict). * Somfy noise-detection thresholds from 305a4b2 — unchanged; upstream only reworded the comment. What was preserved on our side through the merge: * HC-SR04 sensor stack (src/HCSR04.cpp/.h, ConfigSettings.h HCSR04Settings, MQTT/SomfyController wiring, /hcsr04settings + /connecthcsr04 + /discovery routes, Sensors tab with live distance via WebSocket "distance" event). * All HCSR04Settings fields on ConfigSettings remain. Conflict resolutions in the merge commit (4969720): * data-src/appversion, src/ConfigSettings.h, data-src/index.html (×2), data-src/index.js (×2): version-string conflicts — kept ours (now bumped again here to v3.2.0). * src/Web.cpp include block: took both — `#include "HCSR04.h"` (ours) plus `#include <memory>` (upstream needs it for std::make_shared<ControllerChunker> at Web.cpp:699). Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
v3.0.13(RTW decoder fix,/controllerchunked streaming, login UX)v3.2.0acrossappversion,FW_VERSION, and asset cache-bust stringsshailensobheeSSDP brandingUpstream commits taken
26400c5— Fix off-by-one bug in RTW protocol decodersrc/Somfy.cpp:177— replaces special-casecmd = encKey == 133 ? My : (encKey - 133)with the symmetric inverse of the encoder (encKey - 132). Old formula decoded every non-My RTW command one slot too low (Up read as My, Down as MyUp).src/Somfy.h:192— addsuint8_t rawCmdtosomfy_frame_tso the raw command nibble (decoded[1] >> 4) is preserved before any protocol-classification rewriting ofcmd.src/Somfy.cpp:164-165— populaterawCmdindecodeFrame.src/Somfy.cpp:4434-4437— newESP_LOGIon every valid RX showingADDR / CMD / RAW_CMD / KEY / PROTO.src/Somfy.cpp:4451— emitrawCmdin the WebSocket frame event.data-src/index.html:1030— adds Raw header span to the frame log.data-src/index.js:2956-2957— renderrawCmdas uppercase hex (0x{N}); blank if older firmware.data-src/main.css:835-839— sizes and centers the new column.6365f16— Memory-bounded streaming builder for/controllersrc/WResp.h:55-60,src/WResp.cpp— newBufferedJsonFormattersubclass ofJsonFormatterwriting into a caller-supplied fixed buffer.src/Web.cpp:428— newControllerChunkerclass owning a 3072-byte buffer; produces the/controllerJSON one section at a time (HEADER → ROOMS → SHADES → GROUPS → REPEATERS → DONE).src/Web.cpp:699-700—handleControllerrewritten to drive the chunker viarequest->beginChunkedResponse(...). Eliminates the OOM that affected users with many shades/groups.4f7fa73— Login UXdata-src/login.html— wraps login in a real<form>; tags inputs withautocomplete="username"/"current-password"so password managers work.data-src/index.js:1260-1262— on successful login, store the credential vianew PasswordCredential(...)+navigator.credentials.store(...)when the API is available.appversionfetch is now properly awaited so the version string in the UI no longer flashes the placeholder.Marker / merge commits
5c90715— merge of PR Fix off-by-one bug in RTW protocol decoder. cjkas/ESPSomfy-RTS#24 (RTW decoder)f51e90b— chore: bump v3.0.1215e7dd1— merge of PR Memory-bounded streaming builder for /controller. Produces the JSON p… cjkas/ESPSomfy-RTS#25 (controller streaming)6f856ff— merge of PR fix the version number in UI. Enable the remember username/password functionality in browser. cjkas/ESPSomfy-RTS#26 (login UX)3ba27ad— chore: bump v3.0.13What we kept over upstream
FW_VERSION/appversion/ cache-bust strings → v3.2.0 (intentionally ahead of upstream's v3.0.13)src/ESPNetwork.cpp:323-332SSDP fields → kept theshailensobheebranding from74d126c(no conflict — upstream didn't touch those lines after our fork point)305a4b2— unchanged (upstream only reworded the comment)What was preserved on our side through the merge
src/HCSR04.cpp/.h,HCSR04SettingsonConfigSettings, MQTT/SomfyController wiring,/hcsr04settings+/connecthcsr04+/discoveryroutes, Sensors tab with live distance via WebSocketdistanceeventConflict resolutions in merge commit
4969720data-src/appversion,src/ConfigSettings.h,data-src/index.html(×2),data-src/index.js(×2): version-string conflicts — kept ours (re-bumped tov3.2.0here)src/Web.cppinclude block: took both —#include "HCSR04.h"(ours) plus#include <memory>(upstream needs it forstd::make_shared<ControllerChunker>atWeb.cpp:699)Build status
pio run -e esp32c6succeeded — RAM 27.6%, Flash 38.9%Test plan
v3.2.00x{N}hex on Somfy RX/controllerendpoint loads (chunked streaming) with shades populatedPasswordCredentialAPI🤖 Generated with Claude Code