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

The limit run's outbox and report, and the words the screen and the report name a verdict, a reason and a phase by: see servo_limrun.h. More...

#include "servo_limrun.h"
#include <stdio.h>
#include "servo_limrun_int.h"

Data Structures

struct  cur_t
 One line at a time, found by counting, as the automatic test's report is (servo_report.c): a cursor walks the lines in order and prints the one asked for. More...

Macros

#define LS(id)

Functions

servo_test_out_t servo_limrun_peek (servo_limrun_t *r, const char **text)
 The report's lines, in order, then END; OPEN_TXT first.
void servo_limrun_pop (servo_limrun_t *r)
 Take the outbox entry last returned by servo_limrun_peek().
bool servo_limrun_drained (const servo_limrun_t *r)
 Tell whether the run has nothing left to hand over.
static bool here (cur_t *c)
 Count one line, and tell whether it is the one asked for.
static bool blank (cur_t *c)
 Write an empty line when it is the one asked for.
static bool text_line (cur_t *c, servo_str_t id)
 Write a table entry when it is the line asked for.
static bool end_lines (const servo_limrun_t *r, cur_t *c, const servo_limrun_side_t *e, uint8_t side)
 The lines of one end of the search: its result, and with the encoder on, its angle.
static bool head_lines (const servo_limrun_t *r, cur_t *c)
 The head of the report: title, result, device and settings, the search, the meter, the limits, the duration and the two ends.
static servo_str_t side_word (const servo_limrun_t *r, int g)
 Name table entry for the side a register's value was found on.
static void share_text (char *buf, size_t n, int32_t d, int32_t span)
 A share of travel, 0.1us over 0.1us, as three decimals; "-" for none.
static void raw_text (char *buf, size_t n, uint16_t v)
 A register count as text: "-" for none, else the count.
static bool reg_lines (const servo_limrun_t *r, cur_t *c, int g)
 The lines of one register: its angle, count and side, then its linear fit once the side is found and needed.
static double us_of (uint16_t dus)
 NEUTRAL, PULSE LOWER and PULSE UPPER, 0.1us, as microseconds.
static bool prog_lines (const servo_limrun_t *r, cur_t *c)
 The programming section: the servo, its pulses, what was written, the backup and restore lines, and the check ends.
static bool tail_lines (const servo_limrun_t *r, cur_t *c)
 The last lines of the report: the unit note when programming, and the bench line.
bool servo_limrun_report_line (const servo_limrun_t *r, unsigned idx, char *buf, size_t n)
 Line idx of the report into buf; false past the last.
servo_str_t servo_limrun_verdict_str (servo_limrun_verdict_t v)
 The table entries the screen and the report name these by.
servo_str_t servo_limrun_why_str (const servo_limrun_t *r)
 Name table entry for the reason of a run.
servo_str_t servo_limrun_phase_str (servo_limrun_phase_t ph)
 Table entry for a phase of the limit run.

Detailed Description

The limit run's outbox and report, and the words the screen and the report name a verdict, a reason and a phase by: see servo_limrun.h.

SPDX-License-Identifier: MIT

Macro Definition Documentation

◆ LS

#define LS ( id)
Value:
servo_str_in(c->text, SERVO_STR_##id)
const char * servo_str_in(const char *const *table, servo_str_t id)
Definition servo_str.c:47

Function Documentation

◆ blank()

bool blank ( cur_t * c)
static

Write an empty line when it is the one asked for.

Parameters
cCursor; buf is set to "" when this is the line asked for.
Returns
true when the line asked for is this one.

◆ end_lines()

bool end_lines ( const servo_limrun_t * r,
cur_t * c,
const servo_limrun_side_t * e,
uint8_t side )
static

The lines of one end of the search: its result, and with the encoder on, its angle.

A side not run gives the not-run line; a bound end gives the bind and the limit pulses with the baseline and knee currents; a free end gives its limit pulse and the baseline current. The angle line follows a run end when cfg.enc_on is set.

Parameters
rRun state; its cfg gives enc_on.
cCursor.
eThe end's result.
sideSERVO_LIMRUN_LO or SERVO_LIMRUN_HI; picks the label.
Returns
true when the line asked for is one of this end's lines.

◆ head_lines()

bool head_lines ( const servo_limrun_t * r,
cur_t * c )
static

The head of the report: title, result, device and settings, the search, the meter, the limits, the duration and the two ends.

Parameters
rRun state.
cCursor.
Returns
true when the line asked for is in the head.

◆ here()

bool here ( cur_t * c)
static

Count one line, and tell whether it is the one asked for.

Parameters
cCursor. Its count goes up whether or not this is the line.
Returns
true when the line counted is the one asked for.

◆ prog_lines()

bool prog_lines ( const servo_limrun_t * r,
cur_t * c )
static

The programming section: the servo, its pulses, what was written, the backup and restore lines, and the check ends.

Parameters
rRun state.
cCursor.
Returns
true when the line asked for is in the section.

◆ raw_text()

void raw_text ( char * buf,
size_t n,
uint16_t v )
static

A register count as text: "-" for none, else the count.

Parameters
bufOut: the text.
nSize of buf, bytes.
vCount; 0 for none.

◆ reg_lines()

bool reg_lines ( const servo_limrun_t * r,
cur_t * c,
int g )
static

The lines of one register: its angle, count and side, then its linear fit once the side is found and needed.

Parameters
rRun state.
cCursor.
gRegister, SERVO_LIMRUN_LEFT or SERVO_LIMRUN_RIGHT.
Returns
true when the line asked for is one of this register's lines.

◆ servo_limrun_drained()

bool servo_limrun_drained ( const servo_limrun_t * r)

Tell whether the run has nothing left to hand over.

Parameters
rRun state.
Returns
true when r is NULL or IDLE, or DONE with the report handed out.

◆ servo_limrun_peek()

servo_test_out_t servo_limrun_peek ( servo_limrun_t * r,
const char ** text )

The report's lines, in order, then END; OPEN_TXT first.

Parameters
rRun state. NULL gives NONE.
textOut: text of the entry; empty when there is none.
Returns
kind of the next outbox entry: OPEN_TXT first, then TXT lines, then END; NONE when the run is not DONE or the report was handed out.

◆ servo_limrun_phase_str()

servo_str_t servo_limrun_phase_str ( servo_limrun_phase_t ph)

Table entry for a phase of the limit run.

Parameters
phPhase to name.
Returns
table entry for the phase; PHASE_NONE for a value not in the enum.

◆ servo_limrun_pop()

void servo_limrun_pop ( servo_limrun_t * r)

Take the outbox entry last returned by servo_limrun_peek().

Parameters
rRun state.

◆ servo_limrun_report_line()

bool servo_limrun_report_line ( const servo_limrun_t * r,
unsigned idx,
char * buf,
size_t n )

Line idx of the report into buf; false past the last.

Parameters
rRun state.
idxLine index, from 0.
bufOut: line text.
nSize of buf, bytes.
Returns
true when line idx exists; false for NULL arguments, n of 0, or a run not DONE.

◆ servo_limrun_verdict_str()

servo_str_t servo_limrun_verdict_str ( servo_limrun_verdict_t v)

The table entries the screen and the report name these by.

Parameters
vVerdict to name.
Returns
table entry for FOUND, FREE, PASS or FAIL; ABORTED for any other value.

◆ servo_limrun_why_str()

servo_str_t servo_limrun_why_str ( const servo_limrun_t * r)

Name table entry for the reason of a run.

Parameters
rRun state. NULL gives the NONE entry.
Returns
table entry for the reason; the test reason for WHY_TEST; NONE for other values.

◆ share_text()

void share_text ( char * buf,
size_t n,
int32_t d,
int32_t span )
static

A share of travel, 0.1us over 0.1us, as three decimals; "-" for none.

Parameters
bufOut: the text.
nSize of buf, bytes.
dTravel, 0.1us.
spanFull span, 0.1us; 0 or less gives "-".

◆ side_word()

servo_str_t side_word ( const servo_limrun_t * r,
int g )
static

Name table entry for the side a register's value was found on.

Parameters
rRun state.
gRegister, SERVO_LIMRUN_LEFT or SERVO_LIMRUN_RIGHT.
Returns
SIDE_LO or SIDE_HI for the side found, SIDE_UNKNOWN for none.

◆ tail_lines()

bool tail_lines ( const servo_limrun_t * r,
cur_t * c )
static

The last lines of the report: the unit note when programming, and the bench line.

Parameters
rRun state.
cCursor.
Returns
true when the line asked for is one of these.

◆ text_line()

bool text_line ( cur_t * c,
servo_str_t id )
static

Write a table entry when it is the line asked for.

Parameters
cCursor; buf holds the entry when this is the line asked for.
idTable entry to write, in the cursor's language.
Returns
true when the line asked for is this one.

◆ us_of()

double us_of ( uint16_t dus)
static

NEUTRAL, PULSE LOWER and PULSE UPPER, 0.1us, as microseconds.

Parameters
dusPulse width, 0.1us.
Returns
pulse width, us.