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

SETUP's drawing: the hub's tiles, a category's list and its rows, the SAVE strip under both, and the warning that holds the way out. settings_screen.c holds the state, the touch handling and the screen's interface (settings_screen.h); settings_screen_int.h is what the two share. More...

#include <stdio.h>
#include "sensors_rows.h"
#include "settings.h"
#include "settings_rows_int.h"
#include "settings_screen.h"
#include "ui_icons.h"
#include "ui_keypad.h"
#include "ui_text.h"
#include "ui_textkey.h"
#include "ui_widgets.h"
#include "settings_screen_int.h"

Functions

static void draw_save (gfx_canvas_t *c)
 Four states, and the label is the whole of the feedback: nothing to write (SAVED), something to write (SAVE), something asked for and waiting for a moment to write it in (WHEN IDLE), and an attempt the store refused (NOT SAVED). WHEN IDLE is seen only while the bench is armed or a transfer is running; disarmed, the write is taken on the next frame. SAVE takes the accent rather than the warning colour: RESET CATEGORY sits beside it and two amber buttons in a row read as one control. NOT SAVED takes the danger colour, because the values on this screen are not the values the next boot will load and nothing else on the panel says so. The same button on the tiles and on a list: the values are one set, not one per category.
static void draw_hub (gfx_canvas_t *c)
 Draws the hub: the tiles in a grid, a tile lit while pressed.
static void draw_text_row (gfx_canvas_t *c, int index, gfx_rect_t r, setting_text_id_t id)
 A string's row: its name and help on the left, its text on the right in the value's colour, against the row's right edge where a setting's "+" is. No keys: a tap opens the keyboard, and the row's edge takes the accent while it is pressed. The text is in the body face, or in the label face where it is wider than the gap left of it.
static void draw_row (gfx_canvas_t *c, int index)
 List row index: a heading, a string, or a setting with its value and its keys. A setting's edge takes the accent while its value is pressed.
static void draw_list (gfx_canvas_t *c)
 Draws the list of the open category: a row per setting, clipped to the pane.
static void draw_warning (gfx_canvas_t *c)
 The warning: what differs from the stored values, one line each as "name: saved -> now" with the values as the list shows them, and the three answers. DISCARD is drawn inert while the bench is ARMED, and a note says why; another says that the last save failed.
void stg_render (gfx_canvas_t *c, int buffer_index)
 SETUP drawn: the keypad alone while it is open, else the warning, or the tiles or a list over the strip, and the keyboard over them.

Variables

static const ui_tile_look_t k_hub_look
 A hub tile's look: its icon, name and line (settings_screen_int.h).

Detailed Description

SETUP's drawing: the hub's tiles, a category's list and its rows, the SAVE strip under both, and the warning that holds the way out. settings_screen.c holds the state, the touch handling and the screen's interface (settings_screen.h); settings_screen_int.h is what the two share.

SPDX-License-Identifier: MIT

Function Documentation

◆ draw_row()

void draw_row ( gfx_canvas_t * c,
int index )
static

List row index: a heading, a string, or a setting with its value and its keys. A setting's edge takes the accent while its value is pressed.

Parameters
cThe canvas.
indexThe row.

◆ stg_render()

void stg_render ( gfx_canvas_t * c,
int buffer_index )

SETUP drawn: the keypad alone while it is open, else the warning, or the tiles or a list over the strip, and the keyboard over them.

Parameters
cThe canvas.
buffer_indexThe framebuffer, whose cached chrome it follows.

Variable Documentation

◆ k_hub_look

const ui_tile_look_t k_hub_look
static
Initial value:
= {
.icon_dy = HUB_ICON_DY, .icon = HUB_ICON, .name_dy = HUB_NAME_DY,
.line_dy = HUB_LINE_DY,
.line_pitch = 0,
.name_f = STG_F_BODY, .line_f = STG_F_LABEL,
}
#define STG_F_BODY
Definition settings_screen_int.h:73
#define HUB_NAME_DY
Definition settings_screen_int.h:64
#define STG_F_LABEL
Definition settings_screen_int.h:74
#define HUB_ICON_DY
Inside a hub tile, from its top: the 36px icon box at 14, the name in the body face (12 x 24) at 60,...
Definition settings_screen_int.h:62
#define HUB_LINE_DY
Definition settings_screen_int.h:65
#define HUB_ICON
Definition settings_screen_int.h:63

A hub tile's look: its icon, name and line (settings_screen_int.h).