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

The feature menu: a grid of tiles under the band. More...

#include "overview_screen.h"
#include <string.h>
#include "ui_icons.h"
#include "link_pages.h"
#include "ui_text.h"
#include "ui_theme.h"
#include "ui_widgets.h"

Data Structures

struct  tile_t
struct  [struct].s
 Driver state of the UART: the claimed machines and the pins. More...

Macros

#define W   UI_PANEL_W
 The panel's width, UI_PANEL_W px.
#define H   UI_BODY_H
 The body's height under the band, UI_BODY_H px.
#define COLS   4
 The grid: four columns by two rows of 243 x 255px tiles (36.5 x 38.3mm at 0.150mm a pixel) with 10px margins under the 60px band. COLS and ROWS are the grid, M its margin, TW and TH a tile's size.
#define ROWS   2
#define M   10
#define TW   ((W - (COLS + 1) * M) / COLS)
#define TH   ((H - (ROWS + 1) * M) / ROWS)
#define T_ICON_DY   30
 Inside a tile, from its top: the 40px icon box at 30, the name in the head face (20 x 36) at 84, the line in the label face (10 x 20) at 128, a broken line's second row 24px under it. A row of the line holds 22 characters, 220 of the 227px inside the tile's UI_TILE_PAD.
#define T_ICON   40
#define T_NAME_DY   84
#define T_LINE_DY   128
#define T_LINE_PITCH   24
#define MARK_W   120
 The SIMULATED mark: at least 120 x 32px, 184px under the tile's top, its word in the label face (10 x 20) MARK_INSET px from its left edge, past the dot, and 8px from its right edge. On the lower row it ends at panel y 551, 5px above the alert band, so an alert hides no mark.
#define MARK_H   32
#define MARK_INSET   UI_PILL_INSET
#define MARK_DY   184
#define N_OF(a)
#define SLOTS   (COLS * ROWS)

Functions

static const tile_t * tile_in (int i)
ui_screen_id_t overview_screen_tile (int slot)
const char * overview_screen_tile_name (int slot)
const char * overview_screen_tile_line (int slot)
int overview_screen_columns (void)
void overview_invalidate (void)
void overview_screen_set_supply_real (bool real)
static void reset (void)
static gfx_rect_t tile_rect (int i)
gfx_rect_t overview_screen_tile_rect (int slot)
static int tile_at (int x, int y)
static void event (const touch_event_t *evt)
static void render (gfx_canvas_t *c, int buffer_index)
static void cancel (void)
const ui_screen_t * overview_screen (void)

Variables

static const ui_tile_look_t k_look
 The menu tile's look, from the figures above.
static const tile_t k_workbenches []
static const tile_t k_instruments []
static const tile_t k_last_column []
static struct  s
static bool s_supply_real
static const ui_screen_t k_screen

Detailed Description

The feature menu: a grid of tiles under the band.

SPDX-License-Identifier: MIT

Macro Definition Documentation

◆ COLS

#define COLS   4

The grid: four columns by two rows of 243 x 255px tiles (36.5 x 38.3mm at 0.150mm a pixel) with 10px margins under the 60px band. COLS and ROWS are the grid, M its margin, TW and TH a tile's size.

the grid's columns

◆ M

#define M   10

the margin around and between tiles, px

◆ MARK_DY

#define MARK_DY   184

its top from the tile's, px

◆ MARK_H

#define MARK_H   32

its height, px

◆ MARK_INSET

#define MARK_INSET   UI_PILL_INSET

its word's start, past the dot, px

◆ MARK_W

#define MARK_W   120

The SIMULATED mark: at least 120 x 32px, 184px under the tile's top, its word in the label face (10 x 20) MARK_INSET px from its left edge, past the dot, and 8px from its right edge. On the lower row it ends at panel y 551, 5px above the alert band, so an alert hides no mark.

its least width, px

◆ N_OF

#define N_OF ( a)
Value:
((int)(sizeof(a) / sizeof((a)[0])))

◆ ROWS

#define ROWS   2

the grid's rows

◆ T_ICON

#define T_ICON   40

the icon box's side, px

◆ T_ICON_DY

#define T_ICON_DY   30

Inside a tile, from its top: the 40px icon box at 30, the name in the head face (20 x 36) at 84, the line in the label face (10 x 20) at 128, a broken line's second row 24px under it. A row of the line holds 22 characters, 220 of the 227px inside the tile's UI_TILE_PAD.

the icon box's top, px

◆ T_LINE_DY

#define T_LINE_DY   128

the line's top, px

◆ T_LINE_PITCH

#define T_LINE_PITCH   24

a second row under the first, px

◆ T_NAME_DY

#define T_NAME_DY   84

the name's top, px

◆ TH

#define TH   ((H - (ROWS + 1) * M) / ROWS)

a tile's height, px: 255

◆ TW

#define TW   ((W - (COLS + 1) * M) / COLS)

a tile's width, px: 243

Function Documentation

◆ overview_screen_columns()

int overview_screen_columns ( void )

The grid's columns: 4.

◆ overview_screen_set_supply_real()

void overview_screen_set_supply_real ( bool real)

Whether SUPPLY drives the PD mini; the tile is marked MODELLED while it does not.

◆ overview_screen_tile()

ui_screen_id_t overview_screen_tile ( int slot)

The screen the tile in slot slot opens, row by row from the top left, or SCREEN_COUNT for an empty slot or one past the grid.

◆ overview_screen_tile_name()

const char * overview_screen_tile_name ( int slot)

The tile's name and its line in the language in force, NULL for an empty slot.

◆ overview_screen_tile_rect()

gfx_rect_t overview_screen_tile_rect ( int slot)

The slot's rectangle in the screen's own coordinates.

Variable Documentation

◆ k_instruments

const tile_t k_instruments[]
static
Initial value:
= {
{ SCREEN_ANALYSER, "RECEIVER", TX_OV_RECEIVER, ui_icon_chart,
{ SCREEN_BATTERY, "BATTERY", TX_OV_BATTERY, ui_icon_battery,
LINK_CAP_CELLS, false },
{ SCREEN_BALANCE, "BALANCE", TX_OV_BALANCE, ui_icon_balance,
}
void ui_icon_chart(gfx_canvas_t *c, int x, int y, int size, gfx_color_t color)
The chart glyph: a trace over its axes.
Definition ui_icons.c:90
void ui_icon_balance(gfx_canvas_t *c, int x, int y, int size, gfx_color_t color)
The balance glyph: a disc with an off-centre mass and two correction ticks.
Definition ui_icons.c:201
void ui_icon_battery(gfx_canvas_t *c, int x, int y, int size, gfx_color_t color)
The battery glyph: a cell with its terminal and three bars.
Definition ui_icons.c:182

◆ k_last_column

const tile_t k_last_column[]
static
Initial value:
= {
{ SCREEN_LOGS, "LOGS", TX_OV_LOGS, ui_icon_record,
0, false },
{ SCREEN_SETUP, "SETUP", TX_OV_SETUP, ui_icon_sliders,
0, false },
}
void ui_icon_sliders(gfx_canvas_t *c, int x, int y, int size, gfx_color_t color)
The settings glyph: three sliders.
Definition ui_icons.c:160
void ui_icon_record(gfx_canvas_t *c, int x, int y, int size, gfx_color_t color)
The record glyph: a recorder with its tray.
Definition ui_icons.c:114

◆ k_look

const ui_tile_look_t k_look
static
Initial value:
= {
.icon_dy = T_ICON_DY, .icon = T_ICON, .name_dy = T_NAME_DY,
.line_dy = T_LINE_DY, .line_pitch = T_LINE_PITCH,
.name_f = &gfx_font_20x36, .line_f = &gfx_font_10x20,
}
const gfx_font_t gfx_font_20x36
20x36 monospaced, ASCII 0x20..0x7E and the German letters. Cap height 23px. Headings,...
const gfx_font_t gfx_font_10x20
10x20 monospaced, ASCII 0x20..0x7E and the German letters. Cap height 12px. Labels,...
#define T_LINE_DY
Definition overview_screen.c:45
#define T_ICON
Definition overview_screen.c:43
#define T_NAME_DY
Definition overview_screen.c:44
#define T_LINE_PITCH
Definition overview_screen.c:46
#define T_ICON_DY
Inside a tile, from its top: the 40px icon box at 30, the name in the head face (20 x 36) at 84,...
Definition overview_screen.c:42

The menu tile's look, from the figures above.

◆ k_screen

const ui_screen_t k_screen
static
Initial value:
= {
.title = "rcbench",
.reset = reset,
.enter = NULL,
.leave = NULL,
.tick = NULL,
.event = event,
.cancel = cancel,
.render = render,
}
static void event(const touch_event_t *evt)
One touch event: the tabs are the screen's one control.
Definition analyser_screen.c:242
static void cancel(void)
The panel could not hand over every touch event, so this screen's record of the glass is stale.
Definition analyser_screen.c:658
static void reset(void)
The screen's state cleared: CHANNELS shown, nothing decoded, the tabs laid out.
Definition analyser_screen.c:176
static void render(gfx_canvas_t *c, int buffer_index)
The screen drawn on a revision not yet drawn: both cards once per framebuffer, then the tabs,...
Definition analyser_screen.c:618

◆ k_workbenches

const tile_t k_workbenches[]
static
Initial value:
= {
{ SCREEN_MOTOR, "MOTOR & ESC", TX_OV_MOTOR, ui_icon_motor,
{ SCREEN_SERVO, "SERVO", TX_OV_SERVO, ui_icon_servo,
{ SCREEN_SUPPLY, "SUPPLY", TX_OV_SUPPLY, ui_icon_supply,
0, true },
}
void ui_icon_supply(gfx_canvas_t *c, int x, int y, int size, gfx_color_t color)
The supply glyph: a bench supply's front.
Definition ui_icons.c:217
void ui_icon_servo(gfx_canvas_t *c, int x, int y, int size, gfx_color_t color)
The servo glyph: a case and its horn.
Definition ui_icons.c:55
void ui_icon_motor(gfx_canvas_t *c, int x, int y, int size, gfx_color_t color)
The motor glyph: a stator ring and its hub.
Definition ui_icons.c:37