197#define SERVO_TEST_STEPS_MAX 4u
200#define SERVO_TEST_HV_ABOVE_V 6.0f
206#define SERVO_TEST_BROWNOUT_START_V 5.0f
207#define SERVO_TEST_BROWNOUT_STEP_V 0.2f
208#define SERVO_TEST_BROWNOUT_FLOOR_V 3.0f
210#define SERVO_TEST_BROWNOUT_MAX 11u
213#define SERVO_TEST_BROWNOUT_MOVES 2u
222#define SERVO_TEST_MOVE_MIN_A SERVO_MOVE_MIN_A
223#define SERVO_TEST_NOISE_K SERVO_MOVE_NOISE_K
226#define SERVO_TEST_BAND_A SERVO_MOVE_BAND_A
228#define SERVO_TEST_IDLE_MS 1000u
231#define SERVO_TEST_HOLD_MIN_MS 600u
234#define SERVO_TEST_TRAVEL_TIMEOUT_MS SERVO_MOVE_TIMEOUT_MS
236#define SERVO_TEST_SET_TOL_V 0.05f
237#define SERVO_TEST_SET_TIMEOUT_MS 3000u
239#define SERVO_TEST_STALE_MS 1500u
241#define SERVO_TEST_STALL_ABORT_MS 1000u
243#define SERVO_TEST_CC_ABORT_MS 1000u
248#define SERVO_TEST_WIN_STALE_MS 200u
250#define SERVO_TEST_WIN_MS 50u
253#define SERVO_TEST_NEG_IDLE_A 0.020f
256#define SERVO_TEST_INA3221_END_UV 163800u
258#define SERVO_TEST_MOVES_MAX 1000u
262#define SERVO_TEST_ENC_TOL_COUNTS 12u
264#define SERVO_TEST_ENC_TOL_DEG 1.0547f
266#define SERVO_TEST_ENC_HOLD_MS 100u
269#define SERVO_TEST_ENC_MOVED_DEG 2.0f
272#define SERVO_TEST_ENC_STALE_MS 500u
321#define SERVO_TEST_PDMINI_LAG_MS 300u
375 uint16_t centre_us, end_lo_us, end_hi_us;
378 uint16_t settle_ms, dwell_ms;
406 uint16_t min_us, max_us, frame_hz;
409 uint8_t travel_deg, range_pct;
434 SERVO_TEST_PH_NONE = 0,
436 SERVO_TEST_PH_SETTLE,
443 SERVO_TEST_AB_NONE = 0,
445 SERVO_TEST_AB_DISARMED,
448 SERVO_TEST_AB_OPERATOR,
449 SERVO_TEST_AB_SETTINGS,
451 SERVO_TEST_AB_SUPPLY_LOST,
452 SERVO_TEST_AB_TRIPPED,
453 SERVO_TEST_AB_SUPPLY_OFF,
455 SERVO_TEST_AB_NOT_ON,
456 SERVO_TEST_AB_SET_NOT_TAKEN,
483 SERVO_TEST_START_OK = 0,
531 uint32_t enc_travel_sum_ms, enc_travel_max_ms;
535 uint16_t enc_end_ref[2];
539#define SERVO_TEST_STEP_SLOTS (SERVO_TEST_STEPS_MAX + SERVO_TEST_BROWNOUT_MAX)
546#define SERVO_TEST_OUTBOX 16u
551 servo_test_phase_t phase;
553 uint32_t start_ms, end_ms;
572 uint32_t hold_from_ms;
574 uint32_t moves_from_ms;
584 uint8_t enc_hist_n, enc_hist_next;
596 bool enc_moved, enc_settled;
597 uint32_t enc_travel_ms;
606 uint32_t module_samples;
613 uint32_t stall_since_ms;
622 uint16_t sup_samples;
626 uint32_t cc_since_ms;
633 uint8_t box_head, box_n;
634 uint32_t rows, rows_lost;
635 unsigned report_line;
672 float v_min,
float v_max);
687 uint16_t position_us);
703 uint16_t position_us);
782 unsigned end,
float *deg,
float *err);
921 bool *by_limit,
bool *by_range);
937 float *module_per_s, uint32_t *interval_ms);
#define s
Short name for esc_stick_s inside the five stick-class files.
Definition esc_stick_panel_int.h:295
One servo move judged from the servo's current, sample by sample: when it started moving and when it ...
The automatic servo test's words by id: every string the run writes or the SERVO screen shows about i...
servo_str_t
Definition servo_str.h:24
bool servo_test_rates(const servo_test_t *t, float *per_s, float *module_per_s, uint32_t *interval_ms)
Readings that reached the run per second, the supply's own per second, and the mean interval between ...
Definition servo_test.c:1439
const char * servo_test_csv_header_enc(void)
And with the encoder's two columns, angle_deg and travel_angle_ms, between the two groups.
Definition servo_str.c:132
void servo_test_meter_ina3221(servo_test_meter_t *m, uint16_t shunt_dmohm)
An INA3221 channel on a shunt of shunt_dmohm, in 0.1mOhm (1000 for 0.1Ohm, which ends the range at 1....
Definition servo_test.c:121
servo_test_start_t
Why a run would not start.
Definition servo_test.h:482
@ SERVO_TEST_START_BAD_ENDS
Definition servo_test.h:487
@ SERVO_TEST_START_ABOVE_CAP
Definition servo_test.h:485
@ SERVO_TEST_START_NO_SUPPLY
Definition servo_test.h:486
@ SERVO_TEST_START_NO_STEPS
Definition servo_test.h:484
bool servo_test_drained(const servo_test_t *t)
Whether everything of the last run has been handed over.
Definition servo_test.c:310
servo_test_abort_t
Definition servo_test.h:442
@ SERVO_TEST_AB_INA_RESET
Definition servo_test.h:462
@ SERVO_TEST_AB_INA_METER
Definition servo_test.h:467
@ SERVO_TEST_AB_INA_NO_WINDOW
Definition servo_test.h:464
@ SERVO_TEST_AB_CC
Definition servo_test.h:459
@ SERVO_TEST_AB_WIN_STALE
Definition servo_test.h:461
@ SERVO_TEST_AB_INA_SILENT
Definition servo_test.h:463
@ SERVO_TEST_AB_INA_SETUP
Definition servo_test.h:465
servo_test_ina_t
Why a run reads the PD mini with the INA3221 on in SETUP: the condition of servo_source....
Definition servo_test.h:285
@ SERVO_TEST_INA_OLD
Definition servo_test.h:287
@ SERVO_TEST_INA_NO_WINDOW
Definition servo_test.h:290
@ SERVO_TEST_INA_NOT_HELD
Definition servo_test.h:288
@ SERVO_TEST_INA_RESET
Definition servo_test.h:291
@ SERVO_TEST_INA_SETTLING
Definition servo_test.h:292
@ SERVO_TEST_INA_SILENT
Definition servo_test.h:289
@ SERVO_TEST_INA_MODEL
Definition servo_test.h:293
@ SERVO_TEST_INA_NONE
Definition servo_test.h:286
servo_test_state_t
Definition servo_test.h:427
@ SERVO_TEST_IDLE
Definition servo_test.h:428
@ SERVO_TEST_DONE
Definition servo_test.h:430
servo_test_out_t servo_test_peek(servo_test_t *t, const char **text)
The next item for the card, without taking it: OPEN, the CSV's lines, then once the run is over the r...
Definition servo_test.c:259
bool servo_test_running(const servo_test_t *t)
Tell whether a run is under way.
Definition servo_test.c:216
void servo_test_reading(servo_test_t *t, const servo_test_reading_t *r, uint16_t position_us)
A sample of the supply, with position_us the horn's measured pulse width or 0 for none.
Definition servo_test.c:989
bool servo_report_line(const servo_test_t *t, unsigned idx, char *buf, size_t n)
Line idx of the report into buf, in the language of t->cfg.text; false past the last.
Definition servo_report.c:944
unsigned servo_test_step_now(const servo_test_t *t)
Number of the step running.
Definition servo_test.c:1326
bool servo_test_brownout(const servo_test_t *t, float *moved_v, bool *stopped)
The lowest brown-out voltage the servo moved at, and whether one below it showed none.
Definition servo_test.c:1398
bool servo_test_stall_unreachable(const servo_test_cfg_t *cfg, bool *by_limit, bool *by_range)
Whether STALL AT cannot be reached in a run of cfg: at or above the current limit,...
Definition servo_test.c:164
void servo_test_meter_pdmini(servo_test_meter_t *m)
Describe the PD mini as the run meter.
Definition servo_test.c:96
bool servo_test_max_travel(const servo_test_t *t, uint32_t *ms)
Longest travel time of a run.
Definition servo_test.c:1379
const char * servo_test_verdict_name(servo_test_verdict_t v)
English name of a verdict.
Definition servo_str.c:107
bool servo_test_over_a(float a, float limit_a)
Whether a is above limit_a: both in whole mA, a by its magnitude. The one comparison the verdict and ...
Definition servo_test.c:159
servo_str_t servo_test_verdict_str(servo_test_verdict_t v)
Table entry for a verdict.
Definition servo_str.c:79
const char * servo_test_abort_name(servo_test_abort_t why)
English name of an abort reason.
Definition servo_str.c:102
#define SERVO_TEST_STEPS_MAX
The characterisation steps a run can carry: 4.8, 6.0, 7.4, 8.4V.
Definition servo_test.h:197
bool servo_test_enc_end(const servo_test_t *t, const servo_test_step_t *s, unsigned end, float *deg, float *err)
The mean settled end angle of step s at end (0 low, 1 high) into deg, degrees from cfg....
Definition servo_test.c:72
bool servo_test_enc_at(const servo_test_t *t, uint32_t at_ms, float *deg)
The angle at at_ms, degrees from cfg.enc_centre: the newest kept reading taken at or before at_ms (a ...
Definition servo_test.c:1110
void servo_test_step(servo_test_t *t, uint32_t now_ms, const servo_test_in_t *in, servo_test_do_t *out)
One pass at now_ms: the timers, and what the run wants done since the last pass into out.
Definition servo_test.c:1186
servo_test_verdict_t servo_test_verdict(const servo_test_t *t)
Verdict of a run.
Definition servo_test.c:1270
unsigned servo_test_steps_planned(const servo_test_t *t)
Steps planned, the brown-out counted as one, and the one running, 1-based, for "step 2 of 3".
Definition servo_test.c:1318
const char * servo_test_start_name(servo_test_start_t why)
English name of a start refusal.
Definition servo_str.c:112
bool servo_test_max_idle(const servo_test_t *t, float *a)
The highest, the longest and the lowest of a run, over its characterisation steps; false when none wa...
Definition servo_test.c:1337
servo_test_meter_kind_t
Which meter a run reads.
Definition servo_test.h:277
@ SERVO_TEST_METER_PDMINI
Definition servo_test.h:278
@ SERVO_TEST_METER_INA3221
Definition servo_test.h:279
@ SERVO_TEST_METER_MODEL
Definition servo_test.h:280
void servo_test_init(servo_test_t *t)
Clear a run state to idle.
Definition servo_test.c:207
void servo_test_abort(servo_test_t *t, servo_test_abort_t why, uint32_t now_ms)
End a running run for why: the output is asked off and the servo let go at the next servo_test_step()...
Definition servo_test.c:455
#define SERVO_TEST_OUTBOX
Log rows waiting for the card.
Definition servo_test.h:546
void servo_test_encoder(servo_test_t *t, const servo_test_enc_t *e)
A reading of the output encoder, each one once. Judged against the move under way; kept as the angle ...
Definition servo_test.c:1120
bool servo_test_stall_note(const servo_test_cfg_t *cfg, char *buf, size_t n)
The line that says STALL AT cannot be reached in a run of cfg, in the language of cfg->text,...
Definition servo_report.c:781
servo_str_t servo_test_phase_str(servo_test_phase_t ph)
The entries the names below come from, for a caller with its own table.
Definition servo_str.c:63
servo_test_verdict_t
Definition servo_test.h:472
@ SERVO_TEST_NOT_MEASURABLE
Nothing failed, and a counted move showed no movement: the current cannot tell that servo moving from...
Definition servo_test.h:478
bool servo_test_max_hold(const servo_test_t *t, float *a)
Highest holding current of a run.
Definition servo_test.c:1357
uint32_t servo_test_travel_window_ms(const servo_test_t *t)
How long a move of t may take before it is late, or unseen: SERVO_TEST_TRAVEL_TIMEOUT_MS plus the met...
Definition servo_test.c:224
void servo_test_meter_now(servo_test_t *t, const servo_test_meter_now_t *m, uint32_t now_ms)
The meter as a poll decided it, for every answer the caller has: with each window,...
Definition servo_test.c:463
const char * servo_test_meter_word(uint8_t kind)
The word a row's meter column carries: INA3221, PDMINI or MODEL.
Definition servo_str.c:137
const char * servo_test_csv_header(void)
The CSV's header row: the 13 columns of every run, then the meter's six – meter, window,...
Definition servo_str.c:127
servo_test_start_t servo_test_start(servo_test_t *t, const servo_test_cfg_t *cfg, uint32_t now_ms, const servo_test_reading_t *last, float v_min, float v_max)
Start a run at now_ms with the supply as last read it and its set points' range v_min to v_max.
Definition servo_test.c:742
servo_str_t servo_test_abort_str(servo_test_abort_t why)
Table entry for an abort reason.
Definition servo_str.c:71
const char * servo_test_phase_name(servo_test_phase_t ph)
English name of a phase.
Definition servo_str.c:97
void servo_test_pop(servo_test_t *t)
The item servo_test_peek() gave has been taken.
Definition servo_test.c:288
void servo_test_meter_model(servo_test_meter_t *m)
The panel's model of the supply: no lag of its own and no repeats, and its travel times held to what ...
Definition servo_test.c:109
bool servo_test_negative_at_rest(const servo_test_t *t)
Whether a step's idle current reads below -SERVO_TEST_NEG_IDLE_A: the shunt is fitted the other way r...
Definition servo_test.c:1426
void servo_test_window(servo_test_t *t, const servo_test_win_t *w, uint16_t position_us)
A window of INA3221 CH1, each number once and in order, with position_us as servo_test_reading() take...
Definition servo_test.c:1068
What the automatic servo test reads and what it hands out: the supply's readings, the INA3221's windo...
#define SERVO_TEST_LINE_MAX
The longest line a log row or a report line takes, terminator included: the CSV's header with the enc...
Definition servo_test_io.h:134
#define SERVO_TEST_ENC_HIST
Readings of the encoder kept for matching with the supply's rows.
Definition servo_test_io.h:66
servo_test_out_t
Definition servo_test_io.h:136
Definition servo_move.h:118
Configuration of a run: the plan, the servo, the limits and the settings the report shows.
Definition servo_test.h:367
uint8_t ina_why
Definition servo_test.h:414
uint16_t enc_centre
Definition servo_test.h:397
float hold_max_a
Definition servo_test.h:387
char danger[40]
Definition servo_test.h:404
float idle_max_a
The pass/fail limits; 0 is not checked, and STALL AT always is.
Definition servo_test.h:386
uint16_t travel_max_ms
Definition servo_test.h:388
bool model
Definition servo_test.h:410
float i_limit
Definition servo_test.h:372
bool hv
Definition servo_test.h:405
float enc_cmd_deg[2]
Definition servo_test.h:398
bool report
Definition servo_test.h:392
uint32_t meter_changes
Definition servo_test.h:412
bool by_moves
Definition servo_test.h:379
const char *const * text
The report's language: a table of SERVO_STR_COUNT entries, each NULL for the English,...
Definition servo_test.h:422
float stall_a
The stall current's limit, A; the stall check always runs.
Definition servo_test.h:390
What the run wants done, from servo_test_step().
Definition servo_test_io.h:111
A kept reading.
Definition servo_test_io.h:69
One reading of the output encoder, as the SENSE page has it.
Definition servo_test_io.h:75
What the caller knows each step.
Definition servo_test_io.h:123
A mean, kept as a sum.
Definition servo_test.h:492
The servo rail's meter as one poll of the panel decided it (servo_source.h).
Definition servo_test.h:708
bool ina3221
Definition servo_test.h:709
servo_test_abort_t dropped
Why the INA3221 last stopped being the meter – one of the SERVO_TEST_AB_INA_ reasons or SERVO_TEST_AB...
Definition servo_test.h:716
uint32_t changes
Definition servo_test.h:710
What reads the servo's current, for what its travel times are worth.
Definition servo_test.h:299
uint8_t kind
Definition servo_test.h:300
uint16_t range_ma
Definition servo_test.h:305
uint16_t shunt_dmohm
Definition servo_test.h:303
bool upper_bound
Definition servo_test.h:314
bool repeats
Definition servo_test.h:312
uint16_t span_ms
Definition servo_test.h:301
uint16_t lag_ms
Definition servo_test.h:309
char name[20]
For the report: "PD mini", "INA3221 0x41 CH2".
Definition servo_test.h:308
One reading of the supply, as SUPPLY has it (supply_state_t).
Definition servo_test_io.h:25
One voltage step's results.
Definition servo_test.h:498
uint16_t enc_travels
Definition servo_test.h:528
float noise_a
Definition servo_test.h:508
uint16_t moves
Definition servo_test.h:519
uint16_t enc_unmoved
Definition servo_test.h:529
bool done
Definition servo_test.h:502
float move_a
Definition servo_test.h:509
servo_test_mean_t idle
Definition servo_test.h:506
float v_min
Definition servo_test.h:504
float peak_a
Definition servo_test.h:515
float move_peak_a
Definition servo_test.h:512
uint16_t enc_moves
Definition servo_test.h:527
uint32_t travel_max_ms
Definition servo_test.h:516
uint16_t travels
Definition servo_test.h:518
uint16_t timeouts
Definition servo_test.h:522
float idle_sq
Definition servo_test.h:507
servo_test_mean_t move
Definition servo_test.h:510
uint16_t no_rise
Definition servo_test.h:520
bool moved
Definition servo_test.h:524
uint16_t enc_late
Definition servo_test.h:530
bool begun
Definition servo_test.h:501
servo_test_mean_t v
Definition servo_test.h:503
uint32_t travel_sum_ms
Definition servo_test.h:517
servo_test_mean_t hold[2]
Definition servo_test.h:511
Definition servo_test.h:548
servo_move_t move
Definition servo_test.h:569
bool ended
Definition servo_test.h:636
uint32_t enc_weak
Definition servo_test.h:587
uint8_t step
Definition servo_test.h:560
bool enc_open
Definition servo_test.h:589
bool sup_have
Definition servo_test.h:621
uint32_t cc_readings
Definition servo_test.h:627
uint32_t clipped
Definition servo_test.h:610
uint32_t travel_now_ms
Definition servo_test.h:577
float bo_start_v
Definition servo_test.h:557
float stall_peak_a
Definition servo_test.h:615
uint32_t cc_longest_ms
Definition servo_test.h:628
uint32_t enc_travel_now_ms
Definition servo_test.h:598
uint32_t last_ms
Definition servo_test.h:604
uint32_t readings
Definition servo_test.h:605
uint32_t enc_reads
Definition servo_test.h:585
uint32_t sup_ms
Definition servo_test.h:623
uint32_t enc_travel_at_ms
Definition servo_test.h:599
uint16_t enc_start_raw
Definition servo_test.h:594
bool enc_ok
Definition servo_test.h:591
uint32_t skipped
Definition servo_test.h:607
uint8_t sup_mode
Definition servo_test.h:624
uint8_t placed
Definition servo_test.h:576
float floor_v
Definition servo_test.h:556
uint16_t enc_last_raw
Definition servo_test.h:595
uint8_t step_count
Definition servo_test.h:561
uint32_t enc_strong
Definition servo_test.h:588
uint8_t end
Definition servo_test.h:566
bool on_seen
Definition servo_test.h:562
float v_max
Definition servo_test.h:555
uint32_t phase_ms
Definition servo_test.h:554
uint32_t enc_no_magnet
Definition servo_test.h:586
bool counted
Definition servo_test.h:568
bool cc_on
Definition servo_test.h:625
bool stalled
Definition servo_test.h:614
float move_peak_now
Definition servo_test.h:617
One 50ms window of INA3221 CH1, as the window ring carries it (sense_link_win_t).
Definition servo_test_io.h:43