fix: RS485 transparent pass-through + LuCI dark mode fixes#28
Open
weicheng04 wants to merge 3 commits into
Open
fix: RS485 transparent pass-through + LuCI dark mode fixes#28weicheng04 wants to merge 3 commits into
weicheng04 wants to merge 3 commits into
Conversation
Local builds clone OpenWrt 24.10 into openwrt/ for staging_dir/, build_dir/, bin/ artifacts (~100MB+). Without .gitignore, an accidental 'git add .' would commit all of it.
The previous implementation broke transparency in three ways:
- Uplink wrapped bytes in a JSON envelope {"data":"..."}, breaking
binary protocols like Modbus RTU.
- String::from_utf8_lossy() replaced non-UTF-8 bytes with U+FFFD
and .trim() stripped whitespace, corrupting raw frames.
- Downlink rejected any payload not shaped as {"data":"..."},
preventing binary clients from sending raw bytes.
Changes:
- main.rs: publish/write_all raw byte slices directly (no JSON wrap);
replace serde + serde_json deps with hex (log readability only);
fix misleading ConnAck log ("Published" -> "uplink ready on").
- uci-defaults/73_rs485-module: rewrite to populate port1/2/3
per-port sections (was dead code writing flat mqtt.*/serial.*
sections that nothing reads).
- rs485-module.init: drop stale serial.enabled gate, start one
transparent instance per port unless protocol_enabled=1.
- Makefile: update description (drop JSON mention).
SenseCAP app JS injected hardcoded inline colors (background:#fff, color:#333, border:#ccc, etc.) in fixed-height log viewers, chart containers, and a basicstation upload dropzone. Inline styles have priority 1000 and could not be overridden by dark.css selectors, leaving "white holes" when the browser switched to dark mode. Changes: - Add 13 --sensecap-* CSS variables (light defaults + dark overrides) to cascade.less/.css and dark.less/.css, covering: log viewer bg/fg/border, chart bg/border, muted bg, dropzone border/hover-bg, muted/emphasis fg, divider, neutral button bg/hover. - Replace hardcoded colors in 7 JS files with var() references: rs485/log.js, lora/log.js, lora/status/include/19_lora.js, lora/lora-platform/basicstation.js, ups/log.js, ups/ups.js, system/ota.js. - basicstation .sfu-* stylesheet: brand green #8FC320 -> var(--primary). Note: cascade.css / dark.css are less compilation outputs (Easy LESS VS Code plugin); both .less source and .css artifact updated in lockstep since the OpenWrt build does not invoke lessc.
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
Two independent fixes bundled in one PR (no file overlap between them).
1. RS485-MQTT transparent bridge (
rs485-module, 5 files)Problem: The previous implementation was not actually transparent — it broke binary data in three ways:
{"data":"..."}, breaking Modbus RTU and other binary protocols.String::from_utf8_lossy()replaced non-UTF-8 bytes withU+FFFD, and.trim()stripped whitespace from raw frames.{"data":"..."}, preventing binary clients from sending raw bytes.Fix:
main.rs: publish /write_allraw byte slices directly, no JSON wrap.serde+serde_jsondeps withhex(used for log readability only).ConnAcklog ("Published [RS485->MQTT]" was logged on connect but nothing was actually published → changed to "MQTT connected, uplink ready on").uci-defaults/73_rs485-module: rewrite to populateport1/port2/port3per-port sections (previous code wrote flatmqtt.*/serial.*sections that nothing reads).rs485-module.init: drop staleserial.enabledgate, start one transparent instance per port unlessprotocol_enabled=1.2. LuCI dark mode fixes (
luci-theme-sensecap+ 6 luci-app-* JS, 11 files)Problem: SenseCAP app JS injected hardcoded inline colors (
background:#fff,color:#333,border:#ccc, etc.) in fixed-height log viewers, chart containers, and a Basic Station upload dropzone. Inline styles have CSS specificity 1000, sodark.cssselectors could not override them — leaving "white holes" when the browser switched to dark mode.Fix:
--sensecap-*CSS variables (light defaults incascade.css/.less+ dark overrides indark.css/.less): log viewer bg/fg/border, chart bg/border, muted bg, dropzone border/hover-bg, muted/emphasis fg, divider, neutral button bg/hover.var()references:luci-app-rs485/.../rs485/log.jsluci-app-lora/.../lora/log.jsluci-app-lora/.../status/include/19_lora.js(chart container)luci-app-lora/.../lora-platform/basicstation.js(dropzone stylesheet)luci-app-ups/.../ups/log.js,ups/ups.jsluci-app-ota/.../system/ota.js.sfu-*stylesheet: brand green#8FC320→ reusevar(--primary).Note:
cascade.css/dark.cssare LESS compilation outputs (Easy LESS VS Code plugin). Both.lesssource and.cssartifact were updated in lockstep — the OpenWrt Makefile does not invokelessc, so editing.lessalone would have noeffect on the deployed artifact.
Test plan
openwrt-24.10, fullmake -j28)10.0.0.160viaopkg install --force-reinstalllogread | grep RS485-MQTTshows new log line"MQTT connected, uplink ready on"(old build printed"Published [RS485->MQTT]")/www/luci-static/argon/css/{cascade,dark}.csson the containervar(--sensecap-*)references verified present in 6/7 JS files on the containerKnown follow-ups (not in this PR)
luci-app-rs485was skipped during deployment because the container had a newer luci feed version (26.146.42521~e3667f0> our build26.146.05840~441152d). The fix is in the source tree and will take effect after the next build withrefreshed luci feed. As a workaround,
rs485/log.jscan be scp'd directly to/www/luci-static/resources/view/rs485/log.js.chirpstackv4.15.0 main package fails to build due to an upstreamrquickjs-sys 0.9.0+ system clang incompatibility (__gnuc_va_listnot found); unrelated to this PR.luci-theme-sensecapandluci-app-gatewayboth ship/usr/share/ucode/luci/template/themes/argon/sysauth.ut— packaging bug to be reported upstream.