|
rcbench
Servo and ESC test bench: panel, IOmcu and shared C
|
The SERVO screen's seam between its own five files. More...
Go to the source code of this file.
Data Structures | |
| struct | rail_t |
| What the servo rail's meter reads, at the precision it is drawn with. More... | |
Macros | |
| #define | SHAFT_X (PAD + 392) |
| The output shaft, which everything on LIVE's card is drawn around. | |
| #define | SHAFT_Y ((CARD_Y + READ_LBL_Y) / 2) |
| #define | ARC_R 150 |
| #define | HORN_L 98 |
| #define | BODY_W 260 |
| #define | BODY_H 88 |
| #define | TAB_HOLE_R 12 |
| #define | TAB_MARGIN 6 |
| #define | TAB_INNER 8 |
| #define | TAB_OVER 6 |
| #define | TAB_W (TAB_MARGIN + 2 * TAB_HOLE_R + TAB_INNER + TAB_OVER) |
| #define | TAB_H BODY_H |
| #define | TAB_HOLE_DY (BODY_H / 2 - TAB_MARGIN - TAB_HOLE_R) |
| Bore's offset from the flange's centre line, px. | |
| #define | PHI(a) |
Screen angle from servo angle a: the identity, as zero is the arm pointing straight out and positive is counter-clockwise. | |
| #define | SPEED_FULL_SPAN_S (2u * OUT_SPAN) |
| SPEED's full span: two spans of OUT_SPAN a second, which is 360 degrees a second. | |
| #define | CUR_KEY_NONE INT32_MIN |
| The CURRENT row's key when it shows the dashes: INT32_MIN. | |
Enumerations | |
| enum | { PS_V = 0 , PS_A , PS_W , PS_COUNT } |
Functions | |
| bool | svs_command (float deg) |
| A position from an input, refused while the value is not live. | |
| void | svs_drop_motion (void) |
| A motion command still waiting is dropped as the bench stops driving; a release, an arm and a disarm stay. | |
| void | svs_ask_disarm (void) |
| DISARM asked of an armed bench: the value leaves LIVE now. | |
| float | svs_deg_to_us_f (float deg) |
The angle deg as a pulse, us, through the profile, the trim, REVERSE and the ends; svs_deg_to_us() rounds it. | |
| uint16_t | svs_deg_to_us (float deg) |
The angle deg as a pulse, us, rounded. | |
| servo_map_t | svs_map_now (void) |
| The mapping in force now. | |
| float | svs_map_cmd_to_us (const servo_map_t *m, float cmd) |
A command of m's range as a pulse, us. | |
| float | svs_map_us_to_deg (const servo_map_t *m, float us) |
A pulse as m's angle, degrees, held to its TRAVEL. | |
| float | svs_us_to_cmd (float us) |
| A pulse as the far end's command, 0..OUT_SPAN of the range a command carries, and back. | |
| float | svs_cmd_to_us (float cmd) |
| A far-end command, 0 to OUT_SPAN, as a pulse, us. | |
| float | svs_rest_deg (void) |
| The angle the pin drives on an armed bench while nothing commands it: the outputs layer's rest for a surface. | |
| uint16_t | svs_slew_of (int pct) |
| SPEED as the bench's slew. | |
| void | svs_hold_sweep (void) |
| The sweep paused where the output has got to, as PAUSE does. | |
| void | svs_restart_sweep (void) |
| The sweep started over under the curve the settings give now. | |
| void | svs_toggle_sweep (void) |
| SWEEP's tap: start, pause or resume, or undo a tap whose command has not left. | |
| bool | svs_same_sweep (const sweep_cfg_t *a, const sweep_cfg_t *b) |
| Whether two curves are the same: kind, rate, amplitude and dwell. | |
| bool | svs_speed_limits_sweep (void) |
| Whether SPEED is slower than the fastest change the curve asks for, so the slew and not the curve shapes the sweep. | |
| void | svs_tick_body (float dt_s) |
| The frame step: the holds, the supply followed, the sweep drawn and the drawn output moved towards the command at SPEED. | |
| int32_t | svs_fixed_of (float x, float per) |
x in units of 1/per, rounded half away from zero, held to +-10^8. | |
| rail_t | svs_rail_now (void) |
| The servo rail as its meter reads it: what arrived, at the precision it is drawn with. | |
| bool | svs_arm_locked (void) |
| Whether ARM takes no press: the programmer or a limit run holds the port and the bench is not armed. | |
| bool | svs_safe_at (int x, int y) |
| Whether a DOWN at (x, y) lands on a control whose press stops what the bench drives. | |
| void | svs_knob_note_owner (void) |
| The owners the knob yields to, latched for the frame's turn. | |
| void | svs_knob_withdraw (void) |
| The knob's position command withdrawn, with the value it replaced put back. | |
| void | svs_drag_tick (float dt_s) |
The drag's frame: the filtered target moves towards the finger's by the share a frame of dt_s takes of SV_DRAG_TAU_MS, and is commanded; nothing while the value is not live. | |
| void | svs_drag_filter_end (void) |
| The drag's filter ends where it has got to and commands nothing more. The one way it ends: a command, a value no longer live, its arrival, and every way the drag ends (svs_drag_end()). | |
| void | svs_drag_end (void) |
| The dial's drag ends before its finger lifted – a press, a release the router or the tracker made, a touch loss, leaving, an arm edge – and its filter with it (svs_drag_filter_end()). | |
| void | svs_drag_on_post (servo_cmd_kind_t kind, uint16_t us) |
A post of kind at us ends the drag's filter, unless it is the filter's own or reissue() saying the held position again. A knob command ends it even at the pulse the filter last sent. | |
| void | svs_event_body (const touch_event_t *evt) |
| A touch event on the screen's own controls and pages. | |
| void | svs_render (gfx_canvas_t *c, int buffer_index) |
The frame: what changed since buffer_index was last drawn. | |
The SERVO screen's seam between its own five files.
The SERVO screen's own seam, between the five files the screen itself is: servo_screen.c, the state, the profile, the command and the screen's hooks; servo_screen_sweep.c, the sweep and the frame step; servo_screen_link.c, what the panel reports to the screen and takes from it; servo_screen_touch.c, the presses, the dial and the knob; and servo_screen_draw.c, the drawing. It holds the dial's geometry, the rail's reading, and the functions one of the five calls of another, prefixed svs_: among them the conversions between angle, pulse and command in servo_screen.c. Nothing outside these five files includes this header; the seam with the screen's pages and panels is servo_screen_int.h, which this header includes.
SPDX-License-Identifier: MIT
| #define ARC_R 150 |
The dial's radius, px: 22.5mm.
| #define BODY_H 88 |
The case's width, px.
| #define BODY_W 260 |
The case's length, px.
| #define HORN_L 98 |
The horn's length, shaft to tip, px.
| #define PHI | ( | a | ) |
Screen angle from servo angle a: the identity, as zero is the arm pointing straight out and positive is counter-clockwise.
| #define SHAFT_X (PAD + 392) |
The output shaft, which everything on LIVE's card is drawn around.
It sits on the top face of the case, where a servo's output is, 392px into the card: the lead's left end, 298px left of it, and the +45 label's right edge, 200px right of it, stay inside the card. In y it is midway between the card's top and the readings' labels.
| #define SHAFT_Y ((CARD_Y + READ_LBL_Y) / 2) |
The shaft's row, px.
| #define TAB_H BODY_H |
flange height: the case's width, px
| #define TAB_HOLE_R 12 |
radius of a mounting bore, px
| #define TAB_INNER 8 |
between the bore and the case, px
| #define TAB_MARGIN 6 |
material outside the bore, px
| #define TAB_OVER 6 |
how far the case laps over the flange, px
| #define TAB_W (TAB_MARGIN + 2 * TAB_HOLE_R + TAB_INNER + TAB_OVER) |
flange width, px
| bool svs_arm_locked | ( | void | ) |
Whether ARM takes no press: the programmer or a limit run holds the port and the bench is not armed.
| float svs_cmd_to_us | ( | float | cmd | ) |
A far-end command, 0 to OUT_SPAN, as a pulse, us.
| cmd | the command |
| bool svs_command | ( | float | deg | ) |
A position from an input, refused while the value is not live.
| deg | the angle asked for, degrees; held to TRAVEL |
| uint16_t svs_deg_to_us | ( | float | deg | ) |
The angle deg as a pulse, us, rounded.
| deg | the angle, degrees |
| float svs_deg_to_us_f | ( | float | deg | ) |
The angle deg as a pulse, us, through the profile, the trim, REVERSE and the ends; svs_deg_to_us() rounds it.
| deg | the angle, degrees |
| void svs_drag_on_post | ( | servo_cmd_kind_t | kind, |
| uint16_t | us ) |
A post of kind at us ends the drag's filter, unless it is the filter's own or reissue() saying the held position again. A knob command ends it even at the pulse the filter last sent.
| kind | the command posted |
| us | its pulse, us |
| void svs_drag_tick | ( | float | dt_s | ) |
The drag's frame: the filtered target moves towards the finger's by the share a frame of dt_s takes of SV_DRAG_TAU_MS, and is commanded; nothing while the value is not live.
| dt_s | the time since the last frame, seconds |
| void svs_event_body | ( | const touch_event_t * | evt | ) |
A touch event on the screen's own controls and pages.
| evt | the event |
| int32_t svs_fixed_of | ( | float | x, |
| float | per ) |
x in units of 1/per, rounded half away from zero, held to +-10^8.
| x | the reading |
| per | the units in one of x's |
| float svs_map_cmd_to_us | ( | const servo_map_t * | m, |
| float | cmd ) |
A command of m's range as a pulse, us.
| m | the mapping |
| cmd | the command, 0 to OUT_SPAN |
| servo_map_t svs_map_now | ( | void | ) |
The mapping in force now.
| float svs_map_us_to_deg | ( | const servo_map_t * | m, |
| float | us ) |
A pulse as m's angle, degrees, held to its TRAVEL.
| m | the mapping |
| us | the pulse, us |
| rail_t svs_rail_now | ( | void | ) |
The servo rail as its meter reads it: what arrived, at the precision it is drawn with.
| void svs_render | ( | gfx_canvas_t * | c, |
| int | buffer_index ) |
The frame: what changed since buffer_index was last drawn.
| c | the canvas |
| buffer_index | the frame buffer drawn into |
| float svs_rest_deg | ( | void | ) |
The angle the pin drives on an armed bench while nothing commands it: the outputs layer's rest for a surface.
| bool svs_safe_at | ( | int | x, |
| int | y ) |
Whether a DOWN at (x, y) lands on a control whose press stops what the bench drives.
| x | the press, panel px |
| y | the press, panel px |
| bool svs_same_sweep | ( | const sweep_cfg_t * | a, |
| const sweep_cfg_t * | b ) |
Whether two curves are the same: kind, rate, amplitude and dwell.
| a | one curve |
| b | the other |
| uint16_t svs_slew_of | ( | int | pct | ) |
SPEED as the bench's slew.
| pct | SPEED, % |
| bool svs_speed_limits_sweep | ( | void | ) |
Whether SPEED is slower than the fastest change the curve asks for, so the slew and not the curve shapes the sweep.
| void svs_tick_body | ( | float | dt_s | ) |
The frame step: the holds, the supply followed, the sweep drawn and the drawn output moved towards the command at SPEED.
| dt_s | the time since the last frame, seconds |
| float svs_us_to_cmd | ( | float | us | ) |
A pulse as the far end's command, 0..OUT_SPAN of the range a command carries, and back.
| us | the pulse, us |