|
rcbench
Servo and ESC test bench: panel, IOmcu and shared C
|
A workbench's task strip: one device, its tasks as tabs under the band. More...
#include <stdbool.h>#include <stdint.h>#include "gfx.h"#include "touch_types.h"#include "ui_tabs.h"Go to the source code of this file.
Data Structures | |
| struct | ui_wb_strip_t |
Macros | |
| #define | UI_WB_HAS(task) |
| #define | UI_WB_STRIP_X 9 |
| #define | UI_WB_STRIP_Y 6 |
| #define | UI_WB_STRIP_H 24 |
| #define | UI_WB_TAB_W 112 |
| #define | UI_WB_TAB_GAP 4 |
| #define | UI_WB_PAGE_Y 38 |
Enumerations | |
| enum | ui_wb_task_t { UI_WB_LIVE = 0 , UI_WB_TEST , UI_WB_PROGRAM , UI_WB_SETTINGS , UI_WB_TASKS } |
Functions | |
| void | ui_wb_strip_init (ui_wb_strip_t *w, unsigned tasks, int16_t x, int16_t y) |
| ui_wb_task_t | ui_wb_strip_task (const ui_wb_strip_t *w) |
| bool | ui_wb_strip_has (const ui_wb_strip_t *w, ui_wb_task_t task) |
| bool | ui_wb_strip_select (ui_wb_strip_t *w, ui_wb_task_t task) |
| void | ui_wb_strip_open (ui_wb_strip_t *w) |
| bool | ui_wb_strip_event (ui_wb_strip_t *w, const touch_event_t *evt) |
| bool | ui_wb_strip_pressed (const ui_wb_strip_t *w) |
| void | ui_wb_strip_cancel (ui_wb_strip_t *w) |
| gfx_rect_t | ui_wb_strip_rect (const ui_wb_strip_t *w) |
| The strip's row. | |
| gfx_rect_t | ui_wb_strip_tab_rect (const ui_wb_strip_t *w, ui_wb_task_t task) |
| void | ui_wb_strip_render (const ui_wb_strip_t *w, gfx_canvas_t *c) |
A workbench's task strip: one device, its tasks as tabs under the band.
A workbench is a home tile that drives an output (SERVO today; MOTOR & ESC and SUPPLY reuse it). Its tasks are LIVE, TEST, PROGRAM and SETTINGS, always in that order; a task the device lacks is not drawn. The strip is the existing ui_tabs control, one row across the screen's full width, so the output card on the right stays where it is on every task.
Rules the strip carries:
Pure layout and touch logic over ui_tabs; no state outside the struct.
SPDX-License-Identifier: MIT
| #define UI_WB_HAS | ( | task | ) |
The task's bit in the mask ui_wb_strip_init() takes.
| enum ui_wb_task_t |
A workbench's tasks, in the order the strip draws them.
| void ui_wb_strip_cancel | ( | ui_wb_strip_t * | w | ) |
Drop a press under way (ui_tabs_cancel()).
| bool ui_wb_strip_event | ( | ui_wb_strip_t * | w, |
| const touch_event_t * | evt ) |
A touch event. Returns true when it switched the task: the release of a press that began on another tab, as a tap (touch_event_is_tap_up()), on the same tab.
| bool ui_wb_strip_has | ( | const ui_wb_strip_t * | w, |
| ui_wb_task_t | task ) |
Whether the strip has task.
| void ui_wb_strip_init | ( | ui_wb_strip_t * | w, |
| unsigned | tasks, | ||
| int16_t | x, | ||
| int16_t | y ) |
The strip for the tasks in tasks (UI_WB_HAS() bits), from (x, y), LIVE selected. LIVE is always there: a mask without it gets it. Bits above UI_WB_SETTINGS are ignored.
| void ui_wb_strip_open | ( | ui_wb_strip_t * | w | ) |
What a tile does: LIVE, and no press under way.
| bool ui_wb_strip_pressed | ( | const ui_wb_strip_t * | w | ) |
Whether a press on a tab is under way (the strip owns that contact).
| gfx_rect_t ui_wb_strip_rect | ( | const ui_wb_strip_t * | w | ) |
The strip's row.
| w | the strip |
| bool ui_wb_strip_select | ( | ui_wb_strip_t * | w, |
| ui_wb_task_t | task ) |
Show task. Returns whether the task shown changed; a task the strip lacks changes nothing and returns false. A press under way is dropped.
| gfx_rect_t ui_wb_strip_tab_rect | ( | const ui_wb_strip_t * | w, |
| ui_wb_task_t | task ) |
The tab of task, or an empty rectangle when the strip lacks it.
| ui_wb_task_t ui_wb_strip_task | ( | const ui_wb_strip_t * | w | ) |
The task shown now.