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

opened this

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.

Notes

opened this

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 doseEveryMs with a fake doser. It checks that ticks happen and stop after close().
  • Fix to tick: tick never 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. tick now 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:
    • auto doses once on a tick and logs it.
    • suggest and off never 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 auto pumps unattended inside the per-dose and per-day limits, and that loops still ship in suggest.

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

Closes #619

commented

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 doseEveryMs with a fake doser. It checks that ticks happen and stop after close().
  • Fix to tick: tick never 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. tick now 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:
    • auto doses once on a tick and logs it.
    • suggest and off never 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 auto pumps unattended inside the per-dose and per-day limits, and that loops still ship in suggest.

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

Sign in to join this conversation.

Search
↑↓ navigate ↵ open ⌘↵ its app esc close

Keyboard shortcuts

Docs