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

What the automatic servo test reads and what it hands out: the supply's readings, the INA3221's windows and the encoder's readings it is fed, what it wants done, and the items of its outbox. A caller that feeds a run or carries its files to the card, and steps none, includes this alone, as servo_screen.h does; the engine is servo_test.h. More...

#include <stdbool.h>
#include <stdint.h>

Go to the source code of this file.

Data Structures

struct  servo_test_reading_t
 One reading of the supply, as SUPPLY has it (supply_state_t). More...
struct  servo_test_win_t
 One 50ms window of INA3221 CH1, as the window ring carries it (sense_link_win_t). More...
struct  servo_test_enc_sample_t
 A kept reading. More...
struct  servo_test_enc_t
 One reading of the output encoder, as the SENSE page has it. More...
struct  servo_test_do_t
 What the run wants done, from servo_test_step(). More...
struct  servo_test_in_t
 What the caller knows each step. More...

Macros

#define SERVO_TEST_ENC_HIST   16u
 Readings of the encoder kept for matching with the supply's rows.
#define SERVO_TEST_LINE_MAX   224u
 The longest line a log row or a report line takes, terminator included: the CSV's header with the encoder's columns is 219 characters.

Enumerations

enum  servo_test_out_t {
  SERVO_TEST_OUT_NONE = 0 , SERVO_TEST_OUT_OPEN , SERVO_TEST_OUT_CSV , SERVO_TEST_OUT_TXT ,
  SERVO_TEST_OUT_END , SERVO_TEST_OUT_OPEN_TXT
}

Functions

float servo_test_enc_deg (uint16_t raw, uint16_t centre)
 raw from centre on the circle, degrees, -180 to just under 180: 360 / 4096 a count. The difference of any two counts the shortest way round.
float servo_test_enc_wrap (float deg)
 deg on the circle: -180 to just under 180.

Detailed Description

What the automatic servo test reads and what it hands out: the supply's readings, the INA3221's windows and the encoder's readings it is fed, what it wants done, and the items of its outbox. A caller that feeds a run or carries its files to the card, and steps none, includes this alone, as servo_screen.h does; the engine is servo_test.h.

SPDX-License-Identifier: MIT

Macro Definition Documentation

◆ SERVO_TEST_ENC_HIST

#define SERVO_TEST_ENC_HIST   16u

Readings of the encoder kept for matching with the supply's rows.

The panel has one about every 40ms, so 16 span 640ms: more than SERVO_TEST_ENC_STALE_MS.

Enumeration Type Documentation

◆ servo_test_out_t

Enumerator
SERVO_TEST_OUT_OPEN 

a run begins: its files are opened

SERVO_TEST_OUT_CSV 

one line of the CSV

SERVO_TEST_OUT_TXT 

one line of the report

SERVO_TEST_OUT_END 

the run's files are complete

SERVO_TEST_OUT_OPEN_TXT 

a report alone begins: a TXT, no CSV

Function Documentation

◆ servo_test_enc_deg()

float servo_test_enc_deg ( uint16_t raw,
uint16_t centre )

raw from centre on the circle, degrees, -180 to just under 180: 360 / 4096 a count. The difference of any two counts the shortest way round.

Parameters
rawEncoder count, 0 to 4095.
centreCentre count, 0 to 4095.
Returns
angle, degrees, -180 up to just under 180.

◆ servo_test_enc_wrap()

float servo_test_enc_wrap ( float deg)

deg on the circle: -180 to just under 180.

Parameters
degAngle, degrees.
Returns
angle, degrees, -180 up to just under 180.