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

The SERVO screen's presses, dial and knob. More...

#include "servo_screen.h"
#include <math.h>
#include "servo_limrun.h"
#include "supply_screen.h"
#include "ui_screen.h"
#include "ui_slider.h"
#include "ui_text.h"
#include "ui_widgets.h"
#include "servo_screen_core_int.h"

Functions

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.
static bool on_the_dial (int px, int py, float *deg)
 Whether a touch is close enough to the horn's sweep to mean the horn.
void svs_knob_note_owner (void)
 The owners the knob yields to, latched for the frame's turn.
void servo_screen_knob_frame (void)
void svs_knob_withdraw (void)
 The knob's position command withdrawn, with the value it replaced put back.
static void drag_follow (float deg)
 The finger moved on the dial to deg: the filter's new goal, held to TRAVEL. A drag whose filter another command ended starts it again from the commanded angle, so the horn moves on from where it is. The frame commands it, and only while the value is live (svs_drag_tick()).
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_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 servo_screen_knob_cancel (void)
void servo_screen_knob (float span_fraction)
void svs_event_body (const touch_event_t *evt)
 A touch event on the screen's own controls and pages.

Detailed Description

The SERVO screen's presses, dial and knob.

The SERVO screen's presses: the controls a DOWN that stops what the bench drives reaches first, the dial, the knob, and every press, move and release on the screen's own controls. The state and the seam are servo_screen_int.h and servo_screen_core_int.h.

SPDX-License-Identifier: MIT

Function Documentation

◆ drag_follow()

void drag_follow ( float deg)
static

The finger moved on the dial to deg: the filter's new goal, held to TRAVEL. A drag whose filter another command ended starts it again from the commanded angle, so the horn moves on from where it is. The frame commands it, and only while the value is live (svs_drag_tick()).

Parameters
degthe finger's angle, degrees

◆ servo_screen_knob()

void servo_screen_knob ( float span_fraction)

Move the horn by span_fraction of its travel (-travel to +travel), from the rotary knob (knob.h). Relative to the commanded angle. Nothing happens for a zero fraction, on a disarmed bench, under a disarm waiting to be taken, while a finger is on the dial, while the dial is out of sight, or while a sweep (running or paused) or a test run owns the horn: the knob does not take the horn from them as a finger does. The dial is out of sight on every task but LIVE (TEST with or without a run's settings open, SETTINGS on any page), under any panel (keypad, keyboard, list, warning, question) and under the servo programmer. A turn that moves nothing is not kept: the first turn after an arm starts from the value the arm set. It posts the position command a touch does and never arms. It posts only into an empty slot or over a position: any other pending command (a release, an arm, a disarm) stays and the knob's motion is dropped.

◆ servo_screen_knob_cancel()

void servo_screen_knob_cancel ( void )

Withdraw the knob's position command if it is still waiting to be taken: the commanded angle returns to its value from before the knob, and a position that was pending before the knob moved it is pending again with that angle, and the output is held or idle as it was before the knob. On a bench that is disarmed by then the output is idle whatever the knob found. A command posted since, or already taken, is left alone. A disarm and a stop withdraw it themselves (servo_screen_set_armed(), servo_screen_cancel_arm()).

◆ servo_screen_knob_frame()

void servo_screen_knob_frame ( void )

Start of a frame, before its touch events: forget that a finger owned the dial or that the dial was out of sight, a sweep or a test owned the horn. The knob moves nothing in a frame in which a finger owned the dial at any point, including a press and release inside it, or in which the dial was out of sight (another task, a panel, the programmer), a sweep or a test ran at any point, even if it ended before the turn is applied: a tap on LIVE in the frame of the turn does not let the turn through.

◆ svs_arm_locked()

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.

Returns
true when ARM is locked

◆ svs_drag_on_post()

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.

Parameters
kindthe command posted
usits pulse, us

◆ svs_drag_tick()

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.

Parameters
dt_sthe time since the last frame, seconds

◆ svs_event_body()

void svs_event_body ( const touch_event_t * evt)

A touch event on the screen's own controls and pages.

Parameters
evtthe event

◆ svs_safe_at()

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.

Parameters
xthe press, panel px
ythe press, panel px
Returns
true when the DOWN goes to that control first