The run log's cadence: which pass writes a row, see log_cadence.h.
More...
|
| void | log_cadence_init (log_cadence_t *c, uint32_t now_ms) |
| | Once, before the loop: both clocks at now_ms, no rows counted.
|
| bool | log_cadence_model_due (log_cadence_t *c, uint32_t now_ms, bool link_up, float *step_s) |
| | The model's gate, once per pass.
|
| void | log_cadence_run_start (log_cadence_t *c, uint32_t now_ms) |
| | A run starts: its time is 0 at now_ms and its row counts are 0.
|
| bool | log_cadence_bench_run (bool bench_kind, bool servo_test) |
| | Whether the bench log records in this pass: the log's run is an armed bench's (bench_kind) and no automatic servo test is running (servo_test).
|
| bool | log_cadence_row (log_cadence_t *c, uint32_t now_ms, bool new_sample, bool bench_run, float *t_s) |
| | Whether this pass writes a bench row, once per pass and on every pass, with now_ms never behind the call before.
|
| unsigned | log_cadence_rows (unsigned windows) |
| | How many rows a pass writes that log_cadence_row() granted: one for each of the windows INA3221 windows handed over in the pass, and one for a pass with none.
|
| void | log_cadence_posted (log_cadence_t *c, bool taken) |
| | What the logger's queue did with a row: taken, or refused as full.
|
| uint32_t | log_cadence_sent (const log_cadence_t *c) |
| | The run's rows the queue took.
|
| uint32_t | log_cadence_lost (const log_cadence_t *c) |
| | The run's rows the queue refused.
|
| log_run_kind_t | log_cadence_wanted (bool auto_logs, bool armed, bool motor, bool supply_on, log_run_kind_t now) |
| | The run the log records now, from the run it records (now) and the bench: LOG_RUN_NONE while auto_logs is off, so a run that is under way ends and none starts.
|
The run log's cadence: which pass writes a row, see log_cadence.h.
SPDX-License-Identifier: MIT
◆ log_cadence_bench_run()
| bool log_cadence_bench_run |
( |
bool | bench_kind, |
|
|
bool | servo_test ) |
Whether the bench log records in this pass: the log's run is an armed bench's (bench_kind) and no automatic servo test is running (servo_test).
The answer is log_cadence_row()'s bench_run.
- Parameters
-
| bench_kind | true for an armed bench run. |
| servo_test | true while an automatic servo test runs. |
- Returns
- true when the bench log records in this pass.
◆ log_cadence_init()
Once, before the loop: both clocks at now_ms, no rows counted.
- Parameters
-
| c | The cadence state to set up. |
| now_ms | The time, in ms. |
◆ log_cadence_lost()
The run's rows the queue refused.
- Parameters
-
- Returns
- The number of rows the queue refused.
◆ log_cadence_model_due()
| bool log_cadence_model_due |
( |
log_cadence_t * | c, |
|
|
uint32_t | now_ms, |
|
|
bool | link_up, |
|
|
float * | step_s ) |
The model's gate, once per pass.
Opens when LOG_CADENCE_MODEL_MS or more have passed since it last opened, and its clock moves then whatever link_up says, so the first step after a link is lost is not the whole time the link was up.
- Returns
- true when the model takes a step in this pass: the gate opened and the link is down.
step_s is then the time since the gate last opened, at most LOG_CADENCE_MODEL_MAX_MS, in seconds; otherwise 0.
- Parameters
-
| c | The cadence state. |
| now_ms | The time, in ms. |
| link_up | true while the IOmcu link is up. |
| step_s | Receives the time of the step, in s. |
◆ log_cadence_posted()
What the logger's queue did with a row: taken, or refused as full.
- Parameters
-
| c | The cadence state. |
| taken | true when the queue took the row. |
◆ log_cadence_row()
| bool log_cadence_row |
( |
log_cadence_t * | c, |
|
|
uint32_t | now_ms, |
|
|
bool | new_sample, |
|
|
bool | bench_run, |
|
|
float * | t_s ) |
Whether this pass writes a bench row, once per pass and on every pass, with now_ms never behind the call before.
The run's time advances by the ticks since the last call, modulo 2^32.
- Parameters
-
| new_sample | the pass brought a sample: an answered bench read, or a step of the model |
| bench_run | the log is recording an armed bench |
| t_s | the row's time in seconds since the run's start; written only when a row is granted |
- Returns
- true exactly when
new_sample and bench_run are both true.
- Parameters
-
| c | The cadence state. |
| now_ms | The time, in ms. |
◆ log_cadence_rows()
| unsigned log_cadence_rows |
( |
unsigned | windows | ) |
|
How many rows a pass writes that log_cadence_row() granted: one for each of the windows INA3221 windows handed over in the pass, and one for a pass with none.
Each is posted and counted with log_cadence_posted().
- Parameters
-
| windows | The INA3221 windows handed over in the pass. |
- Returns
- The number of rows the pass writes.
◆ log_cadence_run_start()
| void log_cadence_run_start |
( |
log_cadence_t * | c, |
|
|
uint32_t | now_ms ) |
A run starts: its time is 0 at now_ms and its row counts are 0.
- Parameters
-
| c | The cadence state. |
| now_ms | The time, in ms. |
◆ log_cadence_sent()
The run's rows the queue took.
- Parameters
-
- Returns
- The number of rows the queue took.
◆ log_cadence_wanted()
| log_run_kind_t log_cadence_wanted |
( |
bool | auto_logs, |
|
|
bool | armed, |
|
|
bool | motor, |
|
|
bool | supply_on, |
|
|
log_run_kind_t | now ) |
The run the log records now, from the run it records (now) and the bench: LOG_RUN_NONE while auto_logs is off, so a run that is under way ends and none starts.
An armed bench (armed) is the run whatever the supply is doing: now while that is an armed run, since an arm's roles change only through a disarm, and otherwise LOG_RUN_MOTOR or LOG_RUN_SERVO by motor (log_name_armed_prefix() is LOG_PREFIX_MOTOR). Else LOG_RUN_SUPPLY while supply_on.
- Parameters
-
| auto_logs | true while automatic logging is on. |
| armed | true while the bench is armed. |
| motor | true for the motor run rather than the servo run. |
| supply_on | true while the supply output is on. |
| now | The run the log records now. |
- Returns
- The run the log records next.