Public: anyone can read this; the crew can change it.
Migrated from github.com/Trevato/SO-ARM100
A dosing loop set to auto doses by itself once a minute, inside the same limits, and tests prove it never doses when it must not #621
Merged 37d 22h ago
A loop set to auto now doses by itself: the relay runs Doser.tick every doseEveryMs (60 s by default) and clears that timer on close. I ran the doser, care-dosing, relay and sensors-relay tests; they pass.
-
Reviews
ApprovedSmall, on-direction change. The relay now ticks Doser.tick every 60 s, unref'd and cleared on close. A failing tick is logged and cannot crash the relay. Every limit goes through the same dose() path as the owner's tap. Tests cover auto, suggest/off, halted, same-reading and mixing-wait cases, plus the timer start and stop. No page, terminal or auth surface changed, so the doors are the same. Using
ruleas the cause rather than a newautois a fair call, and the README says so. Two things I would do next: (1) add a test that isolates the new halt-on-tick branch, for example a tick on an out-of-bounds reading with no earlier dose, so it fails without that line; (2) show on /care and in/care dosingwhen the last automatic tick ran, so the owner can see the timer is alive. -
Checks
shipped merged
-
History
- Dosing: the relay ticks the doser every doseEveryMs (60 s), so auto doses unattended inside the limits; tick now raises the stop on a bad or unmoved reading b63603c
- so101 serve boots with the arm unplugged: /status says "arm: not connected", cameras and the grow box keep serving (#617) 71dc2a8
- Arm server: /grow/dosing (and /grow/light, /grow/pump) answer anyone who reaches the arm's port (#612) 21cb2b4
- Dosing: real peristaltic and top-off pump drivers with ml/s calibration, replacing the fake pumps (#610) fa0051d
- Dosing: pH/EC probes via ADS1115 with guided calibration and monthly reminder (#609) f8a7543
- Dosing: temperature and level sensor drivers (DS18B20, SHT31/BME280, float switches) as Reading sources (#608) d2bae2e
- Grow care: a plant profile (spinach first), reminders from it, a log book, and metrics with target bands; manual now, sensors later (#598) 13887dd
- Grow stills at 1920×1080, cropped to the camera's region and colour-corrected (split from #584) (#603) d2bd69c
- so101 server: hang up after answering 413 at the body cap (#602) f5a7213
- Grow box: a still every 10 min, a scrubbable timelapse, a grow log and a canopy chart (#601) d623239
- Grow light schedule: a switch driver (smart plug, GPIO relay, or uhubctl only when it switches the light alone) with a photoperiod that runs on the Pi (#599) 0ea35e6
- Grow card: "Camera can't see the plants" hint when the camera's region is mostly blown out or black (split from #584) (#597) 315c1ae
- Pump: an interval-cycle schedule on the Switch interface (with #585) (#596) 82337a2
- The workshop: one Pi, several stations (the arm and the grow box), each with cameras and controls; works with the arm unplugged (#592) 37b3b00
- The identity line on /story and /admin/data (#594) 568b0ea
- Grow cameras: a saved camera profile per Pi camera, re-applied at every start, and a Tune panel with the box drawn once and colour correction under grow light (#591) 17c46ef
- Sign out, and every page shows who you are, even when the arm is off (#587) 1873f3c
- Closing the arm locks its owner out: keep sign-in and /admin working while closed, an Open now button on the resting card, and so101 open/close (#579) fba1312
- setup: find LeRobot calibration in its nested folders (calibration/robots/so_follower/*.json) (#577) 6da7fb9
- `so101 setup` finds both arms, asks you to wiggle the leader, reuses existing calibration, then starts teleop (#575) f44d21f
A loop set to auto now doses by itself: the relay runs Doser.tick every doseEveryMs (60 s by default) and clears that timer on close. I ran the doser, care-dosing, relay and sensors-relay tests; they pass. tsc reports no errors in relay.ts or doser.ts, but it still fails elsewhere (the bun type definitions weren't found). I didn't run the full check.
- Wiring: a failing tick is logged and never crashes the relay. The relay test uses a short
doseEveryMswith a fake doser. It checks that ticks happen and stop afterclose(). - Fix to
tick:ticknever raised the stop. The halt on an out-of-bounds or unmoved reading only fired through a dose attempt, so an unattended pH loop could have kept dosing against a dead probe.ticknow makes one dose attempt when a loop's suggestion says "stopped", so the halt holds on the timer path as it does on the owner's tap. The attempt adds nothing. - Tests in
doser.test.ts:autodoses once on a tick and logs it.suggestandoffnever move a pump.- A halted doser never doses.
- Two ticks on the same reading give one dose.
- A tick inside the mixing wait does not dose.
- README: the dosing section now says
autopumps unattended inside the per-dose and per-day limits, and that loops still ship insuggest.
The issue asks for the log cause auto, but the log book's causes are rule, crew and owner, and the automatic dose is logged as rule. I kept that rather than add a new cause across the log and page. The README and tests say rule. Tell me if you want auto as a new cause.
🤖 Generated with Claude Code
A loop set to
autonow doses by itself: the relay runsDoser.tickeverydoseEveryMs(60 s by default) and clears that timer on close. I ran the doser, care-dosing, relay and sensors-relay tests; they pass.tscreports no errors inrelay.tsordoser.ts, but it still fails elsewhere (thebuntype definitions weren't found). I didn't run the full check.doseEveryMswith a fake doser. It checks that ticks happen and stop afterclose().tick:ticknever raised the stop. The halt on an out-of-bounds or unmoved reading only fired through a dose attempt, so an unattended pH loop could have kept dosing against a dead probe.ticknow makes one dose attempt when a loop's suggestion says "stopped", so the halt holds on the timer path as it does on the owner's tap. The attempt adds nothing.doser.test.ts:autodoses once on a tick and logs it.suggestandoffnever move a pump.autopumps unattended inside the per-dose and per-day limits, and that loops still ship insuggest.The issue asks for the log cause
auto, but the log book's causes arerule,crewandowner, and the automatic dose is logged asrule. I kept that rather than add a new cause across the log and page. The README and tests sayrule. Tell me if you wantautoas a new cause.🤖 Generated with Claude Code
Closes #619