36 int (*
write)(
void *ctx,
const void *data,
size_t len);
50#define LOG_WRITER_LINE_MAX 256
91#define LOG_WRITER_FLUSH_ROWS 20u
92#define LOG_WRITER_FLUSH_S 1.0f
102#define LOG_WRITER_SEP ';'
113#define LOG_WRITER_SRC_MEASURED "measured"
114#define LOG_WRITER_SRC_MODEL "model"
278uint32_t
log_servo_pack(
bool pulse_ok, uint16_t pulse_us,
bool angle_ok,
362 return (w == NULL) ? 0u : w->
pending;
374 return w == NULL || w->
failed;
The bench readings, in the units a person reads: V, A, W, rpm (revolutions per minute),...
#define s
Short name for esc_stick_s inside the five stick-class files.
Definition esc_stick_panel_int.h:295
The bench log's INA3221 columns with SENSE_MAP in force (protocol 4.25): one group of three per chann...
void log_writer_init(log_writer_t *w, const log_sink_t *sink)
Sets up a writer on a sink.
Definition log_writer.c:87
bool log_writer_supply_row(log_writer_t *w, float t_s, const supply_state_t *s)
Append one supply sample, for a run that is the supply's output being on.
Definition log_writer.c:316
bool log_writer_servo_row(log_writer_t *w, float t_s, const bench_state_t *b, const log_rail_t *rail, const log_servo_t *sv)
Append one sample of a run ARMED from SERVO: log_writer_row()'s row with voltage, current,...
Definition log_writer.c:575
#define LOG_WRITER_LINE_MAX
The longest bench row, terminator included.
Definition log_writer.h:50
bool log_writer_commit(log_writer_t *w)
Commit the rows written since the last commit.
Definition log_writer.c:130
void log_rail_count(bench_totals_t *t, log_rail_t *r, float dt_s, bool driving)
Count r's readings into the run's totals t over dt_s, and put the totals on r.
Definition log_writer.c:655
void log_rail_take_ina(log_rail_t *out, const sense_link_win_t *win, bool row_modelled)
The servo rail's INA3221 window for a SERVO run's row, into out, with nothing counted: while an INA32...
Definition log_writer.c:581
bool log_writer_header(log_writer_t *w)
Write the header row.
Definition log_writer.c:204
void log_servo_unpack(uint32_t packed, bool row_modelled, log_servo_t *out)
log_servo_pack()'s word back into out, for a row: no angle on a modelled row, whose figures the encod...
Definition log_writer.c:619
static uint32_t log_writer_pending(const log_writer_t *w)
Rows written and not yet committed: what a power cut would cost now.
Definition log_writer.h:360
bool log_writer_row(log_writer_t *w, float t_s, const bench_state_t *b)
Append one sample at t_s seconds, and commit when the row completes an interval.
Definition log_writer.c:570
uint32_t log_servo_pack(bool pulse_ok, uint16_t pulse_us, bool angle_ok, float angle_deg)
The pulse and the angle in one 32-bit word, for the render side to hand the control task in one atomi...
Definition log_writer.c:605
static bool log_writer_failed(const log_writer_t *w)
True once any write has failed: the file is incomplete, not merely short.
Definition log_writer.h:372
void log_rail_take(log_rail_t *out, const supply_state_t *s, bool row_modelled)
The supply's reading for a SERVO run's row, into out, with nothing counted.
Definition log_writer.c:635
void log_writer_set_cols(log_writer_t *w, const log_cols_t *cols)
The INA3221 columns of this file, before its header: with SENSE_MAP in force a group per watched targ...
Definition log_writer.c:138
The panel's half of the SENSE (0x2B), SERVO_SENSE (0x2C) and SERVO_WIN (0x31) link pages: what is wri...
The bench readings in the units a person reads: V, A, W and rpm, with their peaks.
Definition bench_state.h:54
A run's charge and energy, counted by the panel.
Definition bench_state.h:332
The log's columns: their number, targets and names.
Definition log_cols.h:45
The servo rail's supply on a SERVO run's row: the supply's last reading and the run's totals of it,...
Definition log_writer.h:188
uint8_t counted
Definition log_writer.h:195
uint8_t ok
Definition log_writer.h:194
float i
Definition log_writer.h:190
float p
Definition log_writer.h:191
bool withheld
Definition log_writer.h:196
float v
Definition log_writer.h:189
float energy_wh
Definition log_writer.h:193
float charge_mah
Definition log_writer.h:192
A SERVO run's commanded pulse and measured angle on its row.
Definition log_writer.h:257
bool pulse_ok
Definition log_writer.h:260
bool angle_ok
Definition log_writer.h:261
uint16_t pulse_us
Definition log_writer.h:259
float angle_deg
Definition log_writer.h:258
The byte sink a log writer writes to, with its commit.
Definition log_writer.h:34
int(*) write(void *ctx, const void *data, size_t len)
Returns bytes written, or a negative value on failure.
Definition log_writer.h:36
bool(*) flush(void *ctx)
Commit what has been written, so that a power cut keeps it.
Definition log_writer.h:45
A log writer: its sink, its counts and its latched failure.
Definition log_writer.h:55
float committed_s
Definition log_writer.h:60
bool header_done
Definition log_writer.h:61
bool by_map
The INA3221 columns go by cols (log_writer_set_cols()), not CH1 to CH3.
Definition log_writer.h:67
float last_s
Definition log_writer.h:59
uint32_t pending
Definition log_writer.h:58
char line[LOG_WRITER_LINE_MAX]
A bench row as it is built: up to 25 cells, here rather than on the stack of the task that writes the...
Definition log_writer.h:73
bool failed
Definition log_writer.h:62
One 50ms window of INA3221 CH1, as SERVO_WIN carries it.
Definition sense_link.h:328
A supply's readings, set points, mode and trip state.
Definition supply.h:69
A programmable supply: what it can be set to, what it was set to, and what it delivers.