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

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)

Detailed Description

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:

  • A tile opens LIVE (ui_wb_strip_open()).
  • A tab switch is no navigation level: the home tag never climbs from one task to another, and the screen keeps each task's own scroll and selection for the session.
  • Leaving the screen is the screen's: a workbench switches to SAFE in its leave(), whichever task is shown.

Pure layout and touch logic over ui_tabs; no state outside the struct.

SPDX-License-Identifier: MIT

Macro Definition Documentation

◆ UI_WB_HAS

#define UI_WB_HAS ( task)
Value:
(1u << (unsigned)(task))

The task's bit in the mask ui_wb_strip_init() takes.

Enumeration Type Documentation

◆ ui_wb_task_t

A workbench's tasks, in the order the strip draws them.

Function Documentation

◆ ui_wb_strip_cancel()

void ui_wb_strip_cancel ( ui_wb_strip_t * w)

Drop a press under way (ui_tabs_cancel()).

◆ ui_wb_strip_event()

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.

◆ ui_wb_strip_has()

bool ui_wb_strip_has ( const ui_wb_strip_t * w,
ui_wb_task_t task )

Whether the strip has task.

◆ ui_wb_strip_init()

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.

◆ ui_wb_strip_open()

void ui_wb_strip_open ( ui_wb_strip_t * w)

What a tile does: LIVE, and no press under way.

◆ ui_wb_strip_pressed()

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).

◆ ui_wb_strip_rect()

gfx_rect_t ui_wb_strip_rect ( const ui_wb_strip_t * w)

The strip's row.

Parameters
wthe strip
Returns
the tabs, without the trough's 3px around them

◆ ui_wb_strip_select()

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.

◆ ui_wb_strip_tab_rect()

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_strip_task()

ui_wb_task_t ui_wb_strip_task ( const ui_wb_strip_t * w)

The task shown now.