|
rcbench
Servo and ESC test bench: panel, IOmcu and shared C
|
The SERVO screen's sweep core and frame step. More...
#include "servo_screen.h"#include <math.h>#include "kst_panel.h"#include "outputs.h"#include "servo_limrun.h"#include "servo_sweep.h"#include "settings.h"#include "supply_screen.h"#include "ui_text.h"#include "ui_widgets.h"#include "servo_screen_core_int.h"Functions | |
| sweep_cfg_t | sweep_cfg_now (void) |
| The sweep the SWEEP page describes, under the profile in force: CURVE, SPEED and DWELL as they are, and RANGE as a share of the travel the servo may make – TRAVEL, and the nearer of PULSE MIN and MAX, so a sweep about the centre reaches neither end it may not. In the command units of the range a command carries (cmd_range()), centred on PULSE CENTRE. Trim is not applied: the sweep turns about the centre a release rests at. | |
| static float | sweep_deg (uint16_t cmd) |
| A command of the sweep, as the angle it puts the horn at. | |
| void | stop_sweep (void) |
| The sweep ended, running or paused. A pause is ended by the command that follows; the button reads SWEEP from now. | |
| void | svs_hold_sweep (void) |
| The sweep paused where the output has got to, as PAUSE does. | |
| static void | record_start (void) |
| The start or resume just posted, as it will be sent. | |
| static void | start_sweep (void) |
| Start the sweep, or carry on with a changed one from its beginning, as the IOmcu does. Only while the value is live (value_live()) and on an IOmcu that sweeps: the far end refuses one otherwise. Drawn once the start is acknowledged (servo_screen_sweep_started()). | |
| void | svs_restart_sweep (void) |
| The sweep started over under the curve the settings give now. | |
| 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. | |
| 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. | |
| static void | resume_sweep (void) |
| A tap on PAUSED: the paused sweep carried on from where it was paused. The command asks the panel for a resume; an IOmcu older than 4.6, or one that refuses, starts the curve over instead. Either way the far end stays held until then, so the horn does too, and the acknowledgement (servo_screen_sweep_started()) draws it from there. A curve changed on the TEST page since the pause is a new sweep. | |
| void | svs_toggle_sweep (void) |
| SWEEP's tap: start, pause or resume, or undo a tap whose command has not left. | |
| bool | servo_screen_sweeping (void) |
| bool | servo_screen_paused (void) |
| uint32_t | servo_screen_curve_ms (void) |
| void | servo_screen_released (uint16_t pause_seq) |
| static float | slew_per_ms (int speed_pct) |
The drawn output's slew at speed_pct, command units a millisecond, as the far end's: SPEED_FULL_SPAN_S times the share, and at 100% none – the command goes straight through (svs_slew_of()), which is negative here. | |
| static float | chase_cmd (float from, float want, float step) |
One step of the drawn output towards want, at most step command units: the slew the far end applies, as the drawing models it. A negative step is no slew: there at once. | |
| static float | shown_cmd_ago (uint32_t ago_ms) |
Where the horn was drawn ago_ms ago, from the trail; the oldest kept for anything older. | |
| static float | drawn_after (const sweep_t *w, uint32_t phase_ms, uint32_t ms, float from, int speed_pct) |
The drawn output after ms more of the sweep w from phase_ms in, starting at from: each step the curve's command, chased as tick() chases it at speed_pct – for a pause, the SPEED in force at the tap, the far end's slew until the HOLD reached it. Steps of 4ms, under a frame, so a turn of the curve is followed as the drawing follows it. | |
| void | servo_screen_sweep_started (uint16_t start_seq, uint32_t age_ms, servo_sweep_from_t from, uint32_t since_ms) |
| void | servo_screen_sweep_held (uint16_t pause_seq, uint32_t kept_ms) |
| void | servo_screen_set_sweep (bool able) |
| static void | remember_shown (void) |
| The trail servo_screen_sweep_started() reads where a frozen output was. | |
| 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. | |
The SERVO screen's sweep core and frame step.
The SERVO screen's sweep core: the curve the IOmcu runs, drawn on the screen's own clock; SWEEP and PAUSE and their acknowledgements; the far end's curve drawn on after the screen stopped drawing it as its own; and the frame step, which runs the holds, follows the supply and moves the drawn output towards the command at SPEED. The state and the seam are servo_screen_int.h and servo_screen_core_int.h.
SPDX-License-Identifier: MIT
| uint32_t servo_screen_curve_ms | ( | void | ) |
How far the sweep's curve clock is from its phase 0, paused or not. For tests, which stand in for the panel's timing.
| bool servo_screen_paused | ( | void | ) |
Whether a sweep is paused: PAUSE tapped, the hold in force, nothing else commanded since. For tests.
| void servo_screen_released | ( | uint16_t | pause_seq | ) |
The panel let go of pause pause_seq – a HOLD the far end had already ended, or one answered late – released the surfaces to their centre and dropped the commands asked during that pause. Taken only while the screen's commands still derive from that pause; one that has moved on since was sent, and the surfaces follow it.
| void servo_screen_set_sweep | ( | bool | able | ) |
Whether the IOmcu can sweep: protocol 4.2 or later. SWEEP is offered only then.
| void servo_screen_sweep_held | ( | uint16_t | pause_seq, |
| uint32_t | kept_ms ) |
The IOmcu took the HOLD of pause pause_seq (servo_cmd_t) and kept its curve kept_ms in (servo_phase_held()). The curve ran on until then, so the paused phase drawn here is set to it, not to the tap's. Nothing unless that pause still stands: one resumed before this arrives is rebased by its SERVO_SWEEP_RESUMED, and another pause's is not this one's.
| void servo_screen_sweep_started | ( | uint16_t | start_seq, |
| uint32_t | age_ms, | ||
| servo_sweep_from_t | from, | ||
| uint32_t | since_ms ) |
The IOmcu started the sweep with its curve's phase 0 age_ms ago, its output starting from from. Until this, a sweep asked for is not drawn: the far end is not known to move. From it the horn is drawn along the curve, and without feedback worked on from where that output was when the far end began to move. since_ms is, for SERVO_SWEEP_FROM_FROZEN, how long ago the far end froze, and for SERVO_SWEEP_RESUMED how long ago the resume was acknowledged; for a resume age_ms is the panel's timing of the far end's phase 0, moved on by the hold, whatever this screen took the pause's phase to be. start_seq is the sweep command whose write it acknowledges (servo_cmd_t): a start or resume waited for is ended only by its own.
| bool servo_screen_sweeping | ( | void | ) |
Whether a sweep is running, for the application and tests.
| 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 |
| 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 |
| sweep_cfg_t sweep_cfg_now | ( | void | ) |
The sweep the SWEEP page describes, under the profile in force: CURVE, SPEED and DWELL as they are, and RANGE as a share of the travel the servo may make – TRAVEL, and the nearer of PULSE MIN and MAX, so a sweep about the centre reaches neither end it may not. In the command units of the range a command carries (cmd_range()), centred on PULSE CENTRE. Trim is not applied: the sweep turns about the centre a release rests at.