rcbench
Servo and ESC test bench: panel, IOmcu and shared C
Loading...
Searching...
No Matches
servo_test_io.h
Go to the documentation of this file.
1
12
13#pragma once
14
15#include <stdbool.h>
16#include <stdint.h>
17
18#ifdef __cplusplus
19extern "C" {
20#endif
21
22/* ------------------------------------------------------- what it reads */
23
25typedef struct {
26 float v, i;
27 float set_v;
28 float set_i;
29 uint8_t mode;
30 bool output;
31 bool online;
32 bool ok;
33 uint8_t trip;
34 uint16_t samples;
35 uint32_t taken_ms;
37
43typedef struct {
44 uint16_t number;
45 bool current;
46 bool voltage;
47 uint8_t clipped;
48 int16_t mean_ma;
49 int16_t max_ma;
50 int16_t min_ma;
51 uint16_t mean_mv;
53 uint16_t min_mv;
59 uint32_t taken_ms;
61
66#define SERVO_TEST_ENC_HIST 16u
67
69typedef struct {
70 uint32_t ms;
71 uint16_t raw;
73
75typedef struct {
76 bool valid;
78 uint16_t raw;
79 uint16_t still_ms;
81 uint32_t taken_ms;
82 bool gap;
85 bool no_magnet;
87 bool weak,
90
100float servo_test_enc_deg(uint16_t raw, uint16_t centre);
101
108float servo_test_enc_wrap(float deg);
109
111typedef struct {
112 bool set;
113 float set_v,
115 bool on;
116 bool off;
117 bool command;
118 uint16_t cmd_us;
119 bool release;
121
123typedef struct {
124 bool armed;
125 float v_max;
128
129/* --------------------------------------------------- what it hands out */
130
134#define SERVO_TEST_LINE_MAX 224u
135
144
145#ifdef __cplusplus
146}
147#endif
float servo_test_enc_wrap(float deg)
deg on the circle: -180 to just under 180.
Definition servo_test.c:61
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....
Definition servo_test.c:52
servo_test_out_t
Definition servo_test_io.h:136
@ SERVO_TEST_OUT_OPEN
Definition servo_test_io.h:138
@ SERVO_TEST_OUT_END
Definition servo_test_io.h:141
@ SERVO_TEST_OUT_TXT
Definition servo_test_io.h:140
@ SERVO_TEST_OUT_CSV
Definition servo_test_io.h:139
@ SERVO_TEST_OUT_OPEN_TXT
Definition servo_test_io.h:142
What the run wants done, from servo_test_step().
Definition servo_test_io.h:111
bool release
Definition servo_test_io.h:119
bool on
Definition servo_test_io.h:115
bool set
Definition servo_test_io.h:112
uint16_t cmd_us
Definition servo_test_io.h:118
bool command
Definition servo_test_io.h:117
float set_v
Definition servo_test_io.h:113
bool off
Definition servo_test_io.h:116
float set_i
Definition servo_test_io.h:114
A kept reading.
Definition servo_test_io.h:69
uint32_t ms
Definition servo_test_io.h:70
uint16_t raw
Definition servo_test_io.h:71
One reading of the output encoder, as the SENSE page has it.
Definition servo_test_io.h:75
uint16_t still_ms
Definition servo_test_io.h:79
bool valid
Definition servo_test_io.h:76
uint16_t raw
Definition servo_test_io.h:78
bool strong
Definition servo_test_io.h:88
bool weak
Definition servo_test_io.h:87
bool gap
Definition servo_test_io.h:82
uint32_t taken_ms
Definition servo_test_io.h:81
bool no_magnet
Definition servo_test_io.h:85
What the caller knows each step.
Definition servo_test_io.h:123
float v_max
Definition servo_test_io.h:125
One reading of the supply, as SUPPLY has it (supply_state_t).
Definition servo_test_io.h:25
float set_v
Definition servo_test_io.h:27
float i
Definition servo_test_io.h:26
float set_i
Definition servo_test_io.h:28
uint16_t samples
Definition servo_test_io.h:34
bool online
Definition servo_test_io.h:31
uint8_t trip
Definition servo_test_io.h:33
bool ok
Definition servo_test_io.h:32
uint32_t taken_ms
Definition servo_test_io.h:35
uint8_t mode
Definition servo_test_io.h:29
bool output
Definition servo_test_io.h:30
One 50ms window of INA3221 CH1, as the window ring carries it (sense_link_win_t).
Definition servo_test_io.h:43
uint8_t clipped
Definition servo_test_io.h:47
bool current
Definition servo_test_io.h:45
uint32_t taken_ms
The latest it can have closed, on the run's clock (sense_link_win_t.taken_ms): windows that arrive to...
Definition servo_test_io.h:59
uint16_t mean_mv
Definition servo_test_io.h:51
int16_t min_ma
Definition servo_test_io.h:50
int16_t mean_ma
Definition servo_test_io.h:48
uint16_t min_mv
Definition servo_test_io.h:53
uint16_t number
Definition servo_test_io.h:44
int16_t max_ma
Definition servo_test_io.h:49
bool voltage
Definition servo_test_io.h:46