main
John Lauer
Integrate output-locked I2C diagnostics and conservative measurement age; retain mounting qualification limits
26c2c4b
#ifndef LOAD_MEASUREMENT_CACHE_H
#define LOAD_MEASUREMENT_CACHE_H
#include "instruments.h"
typedef struct {
bool healthy, have_sample;
uint32_t trigger_ms, sample_ms;
float load_terminal_v, amps;
} load_measurement_cache;
/* Caller initializes the devices with output OFF, then starts this cache with
* a timestamp captured BEFORE initialization. All bus callbacks must be bounded. */
void load_measurement_begin(load_measurement_cache *,uint32_t before_init_ms,bool init_ok);
load_ina_result load_measurement_poll(load_measurement_cache *,const load_i2c *,uint32_t before_poll_ms);
/* Timestamp is the beginning of the averaging interval, never the read time. */
bool load_measurement_get(const load_measurement_cache *,uint32_t now_ms,float *,float *,uint32_t *);
#endif