Skip to content

feat(maimu): add an Off time to the Maimu node for duty-cycled pulses - #201

Merged
gbradham merged 1 commit into
mainfrom
feat/maimu-node-duty-cycle
Oct 20, 2026
Merged

gbradham merged 1 commit into
mainfrom
feat/maimu-node-duty-cycle

Conversation

@gbradham

@gbradham gbradham commented Oct 20, 2026 •

Copy link
Copy Markdown
Member

Summary

The Maimu node could only run a symmetric train: <period_ms>,<duration_s> makes the on time equal to the off time. A 20 Hz train of 10 ms pulses (10 ms on / 40 ms off) needs those two times to differ.

  • Period is relabelled On (ms). It is still saved as period_ms, so existing .glider files open and behave unchanged.
  • Off (ms) is a new field. Its default of 0 means "same as On", which is the original toggle and sends the original pulse command.
  • Any other Off value sends p<on_ms>,<off_ms>,<duration_s> (e.g. p10,40,10) through the device's existing write action. device.py is untouched.

Firmware

The p command needs Maimu firmware 0.1.0, which adds it alongside the original command. Older firmware runs atoi("p10"), gets 0 and ignores the command, so the light stays off. Without the prefix, 10,40,10 would be misread as a 10 ms toggle for 40 s.

Test plan

  • pytest plugins/glider-maimu/tests passes (86 tests, 3 new): Off 0 keeps the pulse call, On 10 / Off 40 sends write("p10", 40, 10), Off saves and reloads, and an old file with no off_ms loads as symmetric
  • ruff check and black --check are clean
  • Confirm 10 ms on / 40 ms off on a photodiode or scope with a unit running firmware 0.1.0

The node's Period is relabelled On (ms), still saved as period_ms so
existing files open unchanged, and gains Off (ms). Off 0 keeps the
original symmetric toggle; any other value sends "p<on>,<off>,<s>"
through the device's write action, e.g. On 10 / Off 40 = 20 Hz with
10 ms pulses. Needs Maimu firmware 0.1.0+; older firmware ignores the
'p' command rather than misreading it.
@gbradham
gbradham merged commit 27d19d7 into main Oct 20, 2026
4 checks passed
@gbradham
gbradham deleted the feat/maimu-node-duty-cycle branch October 20, 2026 19:24
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