Repository navigation
Restructure: flatten libs into src/, decoder into src/decoder/, UI into ui/ - #1200
Merged
Merged
Conversation
…nto ui/
- lib/AmsDecoder/ → src/decoder/ (kept isolated for testing)
- lib/MeterCommunicators/{IEC6205675,IEC6205621} → src/decoder/ (parser layer)
- Remaining lib/MeterCommunicators/ → src/
- All other flat libs → src/
- MQTT handlers → src/mqtt/
- CloudConnector, ZmartCharge → src/cloud/
- lib/SvelteUi/app → ui/
- lib/SvelteUi/{src,include} → src/
- lib/SvelteUi/json → src/webserver/json/
- Old generate_includes.py scripts renamed with _old suffix (history preserved)
No code changes in this commit — pure renames only.
Co-Authored-By: Claude Sonnet 4.6 <[email protected]>
Decoder headers (Arduino-free):
- Replace #include "Arduino.h" with <stdint.h>/<stddef.h> in all decoder
headers that only needed integer types
- New byteorder.h: portable ntohl/ntohs (#if ESP8266/32 → lwip, else arpa/inet.h)
- New DebugPrint.h: portable Print/Stream interface (#if ARDUINO → real class,
else minimal native implementation)
- DsmrParser.h: use DebugPrint.h instead of Arduino.h
- ntohll.h, Cosem.h: use byteorder.h instead of lwip/def.h
Decoder source fixes:
- Cosem.cpp: replace TimeLib.h/makeTime() with standard <time.h>/mktime()
- GcmParser.cpp: add #else return GCM_DECRYPT_FAILED stub for native builds
- DsmrParser.cpp: replace printf_P/PSTR with printf; use const char* fromHex
overload instead of constructing Arduino String
hexutils:
- Add fromHex(uint8_t*, const char*, uint16_t) overload (no Arduino String needed)
- debugPrint: use printf("%02X") instead of print(v, HEX); guard yield() with
#if defined(ARDUINO)
PassiveMeterCommunicator ODR fix:
- Move AUTO_BAUD_RATES definition from header to .cpp; header now declares extern
- Add AUTO_BAUD_RATES_COUNT constant
Build system:
- platformio.ini: remove all internal lib_deps; add -I flags for src subdirs;
add [env:native] for host-based testing; add build_src_filter for esp8266
to exclude src/cloud/ (mbedtls not available on ESP8266)
- scripts/addversion.py: output to src/generated_version.h
- scripts/generate_includes.py: new unified script replacing the three old ones;
checks custom/ui/dist first, falls back to ui/dist
- CI workflows: update lib/SvelteUi/app → ui
Test infrastructure:
- Delete old broken test stubs (were gitignored, never tracked)
- test/stubs/lwip/def.h: redirect to <arpa/inet.h> for native builds
- test/stubs/Timezone.h: minimal stub for IEC6205675 constructor
- test/test_decoder/test_main.cpp: two real HDLC parser tests as starting point
- .gitignore: remove /test; add generated header paths and /custom/
Customization:
- custom-example/: committed template showing all overridable settings
Co-Authored-By: Claude Sonnet 4.6 <[email protected]>
All source files have been moved to src/, src/decoder/, src/mqtt/, src/cloud/, and ui/ in the previous commits. The lib/ tree is now empty and no longer needed. Co-Authored-By: Claude Sonnet 4.6 <[email protected]>
Co-Authored-By: Claude Sonnet 4.6 <[email protected]>
Arduino.h was transitively pulling in <time.h>, <string.h>, <stdlib.h>,
and <stddef.h>. Now that it is removed from the decoder module, each file
must include what it uses directly:
- DataParser.h: add <stdint.h> and <time.h> (time_t in DataParserContext)
- GbtParser.h, MbusParser.h: add <stddef.h> (NULL in member initializers)
- HdlcParser.cpp: add <string.h> and <stdlib.h> (memcpy, malloc, free)
- GbtParser.cpp: fix remaining lwip/def.h → byteorder.h; add <string.h>
- MbusParser.cpp: add <string.h> and <stdlib.h> (memcpy, malloc)
- IEC6205675.cpp: fix remaining lwip/def.h → byteorder.h
Also recover firmware.html (missed in .json-only git mv) → src/webserver/json/
platformio-user.ini (not committed — gitignored):
- Added ${common.build_flags} to all dev envs so new -I flags are applied
- Removed SvelteUi and CloudConnector from lib_deps (now in src/)
- Added build_src_filter = +<*> -<cloud/> to esp8266dev
All 6 targets now build successfully.
Co-Authored-By: Claude Sonnet 4.6 <[email protected]>
esbuild stripped parens from e(l) → el in 103 places of the minified JS bundle, causing 'ReferenceError: el is not defined' at page load. Patched all 103 occurrences of ,el, → ,e(l), in place since the project cannot rebuild the UI without Node.js available locally.
Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>
build.yml ran a bare `pio run` which also built [env:native] (a unity test env) as firmware, failing on EEPROM.h. Build the 6 device envs explicitly, matching the PR matrix and release.yml. The native decoder test runs via `pio test -e native` and is finished in a follow-up PR. Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>
gskjold
force-pushed
the
restructure_4_first_run
branch
from
June 12, 2026 09:45
07b3b89 to
3ca07cf
Compare
🔧 PR Build ArtifactsVersion: All environments built successfully. Download the zip files:
|
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.
Project restructure that flattens the
lib/*PlatformIO libraries into a singlesrc/tree, isolates the Arduino-free decoder intosrc/decoder/, and moves the Svelte app fromlib/SvelteUi/app/toui/. This is primarily a move + build-system change; behavioral changes are limited to a few small commits noted below.Highlights
lib/*/{src,include}→src/(flat), MQTT handlers →src/mqtt/, cloud →src/cloud/, web/json →src/webserver/json/.src/decoder/, made Arduino-free so it compiles on native (pio test -e native). Portable shims forntohl/ntohs,Print/Stream, etc.ui/;ui/distis built at compile time (no longer committed) and embedded via the unifiedscripts/generate_includes.py.build.yml/pr-build-env.yml/release-deploy-env.ymlruncd ui && npm ci && npm run buildbefore the firmware build.Merge / reconciliation with current main
Brought fully up to date with
main(which since gained #1136, #1199, #1175, #1161, #1179):src/automatically (zero C++ conflicts).ui/(build config was identical). UI rebuilt with 0 npm audit vulnerabilities.Verification
esp32build: 70.9% flash, 14.5% RAM.esp8266build: 97.3% flash (within budget), 53.6% RAM.Deferred to follow-up PRs (kept out to keep this a focused structural change)
The branch's mixed-in features will land as separate PRs on the new layout, each with its own release-note line:
esp32s2psramdev targetcustom/overlay)