main
John Lauer Publish assumption-based R11 assembly study, locked firmware and new review footage d61d6cb
#ifndef ADOM_LOAD_CORE_H
#define ADOM_LOAD_CORE_H
#include <stdbool.h>
#include <stdint.h>
typedef enum { LOAD_OFF, LOAD_ARMED, LOAD_RUNNING, LOAD_FAULT } load_state;
enum { F_SENSOR=1, F_HARDWARE=2, F_FAN=4, F_LINK=8, F_THERMAL=16, F_ENVELOPE=32 };
typedef struct {
 uint32_t now_ms, sample_ms, last_tach_ms;
 float volts, amps, case_c;
 /* Trusted assembly calibration: conservative allowance above nominal case_c,
    including under-reading, attachment gradient and qualified dynamic lag.
    Never supplied by a serial command. Unknown calibration must remain false. */
 float case_margin_c; bool temperature_qualified;
 /* Measured over multiple tach periods; valid only after spin-up qualification. */
 float fan_rpm; bool fan_rpm_valid;
 bool sensors_valid, hw_ok, latch_q, assembly_qualified;
} load_sample;
typedef struct {
 load_state state; uint32_t faults, last_tick_ms, lease_ms, arm_started_ms;
 float requested_a, applied_a, power_limit_w;
 uint16_t dac_code; bool enable;
} load_core;
void load_init(load_core *, uint32_t now);
void load_off(load_core *);
bool load_set_current(load_core *, float amps);
void load_heartbeat(load_core *, uint32_t now);
bool load_arm(load_core *, const load_sample *);
bool load_clear_fault(load_core *, const load_sample *);
void load_tick(load_core *, const load_sample *);
#endif