Skip to content

v0.8.2: config files on the drive (#52) - #57

Merged
Worldwave merged 10 commits into
mainfrom
issue52-cnfg
Oct 16, 2026
Merged

Worldwave merged 10 commits into
mainfrom
issue52-cnfg

Conversation

@Worldwave

Copy link
Copy Markdown
Owner

Closes #52.

What's in it

  • Config files on Wakes' drive. WAKES/CNFG/ holds engines.cnfg, midi.cnfg, audio.cnfg and logs.cnfg (ini format, commented). Wakes reads them at every ON. A missing file is written with the built-in defaults, so deleting one resets it. A line Wakes can't read keeps its default and is named in the log. config/ in the repo holds the built-in defaults, and the build checks them (config/README.md).
  • Engine stack from engines.cnfg: 24 slots, 16 by default (the original Plaits engines). Five engines moved out of the default stack: VA-VCF, phase distortion, wave terrain, string machine and chiptune. Empty slots are skipped. ROTC returns to the first filled slot. The file is all or nothing: any problem means the built-in stack. Engines outside the stack still load from a preset.
  • MIDI script and USB audio settings from the drive. CC rule: your line takes a CC from the default that had it. If two of your lines give the same CC, the first keeps it. CC 33–63 and the reserved CCs are refused.
  • New MIDI defaults: omni, legato auto with a t9 glide, velocity and aftertouch unbound.
  • The log on the drive:
    • WAKES/LOGS/NNNN.logs, one file per ON, and the last 5 are kept.
    • Flushed every 5 s and capped at 8 MB. STANDBY is not logged.
    • The categories come from logs.cnfg (only performance is on by default).
    • Lines the previous ON still owed (its closing lines, a backstop's tail) go to that ON's own file.
  • Fixes found in hardware testing:
    • An ON with logging off leaked its lines into the next ON's file.
    • A single-sample fader spike stopped a shutdown hold. A fader now has to move on 2 scans in a row. The 30 s backstop is untouched (rule 5a).
  • The manual for v0.8.2 and docs/MIDI.md are updated.

Checks

  • All 11 host suites pass. New coverage:
    • the config readers
    • the log ring's file cursor and STANDBY boundary
    • the shipped MIDI defaults as they are
  • Built locally: wakes-sp1 509 944 B, fresh 514 836 B, fallback 86 992 B. 0 warnings, link at 0x20000, check_image passes.
  • Hardware: step 1 (logs, engines, the logging-off and fader fixes) was tested on the device. The rest of the test steps go to beta testers.

🤖 Generated with Claude Code

Worldwave and others added 10 commits October 13, 2026 22:30
…he drive

Config files (.cnfg, ini, first line names the format) live in WAKES/CNFG/ on the
drive and are read at every ON, before PRST. config/ in the repo is the built-in
default every image carries; the build fails on a bad default. wakes-sp1-fresh
writes both files to the drive as templates.

- logs.cnfg: enabled + five categories (performance, controls, midi, usb,
  storage). Line by line: a bad line keeps its default and the log names it;
  the same key twice -> the first wins.
- engines.cnfg (replaces engines.csv + engines-instructions.md): slot = engine,
  slots 1-24, and the file is the whole stack. The default stack is the 16
  original Plaits engines; VA-VCF, phase-distortion, wave-terrain,
  string-machine and chiptune move out (17-24 empty for users). Engine names
  are hyphenated, and matching uses letters and digits only, ignoring case,
  so old PRST spellings still load. On the device it is all or nothing:
  missing, unreadable or any problem -> the built-in stack, every problem
  logged. The stack is in RAM (two copies, one atomic flip); ROTC and the start
  go to the first filled slot of the stack in use.
- The log: sp1_logbuf now runs on sp1_logring, a ring with a file cursor and a
  STANDBY gap. With logging on, the card stays on and mounted through ON; the
  store thread appends category-filtered lines every 5 s and syncs. One file per
  session, WAKES/LOGS/NNNN.LOGS (session mod 10000; the number keeps counting
  in WAKES/LOGS/SESSION), the last 5 kept, 8 MB cap. A soft reset continues
  the same session. At shutdown the PRST save goes first, then the last flush,
  inside the same 4 s; the 30 s backstop never waits (rule 5a).
- RAM log 96 -> 16 KB in storage builds (~80 KB freed); the fallback keeps 96.
- docs/SAFETY.md rule 9: nothing configurable reaches the power path.
- New host suite cnfgtest; uitest 21 and prsttest cover the stack, ROTC and
  the old names.

Untested on hardware.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…a shutdown

Two findings from Adara's hardware test (2026-10-15, 0006/0007.LOGS):

- An ON with logs.cnfg `enabled = off` skipped the RAM log only up to the
  moment it read the file. Its later lines stayed queued and were written into
  the next ON's log (0007.LOGS opened with them). sp1_logring now has a
  `discard` state: skip drops the whole ON, the STANDBY pause drops the rest,
  and sp1_logbuf_file_keep() ends it when logging is on. A cnfgtest case
  reproduces the log.
- One 8 ms reading 82 counts off on F4 (parked at 0, untouched) stopped a 3 s
  shutdown. 4382 logged fader snapshots show no sign of a worn F4: at the
  bottom of travel it is the quietest of the four. A fader now has to stay
  >= 80 counts from the mark on 2 valid scans in a row (SP1_TOUCH_SCANS), the
  buttons' own debounce. Real moves suppress 8 ms later; a lone spike is
  ignored. This only gates the animation; the 30 s backstop is untouched.

Also: logs.cnfg says ~12 hours per 8 MB file (measured ~190 B/s), not 18.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…written

config/audio.ini and config/midi.ini become config/audio.cnfg and
config/midi.cnfg (first line `; Format: ini`, text rewritten for editing on the
drive). They stay the built-in defaults; the build still fails on a bad default.
Wakes reads WAKES/CNFG/audio.cnfg and midi.cnfg at every ON and main applies
them before the MIDI reset and audio start.

- Runtime settings: struct sp1_audio_cfg / sp1_midi_cfg (sp1_cnfg.h), one
  generated initializer each (SP1_AUDIO_CFG_DEFAULTS, SP1_MIDI_CFG_DEFAULTS).
  Every former SP1_MIDI_* / SP1_AUDIO_USB_* use reads the live copy
  (sp1_midi_set_config, sp1_audio_set_config).
- The CC rule (Adara): a user line takes a default's CC (a note in the log);
  two user lines on one CC -> the first keeps it, the later gets none (a
  problem); the sustain line counts; reserved CCs and 33-63 are refused.
  `velocity = none` removes a binding.
- Adara's ADD: a .cnfg missing from WAKES/CNFG is written with its built-in
  text by every image, after PRST loads. An existing file is never touched;
  deleting one resets it at the next ON. Fresh relies on the same path.
- CNFG_READ_MAX 16 -> 64 KB (engines.cnfg was already ~16 KB).
- Tests: cnfgtest sections for both readers and the CC rule; miditest
  switches the script at runtime.

Image 513 268 B (+44 KB: the readers and the four files' text), 0 warnings.
Untested on hardware.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
#52: the config files on the drive (WAKES/CNFG/: logs, engines, audio, midi,
read at every ON, written with their defaults when missing), the log on the
drive (WAKES/LOGS/NNNN.LOGS, last 5 sessions), the 16-engine default stack
with hyphenated engine names, ROTC to the first filled slot, and the two
fixes from the 2026-10-15 hardware test.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Defaults (Adara): midi.cnfg ships channel omni, legato auto, portamento t9,
velocity and aftertouch none, with her rewritten text; logs.cnfg ships with
only `performance` on; audio.cnfg text revised. config/README.md says these
are the built-in defaults, not a device's settings.

Logging: every ON starts a new session and file, including STANDBY then ON
while plugged in. Before the new file opens, the previous session's file gets
what it still owed (lines from before the last STANDBY: closing lines, a 30 s
backstop's tail, a crash kept across a soft reset) via
sp1_logring_take_before_standby. Log files are named NNNN.logs.

Reader: `velocity/aftertouch = none` now reads as depth 0, as gen_midi.py
writes it (no audible change; the template read-back differed).

Host tests: hostbuild.sh forces channel 1 / portamento 0 / velocity level
for miditest's exact maths; miditest_pickup §S checks the shipped defaults
as they are (incl. legato auto, untested before); cnfgtest no longer assumes
all log categories on, and checks the before-STANDBY take. All 11 suites pass.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@Worldwave
Worldwave merged commit ff371e0 into main Oct 16, 2026
4 checks passed
@Worldwave
Worldwave deleted the issue52-cnfg branch October 16, 2026 17:47
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.

FEATURE: Config files move to Wakes' storage

1 participant