mirror of
https://github.com/openglow-org/forgefirm.git
synced 2026-09-27 16:51:12 -07:00
An ESP32-S3 DevKitC-1 on the bench network drives three relays at the machine's connectors so the acceptance tool can open the lid loop, pull the interlock loop and press the button with nobody in the room. Two contacts are normally closed in loops the safety chain already reads, the third is normally open across the button input and only ever pulsed (20 to 500 ms, the end armed before the line rises); every line is low at boot and after any reset, the task watchdog panics and reboots, and the button channel needs a jumper. HTTP on port 80 under a key in X-Fixture-Key; the hostname announced over DHCP and mDNS. ESP-IDF v5.5 native, the mDNS component pinned in dependencies.lock; fixture.env (git-ignored) is the one input: the wifi, the key, the hostname. fixture.sh builds with idf.py or in the espressif/idf container, flashes with esptool from pip. The decisions that need no hardware live in policy.c with a gcc host test; CI runs it and builds the firmware in the pinned container.
26 lines
1.0 KiB
C
26 lines
1.0 KiB
C
/*
|
|
* forgefixture API: HTTP on port 80, JSON, every request under the key.
|
|
*
|
|
* GET / identity, uptime, the channels' states, the
|
|
* enable jumper, the wifi link
|
|
* GET /state the same
|
|
* POST /lid {"state": "open" | "close"}
|
|
* POST /interlock {"state": "open" | "close"}
|
|
* POST /button {"ms": 200} one pulse, clamped to 20..500 ms
|
|
* POST /release every channel released
|
|
*
|
|
* The key travels in the X-Fixture-Key header; without it, or with a
|
|
* wrong one, every path answers 401. A lid or interlock "open" energizes
|
|
* the channel (the loop opens); "close" releases it. The button is
|
|
* refused with 409 while the enable jumper is out or a pulse is still in
|
|
* progress. Errors are {"error": "..."}; actions answer with the state
|
|
* as GET / shows it.
|
|
*
|
|
* (C) Copyright 2026
|
|
* Scott Wiederhold, s.e.wiederhold@gmail.com
|
|
* SPDX-License-Identifier: MIT
|
|
*/
|
|
#pragma once
|
|
|
|
void api_start(const char *api_key, const char *hostname);
|