Skip to content

refactor(#270): E4 band 3a -- fram, settings and rtc leave src.ino as units - #275

Merged
Strycher merged 1 commit into
mainfrom
fc/212-e4-storage
Sep 7, 2026
Merged

Strycher merged 1 commit into
mainfrom
fc/212-e4-storage

Conversation

@Strycher

@Strycher Strycher commented Sep 7, 2026

Copy link
Copy Markdown
Owner

E4 band 3a, task #270 under #264 and Epic #212. Opened autonomously under the owner's standing grant of 2026-09-07.

What moved

Three units, each taking its state with it, each including the previous:

unit owns functions
fram fram, framHeader, framAvailable; FRAMHeader, FRAMBatteryEntry, FRAMSettings; the 17 FRAM_* layout defines framReadHeader, framWriteHeader, framFormat, initFRAM
settings the nine user and display settings, tzPresets / TZPreset, the four timeout preset tables and their counts, settingsLoadedFromSD framSettingsChecksum (static), saveSettingsToFRAM, loadSettingsFromFRAM, applyTimezone, mktimeUTC, formatTimeStr, loadSettings, saveSettings, factoryReset, findTimeoutIndex
rtc rtc, rtcAvailable initRTC, syncRTCFromSystemTime

Twelve of the 34 remaining cut-set variables leave src.ino (7,986 → 7,483 lines). FRAM_CS and TFT_BL join fc_config.h.

Calls made under the grant — please review

  1. Band 3 was split into E4-5a (band 3): fram, settings and rtc units #270–E4-5e (band 3): the web unit, last #274 by dependency layer, with the web unit last rather than first; the reasoning is in E4-5a (band 3): fram, settings and rtc units #270 and in §10 of the inventory. Composition is yours to change.
  2. The timeout preset tables and findTimeoutIndex went to settings, not display: they define what the sleep settings may be, and the unit that persists them owns them.
  3. framFlushToSD stays in src.ino until the weather child (E4-5c (band 3): weather and geocache units #272); it flushes two buffers whose domains are not yet published.

Harness

Five fixes to scripts/extract_unit.py, each found by this band: bare include names wrapped; --header-lines emitted before the externs that need its types; multi-line table initialisers carried whole; forward extern declarations of published variables dropped; orphaned introductory comments swept (this also removed the two band 2 left behind).

Proof

scripts/verify_extraction.py PASS; full output in docs/god-object-inventory.md §10:

symbols   584 -> 585 (fram.cpp's static initialiser, 41 bytes; src.ino's shrank 34)
          38 relocated; 2 linkage changes, both declared; removed none
deltas    26 symbols, net +22, all attributed; unexplained none
sections  .flash.text +64 = deltas +22 + initialiser +41 + alignment +1
          .flash.rodata +56, .dram0.bss +16 with no data symbol changing size
Flash     1,856,026 -> 1,856,146   RAM 103,232 -> 103,248
Both toolchains build. 58 tests pass. Not flashed.

… units

Three units, each taking its state with it, each including the previous:

  src/fram.{h,cpp}      fram, framHeader, framAvailable; FRAMHeader,
                        FRAMBatteryEntry, FRAMSettings; the 17 FRAM_* layout
                        defines; framReadHeader, framWriteHeader, framFormat,
                        initFRAM
  src/settings.{h,cpp}  the nine user/display settings, tzPresets and TZPreset,
                        the four timeout preset tables with their counts,
                        settingsLoadedFromSD; framSettingsChecksum (static),
                        saveSettingsToFRAM, loadSettingsFromFRAM, applyTimezone,
                        mktimeUTC, formatTimeStr, loadSettings, saveSettings,
                        factoryReset, findTimeoutIndex
  src/rtc.{h,cpp}       rtc, rtcAvailable; initRTC, syncRTCFromSystemTime
  src/fc_config.h       + FRAM_CS, TFT_BL (fram.cpp and factoryReset need them)

Twelve of the 34 cut-set variables leave src.ino. framFlushToSD stays: it
flushes the battery and weather buffers, two domains not yet published.

Harness (scripts/extract_unit.py), five fixes found by this band: bare include
names are wrapped; --header-lines is emitted before the externs that need its
types; a multi-line table initialiser is carried whole; forward extern
declarations of published variables are dropped; the comment that introduced a
removed declaration is swept when only a blank follows it.

Verified by scripts/verify_extraction.py, PASS: 584 -> 585 symbols (fram.cpp's
static initialiser, 41 bytes; src.ino's shrank 34), 38 relocated, 2 linkage
changes both declared, 26 size deltas net +22 all attributed, unexplained none.
.flash.text +64 = deltas +22, initialiser +41, alignment +1; .flash.rodata +56
and .dram0.bss +16 with no data symbol changing size (packing across three new
objects). Flash 1,856,026 -> 1,856,146. RAM 103,232 -> 103,248. src.ino
7,986 -> 7,483. Both toolchains build. 58 tests pass. Record: section 10 of
docs/god-object-inventory.md.
@Strycher

Strycher commented Sep 7, 2026

Copy link
Copy Markdown
Owner Author

Merged autonomously under the owner's standing grant of 2026-09-07.

Gate: compile-gate green. Proof: scripts/verify_extraction.py PASS — 584 -> 585 symbols (fram.cpp's static initialiser), 38 relocated, 2 linkage changes declared, 26 size deltas attributed, unexplained none; every section delta traced. Both toolchains build; 58 tests pass. Not flashed.

Set aside for the owner's review, listed in the PR body: the band-3 split into #270–#274 with web last, the timeout tables living in settings, and framFlushToSD staying until #272.

@Strycher
Strycher merged commit 43e569a into main Sep 7, 2026
4 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant