rcbench
Servo and ESC test bench: panel, IOmcu and shared C
Loading...
Searching...
No Matches
motor_screen_int.h
Go to the documentation of this file.
1
19#pragma once
20
21#include <stdbool.h>
22#include <stdint.h>
23
24#include "gfx.h"
25#include "prog_registry.h"
26#include "touch_types.h"
27#include "ui_screen.h"
28#include "ui_workbench.h"
29
30#define W UI_PANEL_W
31#define H UI_BODY_H
32
33/*
34 * Horizontal bands, not columns: seventeen full-height vertical lines cost
35 * about 8,160 cache-line fills on this panel, and the same pixels drawn as
36 * horizontal lines cost none.
37 */
38#define PAD UI_MARGIN
39#define INNER 10
40
48#define LEFT_W 620
49#define LEFT_X PAD
50#define RIGHT_X (LEFT_X + LEFT_W + 8)
51#define RIGHT_W (W - PAD - RIGHT_X)
53#define RC_X (RIGHT_X + 12)
54#define RC_W (RIGHT_W - 24)
55
64#define MO_STRIP_X UI_WB_STRIP_X
65#define MO_STRIP_Y (UI_WB_STRIP_Y + 2)
66#define MO_STRIP_H (UI_WB_STRIP_H + 16)
67#define MO_TAB_W (UI_WB_TAB_W + 38)
68#define MO_TAB_GAP UI_WB_TAB_GAP
69#define MO_PAGE_Y (UI_WB_PAGE_Y + 18)
70
75#define STOP_FLOOR (UI_ALERT_Y - UI_BAND_H - 4)
76
86#define MO_FONT_LABEL (&gfx_font_10x20)
87#define MO_FONT_FINE UI_FONT_FINE
88#define MO_FONT_HEAD (&gfx_font_20x36)
89#define MO_FONT_NUM (&gfx_font_num_32x44)
90
92#define TITLE_H 20
93
94/*
95 * The rail, top down: the temperatures over it on every task, four reading
96 * cards, and the CONTROL card with its totals on the title line, the
97 * TARGET row, RESET PEAKS and ARM. The TARGET row, RESET PEAKS' row and
98 * ARM are where SERVO's output card has its TARGET row, CENTRE / SWEEP /
99 * RELEASE and ARM, so ARM and DISARM are in one place on both workbenches.
100 */
101#define HDR_Y (PAD + 4)
102#define HDR_H 20
103#define HERO_Y0 (HDR_Y + HDR_H + 8)
104#define HERO_H 56
105#define HERO_GAP 4
107#define CTL_Y (HERO_Y0 + 4 * HERO_H + 4 * HERO_GAP)
108#define CTL_H (H - PAD - CTL_Y)
109#define BTN_H UI_TAP_MIN
110#define TARGET_Y (CTL_Y + TITLE_H + 8)
111#define TARGET_H UI_TAP_MIN
112#define RESET_Y (TARGET_Y + TARGET_H + 10)
113#define ARM_Y (RESET_Y + BTN_H + 10)
114#define ARM_H 60
115_Static_assert(ARM_Y + ARM_H <= STOP_FLOOR,
116 "DISARM ends above the alert band");
117_Static_assert(ARM_Y + ARM_H <= CTL_Y + CTL_H,
118 "ARM ends inside the CONTROL card");
119/* RESET PEAKS and TARGET are UI_TAP_MIN tall by their defines. */
120_Static_assert(ARM_H >= UI_TAP_MIN, "ARM is a finger tall");
121
122/*
123 * The left column on LIVE: the telemetry card, with its tag and the
124 * derived figures on the title line, PLOT | TABLE with the poll rate beside
125 * them, the legend and the plot or the table; under it the THROTTLE card,
126 * the readout on the title line, the track with a step key at each end and
127 * the hint under them, above the alert band.
128 */
129#define UP_Y MO_PAGE_Y
130#define UP_H 288
131#define LO_Y (UP_Y + UP_H + 8)
132#define LO_H (H - PAD - LO_Y)
133
134/*
135 * SETTINGS' and PROGRAM's page: the left column under the strip, down to
136 * the screen's margin. SETTINGS' keypad covers the strip as well, so no
137 * tab switches the task under an open keypad.
138 */
139#define PAGE_X LEFT_X
140#define PAGE_Y MO_PAGE_Y
141#define PAGE_W LEFT_W
142#define PAGE_H (H - PAGE_Y - PAD)
143
144_Static_assert(MO_STRIP_X + 3 * MO_TAB_W + 2 * MO_TAB_GAP + 3 <= RIGHT_X,
145 "the strip ends left of the rail");
146_Static_assert(MO_STRIP_Y + MO_STRIP_H + 3 <= MO_PAGE_Y,
147 "the strip ends above its page");
148
149/* --- motor_workbench.c: the strip and the TARGET row ---------------------- */
150
151/* What a touch event was to the strip or the TARGET row. */
152typedef enum {
153 MWB_NONE = 0, /* neither's */
154 MWB_TAKEN, /* theirs; nothing to do */
155 MWB_TASK, /* the strip switched the task */
156 MWB_TARGET, /* a tap on the TARGET row: open the choice */
157} mwb_ev_t;
158
159/* Laid out, LIVE shown (reset); a tile's entry: LIVE, unless the screen
160 * comes back from the OUTPUTS screen its TARGET row opened; touch events
161 * lost. */
162void mwb_reset(void);
163void mwb_enter(void);
164void mwb_cancel(void);
165/* The TARGET row opened the OUTPUTS screen: the navigation count to come
166 * back on. */
167void mwb_opened_outputs(void);
168ui_wb_task_t mwb_task(void);
169/* A touch event. @p strip: whether the strip takes presses (no keypad
170 * over it); @p locked: whether the TARGET row does. */
171mwb_ev_t mwb_event(const touch_event_t *evt, bool strip, bool locked);
172/* Whether the strip or the TARGET row owns a press under way. */
173bool mwb_pressed(void);
174/* Bumped when the strip's look changes. */
175uint32_t mwb_revision(void);
176void mwb_render_strip(gfx_canvas_t *c);
177void mwb_render_target(gfx_canvas_t *c, const char *value, bool warn,
178 bool locked);
179/* The strip's row with its trough, and the TARGET row. */
180gfx_rect_t mwb_strip_area(void);
181gfx_rect_t mwb_target_rect(void);
182
183/* --- motor_program_page.c: PROGRAM's list and its sessions --------------- */
184
185/* Laid out, each MOTOR session in the body under the output strip (reset);
186 * the screen entered; left (each session closes, a run ends); touch events
187 * lost; the bench armed or asked to arm; a frame. */
188void mpp_reset(void);
189void mpp_enter(void);
190void mpp_leave(void);
191void mpp_cancel(void);
192void mpp_armed(bool armed);
193void mpp_tick(float dt_s);
194/* The session shown on PROGRAM, or NULL: the list shows. */
195const prog_page_set_t *mpp_shown(void);
196/* The home tag in a session: its back() (one level up; from its top the
197 * session closes to the list). Whether there was a session. */
198bool mpp_back(void);
199/* A touch event on the list; whether it was the list's. A tap on a live
200 * row opens its session. */
201bool mpp_event(const touch_event_t *evt);
202/* Whether a press on the list is under way; drop it. */
203bool mpp_pressed(void);
204void mpp_cancel_press(void);
205/* Bumped when the list's look changes. */
206uint32_t mpp_revision(void);
207void mpp_render_page(gfx_canvas_t *c);
208/* The output strip above a full-width session (motor_output_strip()), and
209 * a number that changes whenever its text does. */
210void mpp_render_strip(gfx_canvas_t *c, uint8_t proto, uint64_t pins,
211 bool known, bool armed);
212uint32_t mpp_strip_signature(uint8_t proto, uint64_t pins, bool known,
213 bool armed);
214
215/* --- motor_settings_page.c: SETTINGS' page -------------------------------- */
216
217/* Laid out (reset); the screen left; touch events lost. */
218void msp_reset(void);
219void msp_leave(void);
220void msp_cancel(void);
221/* Whether the keypad is open over the page and the strip. */
222bool msp_modal(void);
223/* The home tag: the keypad closes, as its CANCEL does. Whether it did. */
224bool msp_back(void);
225/* A touch event on the page. @p safe: the bench is SAFE, nothing asked of
226 * it (ui_value_gate.h's OFF), and ARM is not held; the pulse rows take a
227 * press, and their keypad's OK, only then. */
228void msp_event(const touch_event_t *evt, bool safe);
229/* Whether a press of the page's is under way. */
230bool msp_pressed(void);
231/* A frame: a keypad for a pulse row closes once @p safe is false, and the
232 * save line follows the store. */
233void msp_tick(bool safe);
234/* Bumped when the page's look changes. */
235uint32_t msp_revision(void);
241void msp_render(gfx_canvas_t *c, bool safe);
gfx: an RGB565 (16-bit red, green, blue) rasteriser with no dependencies.
void mpp_render_strip(gfx_canvas_t *c, uint8_t proto, uint64_t pins, bool known, bool armed)
The strip in its row, over the clear, in PROG_FULL_STRIP_FONT: TARGET dim, the target in the text col...
Definition motor_program_page.c:319
#define MO_TAB_W
Definition motor_screen_int.h:67
#define MO_STRIP_X
The task strip at the 1024 x 600 sizes, as SERVO's: tabs of 150 x 40px, 4px apart,...
Definition motor_screen_int.h:64
#define MO_PAGE_Y
Definition motor_screen_int.h:69
#define MO_STRIP_Y
Definition motor_screen_int.h:65
void msp_render(gfx_canvas_t *c, bool safe)
SETTINGS' page in its two columns, or the keypad over it.
Definition motor_settings_page.c:361
#define CTL_Y
The CONTROL card's top: under the fourth reading card.
Definition motor_screen_int.h:107
void mwb_reset(void)
The strip and the TARGET row laid out; LIVE.
Definition motor_workbench.c:75
#define MO_TAB_GAP
Definition motor_screen_int.h:68
#define MO_STRIP_H
Definition motor_screen_int.h:66
#define STOP_FLOOR
The lowest row a control that stops what the bench drives, or a line of text, may reach: 4px above th...
Definition motor_screen_int.h:75
#define RIGHT_X
Definition motor_screen_int.h:50
#define CTL_H
Definition motor_screen_int.h:108
The registry of programmers and runs: one static table that the PROGRAM (and later TEST) lists of a w...
Definition gfx.h:129
Definition gfx.h:81
Definition prog_registry.h:129
A DOWN, MOVE or UP of one contact.
Definition touch_types.h:69
Plain data types shared by the touch controller driver, the coordinate mapper and the event tracker....
#define UI_TAP_MIN
The smallest touch target for a control, in pixels: 48px, 7.2mm.
Definition ui_layout.h:71
Screen router.
A workbench's task strip: one device, its tasks as tabs under the band.
ui_wb_task_t
Definition ui_workbench.h:39