rcbench
Servo and ESC test bench: panel, IOmcu and shared C
Loading...
Searching...
No Matches
fw_trial.c File Reference

When a new build's first start is kept: see fw_trial.h. More...

#include "fw_trial.h"
#include <string.h>

Functions

void fw_trial_init (fw_trial_t *t, uint32_t start_ms)
 Start a trial with no step seen.
void fw_trial_mark (fw_trial_t *t, uint32_t steps)
 Record steps as seen. FW_TRIAL_TICK counts only once FW_TRIAL_FRAME is seen, before this call or in it; bits outside FW_TRIAL_ALL are ignored.
void fw_trial_settle (fw_trial_t *t)
 Settle the trial outside this model, as the start without touch does; every later poll says FW_TRIAL_SETTLED.
fw_trial_verdict_t fw_trial_poll (fw_trial_t *t, uint32_t now_ms, bool quiet)
 Decide at now_ms. FW_TRIAL_KEEP and FW_TRIAL_KEEP_BOUND settle the trial: each is returned once.
uint32_t fw_trial_missing (const fw_trial_t *t)
 The steps not seen yet.

Detailed Description

When a new build's first start is kept: see fw_trial.h.

SPDX-License-Identifier: MIT

Function Documentation

◆ fw_trial_init()

void fw_trial_init ( fw_trial_t * t,
uint32_t start_ms )

Start a trial with no step seen.

Parameters
tThe trial.
start_msThe millisecond count the bound counts from.

◆ fw_trial_mark()

void fw_trial_mark ( fw_trial_t * t,
uint32_t steps )

Record steps as seen. FW_TRIAL_TICK counts only once FW_TRIAL_FRAME is seen, before this call or in it; bits outside FW_TRIAL_ALL are ignored.

Parameters
tThe trial.
stepsOne or more FW_TRIAL_* steps.

◆ fw_trial_missing()

uint32_t fw_trial_missing ( const fw_trial_t * t)

The steps not seen yet.

Parameters
tThe trial.
Returns
The FW_TRIAL_* bits of FW_TRIAL_ALL not marked.

◆ fw_trial_poll()

fw_trial_verdict_t fw_trial_poll ( fw_trial_t * t,
uint32_t now_ms,
bool quiet )

Decide at now_ms. FW_TRIAL_KEEP and FW_TRIAL_KEEP_BOUND settle the trial: each is returned once.

Parameters
tThe trial.
now_msThe millisecond count; it may wrap past 2^32.
quietWhether the bench can take a flash write now.
Returns
FW_TRIAL_KEEP once every step is seen on a quiet bench; FW_TRIAL_KEEP_BOUND once FW_TRIAL_BOUND_MS has passed since start_ms with FW_TRIAL_TICK seen on a quiet bench; otherwise FW_TRIAL_OPEN, or FW_TRIAL_SETTLED after a settle.

◆ fw_trial_settle()

void fw_trial_settle ( fw_trial_t * t)

Settle the trial outside this model, as the start without touch does; every later poll says FW_TRIAL_SETTLED.

Parameters
tThe trial.