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

The SUPPLY screen's events: a touch on the strip, the set points, the rail and OUTPUT, SETTINGS' page, the keypad and the question, and the frame's tick. supply_screen.c holds the state, the commands and the screen's interface (supply_screen.h); supply_screen_int.h is what it shares with this file and supply_draw.c. More...

#include <math.h>
#include "settings.h"
#include "supply_screen.h"
#include "ui_hero.h"
#include "ui_keypad.h"
#include "ui_screen.h"
#include "ui_slider.h"
#include "ui_tabs.h"
#include "ui_text.h"
#include "ui_widgets.h"
#include "ui_workbench.h"
#include "supply_screen_int.h"

Functions

static void open_keypad (int target, setting_id_t id)
 Opens the keypad for a set point or a setting.
static void keypad_done (ui_keypad_result_t r, float v)
 Takes the keypad's result: applies the value or closes it.
static void nudge (float dv, float di)
 A set point moved by dv volts and di amps, snapped to the caps.
static void take (const touch_event_t *evt, int code)
 Takes a press: remembers its contact and what it is on.
static void held_refused (void)
 A press on a control a programming port's hold locks: the alert band says why it takes none.
static void down (const touch_event_t *evt)
 A contact coming down: the control under it takes the press, the output and the peaks first, whatever covers the left column.
static void released (int was, int row, int x, int y)
 The release of the press, over the control it began on.
void sup_drop_press (void)
 Drops the press as a lost release: a gesture asks for nothing, except a tap on OUTPUT OFF, which is sent.
static void task_changed (void)
 The strip switched the task. A keypad open goes with the task it was opened on, typed or not, as its CANCEL does; PLOT | TABLE and the set points keep what they were. A tab switch is no navigation level.
bool sup_safe_at (int x, int y)
 Returns whether (x, y) is on OUTPUT OFF, the one control here whose press stops what the bench drives.
void sup_event (const touch_event_t *evt)
 Takes a touch event: presses, drags and releases on the screen's controls.
void sup_tick (float dt_s)
 Advances the screen by one frame: holds, repeats and the question about a live output.

Detailed Description

The SUPPLY screen's events: a touch on the strip, the set points, the rail and OUTPUT, SETTINGS' page, the keypad and the question, and the frame's tick. supply_screen.c holds the state, the commands and the screen's interface (supply_screen.h); supply_screen_int.h is what it shares with this file and supply_draw.c.

SPDX-License-Identifier: MIT

Function Documentation

◆ down()

void down ( const touch_event_t * evt)
static

A contact coming down: the control under it takes the press, the output and the peaks first, whatever covers the left column.

Parameters
evtthe DOWN event

◆ sup_event()

void sup_event ( const touch_event_t * evt)

Takes a touch event: presses, drags and releases on the screen's controls.

Parameters
evtthe event

◆ sup_safe_at()

bool sup_safe_at ( int x,
int y )

Returns whether (x, y) is on OUTPUT OFF, the one control here whose press stops what the bench drives.

Parameters
xcolumn, px
yrow, px
Returns
true when the point is on OUTPUT OFF while the output is on

◆ sup_tick()

void sup_tick ( float dt_s)

Advances the screen by one frame: holds, repeats and the question about a live output.

Parameters
dt_stime since the last tick, s