Skip to content

shinto integration#1

Merged
zerotonin merged 6 commits into
masterfrom
shinto-integration
May 18, 2026
Merged

shinto integration#1
zerotonin merged 6 commits into
masterfrom
shinto-integration

Conversation

@zerotonin
Copy link
Copy Markdown
Owner

  • feat(constants): add shinto command block, ShintoMode, voltage calibration
  • feat(shinto): add ShintoRig + ShintoExpParameters
  • feat(testing): add ShintoFirmwareSimulator (pty mirror of shinto firmware)
  • test(shinto): 19 tests covering rig vocabulary, frame parsing, end-to-end
  • feat(api): re-export ShintoRig, ShintoMode, ShintoExpParameters
  • docs(firmware): point at zerotonin/shinto as second PARROTard firmware

bgeurten added 6 commits May 18, 2026 13:51
…ation

Extends COMMAND_IDS with 25 new entries covering the shinto firmware
subsystems:

  13374xxx — shock (state, voltage, trigger, calibration dwell)
  13375xxx — mode selection (free / stim-train / calibration / pattern)
  13376xxx — time-table upload
  13377xxx — stim-train parameters
  13378xxx — pattern (peak-end rule) parameters

Adds ShintoMode IntEnum with SHINTO_MODE_LABELS, the linear
voltage<->state calibration constants
(V = 150.52 - 0.77805 * state, matching shinto's volt2state),
and the RAM ceilings the firmware enforces
(SHINTO_TIME_TABLE_MAX_ROWS=240, MAX_PATTERN_LEN=16,
MAX_TEMPLATE_LEN=16).

13370xxx (write-out & clock), 13372xxx (experiment flow), and the
1337 comm-test ping remain shared with PARROTard/Hüpfburg.
ShintoRig(ArduinoSerial) speaks the shinto firmware vocabulary:

  rig.set_mode(ShintoMode.PATTERN)
  rig.set_voltage(45.0)
  rig.set_state(80)
  rig.trigger(on=True)
  rig.set_calib_dwell(4.0)
  rig.set_stim_train_params(pre, pulse, ipi, iti, pattern1, pattern2)
  rig.set_pattern_params(pre, step, ipi, iti, rep, template1, template2)
  rig.upload_time_table(times_s, triggers, volts)
  rig.start_experiment() / abort_experiment()
  rig.get_exp_parameters()  ->  ShintoExpParameters

Intlist parameters (state patterns, templates) and time-table
upload use a >>v0,v1,...<<\n frame.  ShintoExpParameters carries
the eleven fields the firmware emits in its >>...<< reply and
exposes a mode_label property using SHINTO_MODE_LABELS.

Companion firmware: https://github.com/zerotonin/shinto
…ware)

Mirrors shinto's SerialCommunication.ino closely enough that
ShintoRig can drive it end-to-end via a real serial pty, with no
Arduino hardware.  Reuses the same threading / pty / regex idiom
as the Hüpfburg FirmwareSimulator: own _ShintoState dataclass for
the firmware globals, _read_follow_int / _read_follow_float /
_read_follow_frame helpers, _dispatch covering all 25 new command
IDs plus the shared 13370xxx / 13372xxx ones, and _emit_telemetry
/ _emit_parameter_frame matching the firmware's > / >> frame
formats.

emit_end_sentinel() lets tests assert the host-side detection of
the "end" sentinel without simulating a full timeline.
…-end

Unit tests against MockSerial verify:
  - voltage <-> state round trip and clamping
  - every command method emits the expected (id, follow) pair
  - set_state and upload_time_table input validation
  - parse_exp_parameters round-trip on a real frame

Integration tests against ShintoFirmwareSimulator over a real pty
verify:
  - 1337 / "50 1337" comm-test handshake
  - set_mode updates simulator.state.mode
  - set_voltage lands on the correct pin_state via volt2state
  - set_pattern_params round-trips timing + templates
  - upload_time_table populates simulator.state.time_table
  - get_exp_parameters reads the >>...<< parameter frame back

48 / 48 cuewire tests pass locally.
Top-level cuewire package now exports:

    from cuewire import ShintoRig, ShintoMode, ShintoExpParameters

mirroring how HuepfburgRig is exposed.  cuewire.testing also
re-exports ShintoFirmwareSimulator alongside FirmwareSimulator.
Adds an "Other PARROTard-compatible firmware" section to
firmware/README.md so anyone landing on the cuewire firmware docs
sees the shinto sketch and the subsystem split between the two:
Hüpfburg owns 13371xxx (LED) and 13373xxx (strip); shinto owns
13374xxx (shock), 13375xxx (mode), 13376xxx (timetable),
13377xxx (stim-train), 13378xxx (pattern).

13370xxx / 13372xxx and the 1337 ping remain shared.
@zerotonin zerotonin merged commit 4018987 into master May 18, 2026
12 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