rcbench
Servo and ESC test bench: panel, IOmcu and shared C
Toggle main menu visibility
Loading...
Searching...
No Matches
servo_limrun_int.h
Go to the documentation of this file.
1
11
#pragma once
12
13
#include "
servo_limrun.h
"
14
15
#include <stdbool.h>
16
#include <stddef.h>
17
#include <stdint.h>
18
#include <string.h>
19
21
typedef
enum
{
22
ST_NONE
= 0,
23
ST_OVERSET
,
24
ST_OVERSET_SEARCH
,
25
ST_FINAL
,
26
ST_DONE
,
27
}
limrun_stage_t
;
28
37
static
inline
int32_t
limrun_span
(
const
servo_limrun_servo_t
*sv,
38
uint8_t side)
39
{
40
const
int32_t n = (int32_t)sv->
pulse_dus
[SERVO_LIMRUN_P_NEUTRAL];
41
return
side == SERVO_LIMRUN_HI
42
? (int32_t)sv->
pulse_dus
[SERVO_LIMRUN_P_UPPER] - n
43
: n - (int32_t)sv->
pulse_dus
[SERVO_LIMRUN_P_LOWER];
44
}
45
53
static
inline
bool
limrun_restore
(
const
servo_limrun_t
*r)
54
{
55
return
r != NULL && r->state == SERVO_LIMRUN_DONE && r->
programmed
56
&& (r->verdict == SERVO_LIMRUN_FAIL
57
|| r->verdict == SERVO_LIMRUN_ABORTED);
58
}
59
68
static
inline
int32_t
span_now
(
const
servo_limrun_t
*r, uint8_t side)
69
{
70
servo_limrun_servo_t
sv;
71
memset(&sv, 0,
sizeof
(sv));
72
memcpy(sv.
pulse_dus
, r->
pulse_now
,
sizeof
(sv.
pulse_dus
));
73
return
limrun_span
(&sv, side);
74
}
servo_limrun.h
The limit run: the limit search (servo_limit.h) run on the SERVO screen against the INA3221's windows...
limrun_span
static int32_t limrun_span(const servo_limrun_servo_t *sv, uint8_t side)
Distance from NEUTRAL to a side pulse limit, 0.1us, from the pulses given. servo_limrun_span() wraps ...
Definition
servo_limrun_int.h:37
limrun_stage_t
limrun_stage_t
Where a side stands.
Definition
servo_limrun_int.h:21
ST_DONE
@ ST_DONE
Definition
servo_limrun_int.h:26
ST_OVERSET
@ ST_OVERSET
Definition
servo_limrun_int.h:23
ST_FINAL
@ ST_FINAL
Definition
servo_limrun_int.h:25
ST_NONE
@ ST_NONE
Definition
servo_limrun_int.h:22
ST_OVERSET_SEARCH
@ ST_OVERSET_SEARCH
Definition
servo_limrun_int.h:24
span_now
static int32_t span_now(const servo_limrun_t *r, uint8_t side)
The span from the pulses in force: after SERVO PULSES at 1000-2000 those written, not those read.
Definition
servo_limrun_int.h:68
limrun_restore
static bool limrun_restore(const servo_limrun_t *r)
Whether RESTORE is offered: the run is DONE and programmed, and ended as FAIL or ABORTED....
Definition
servo_limrun_int.h:53
servo_limrun_servo_t
The servo the programmer read.
Definition
servo_limrun.h:247
servo_limrun_servo_t::pulse_dus
uint16_t pulse_dus[3]
NEUTRAL, PULSE LOWER and PULSE UPPER, 0.1us.
Definition
servo_limrun.h:255
servo_limrun_t
Definition
servo_limrun.h:364
servo_limrun_t::programmed
bool programmed
Definition
servo_limrun.h:418
servo_limrun_t::pulse_now
uint16_t pulse_now[3]
Definition
servo_limrun.h:395
shared
servo
servo_limrun_int.h
Generated by
1.18.0