|
rcbench
Servo and ESC test bench: panel, IOmcu and shared C
|
Settings: a hub of tiles, one per category and one per screen SETUP opens, and a category's entries in a list across the screen. The rows are rendered from the schema in shared/settings, so adding a setting is a table row and not a screen change; adding a tile is a row of the screen's tile table. More...
#include <stdbool.h>#include <stddef.h>#include <stdint.h>#include "settings.h"#include "ui_keypad.h"#include "ui_screen.h"#include "ui_textkey.h"Go to the source code of this file.
Macros | |
| #define | SETTINGS_HUB_SLOTS 9 |
| #define | SETTINGS_WARN_LINES 10 |
Enumerations | |
| enum | settings_row_part_t { SETTINGS_ROW_MINUS = 0 , SETTINGS_ROW_VALUE , SETTINGS_ROW_PLUS } |
The parts of list row row a tap acts on, in the screen's own coordinates at the list's present scroll: the "-" key, the value between the keys and the "+" key, each over the row's height. More... | |
Functions | |
| void | settings_apply_ui (void) |
| const ui_screen_t * | settings_screen (void) |
| void | settings_screen_invalidate (void) |
| void | settings_screen_set_unheld (uint16_t sense_rows, uint8_t tone_rows) |
| void | settings_screen_set_hitec_rx (uint8_t mark) |
| bool | settings_screen_unheld (setting_id_t id) |
| const char * | settings_screen_help (setting_id_t id) |
| int | settings_screen_scroll (int *max) |
| How far the open category's list is scrolled. | |
| gfx_rect_t | settings_screen_list_rect (void) |
| The open list's pane, in the screen's own coordinates (the body under the band): the rows show inside it and nowhere else. | |
| gfx_rect_t | settings_screen_row_rect (int row) |
Where list row row lies at the list's present scroll, in the screen's own coordinates; partly or wholly outside the pane for a row scrolled out of it. | |
| gfx_rect_t | settings_screen_row_part (int row, settings_row_part_t part) |
Where part of list row row lies; settings_row_part_t says which part. Whether the row has keys or a keypad is the row's own: the rectangle is where they are when it does. | |
| int | settings_screen_row_of (setting_cat_t cat, int index) |
| int | settings_screen_text_row (setting_cat_t cat, setting_text_id_t id) |
| int | settings_screen_rows (setting_cat_t cat) |
| const ui_textkey_t * | settings_screen_textkey (void) |
| const ui_keypad_t * | settings_screen_keypad (void) |
| The keypad a tap on a number's value opens: over the list and the strip until OK sets the value (settings_set(), as a step does), CANCEL or the home tag drops it, or SETUP is left. | |
| int | settings_screen_keypad_setting (void) |
| The setting the open keypad types. | |
| int | settings_screen_category (void) |
| bool | settings_hub_slot (int index, gfx_rect_t *out) |
| int | settings_hub_tiles (void) |
| bool | settings_screen_opens (ui_screen_id_t id) |
| bool | settings_screen_warning (void) |
| bool | settings_screen_warn_line (int i, char *line, size_t n) |
Settings: a hub of tiles, one per category and one per screen SETUP opens, and a category's entries in a list across the screen. The rows are rendered from the schema in shared/settings, so adding a setting is a table row and not a screen change; adding a tile is a row of the screen's tile table.
SPDX-License-Identifier: MIT
| #define SETTINGS_HUB_SLOTS 9 |
The hub's slots: a grid of three by three tiles, one page.
| #define SETTINGS_WARN_LINES 10 |
The warning's change lines: SETTINGS_WARN_LINES fit.
| enum settings_row_part_t |
The parts of list row row a tap acts on, in the screen's own coordinates at the list's present scroll: the "-" key, the value between the keys and the "+" key, each over the row's height.
| Enumerator | |
|---|---|
| SETTINGS_ROW_MINUS | the "-" or "<" key |
| SETTINGS_ROW_VALUE | the value: a tap opens the keypad |
| SETTINGS_ROW_PLUS | the "+" or ">" key |
| void settings_apply_ui | ( | void | ) |
Push the display-related settings – language, theme, brightness and contrast – into the interface and repaint every screen. Call at startup, and whenever an application setting changes.
| bool settings_hub_slot | ( | int | index, |
| gfx_rect_t * | out ) |
Where the hub draws its entry index, in the screen's own coordinates (the body under the band), into out when it is not NULL. False for an index outside 0 to SETTINGS_HUB_SLOTS - 1: a tenth entry has no slot on the page.
| int settings_hub_tiles | ( | void | ) |
The entries of the hub's tile table: its categories and its screens.
| int settings_screen_category | ( | void | ) |
The category whose list is open, or -1 while the hub's tiles show.
| const char * settings_screen_help | ( | setting_id_t | id | ) |
The help line of the row of id: PD mini TX and RX on one pin first, then a mark's line, then the setting's help. Hitec D receive's help follows its value: PULL-UP the setting's, PRECHARGE its own.
| const ui_keypad_t * settings_screen_keypad | ( | void | ) |
The keypad a tap on a number's value opens: over the list and the strip until OK sets the value (settings_set(), as a step does), CANCEL or the home tag drops it, or SETUP is left.
| int settings_screen_keypad_setting | ( | void | ) |
The setting the open keypad types.
| gfx_rect_t settings_screen_list_rect | ( | void | ) |
The open list's pane, in the screen's own coordinates (the body under the band): the rows show inside it and nowhere else.
| bool settings_screen_opens | ( | ui_screen_id_t | id | ) |
Whether a tile of the hub opens screen id. The home tag of such a screen leads back to SETUP rather than to the menu.
| int settings_screen_row_of | ( | setting_cat_t | cat, |
| int | index ) |
The list row that shows the index-th setting of cat (as settings_in_category() orders them), or -1 past the last and for a setting not listed (SENSORS' rows of a part not fitted). A category with section headings has a row for each, above its section, so the row is the index plus the headings above it.
| gfx_rect_t settings_screen_row_part | ( | int | row, |
| settings_row_part_t | part ) |
Where part of list row row lies; settings_row_part_t says which part. Whether the row has keys or a keypad is the row's own: the rectangle is where they are when it does.
| row | The row, from 0. |
| part | The part. |
| gfx_rect_t settings_screen_row_rect | ( | int | row | ) |
Where list row row lies at the list's present scroll, in the screen's own coordinates; partly or wholly outside the pane for a row scrolled out of it.
| row | The row, from 0. |
| int settings_screen_rows | ( | setting_cat_t | cat | ) |
The rows of cat's list: its settings, its headings and its strings.
| int settings_screen_scroll | ( | int * | max | ) |
How far the open category's list is scrolled.
| max | Its scroll range into, when not NULL: 0 for a list that fits its 428px. |
| void settings_screen_set_hitec_rx | ( | uint8_t | mark | ) |
What the IOmcu holds of Hitec D receive (SET_HITEC_RX), a hitec_rx_link_mark_t: HITEC_RX_LINK_HELD draws the row plain, the others mark it as an unheld row; HITEC_RX_LINK_OLD says in its help line that the IOmcu receives with PULL-UP.
| void settings_screen_set_unheld | ( | uint16_t | sense_rows, |
| uint8_t | tone_rows ) |
The INTERFACES rows whose value the IOmcu does not hold: sense_rows is sense_link_unheld()'s SENSE_LINK_ROW_* and tone_rows tone_link_unheld()'s TONE_LINK_ROWS_*. Such a row is drawn marked – its edge and its value in the warning colour, and "Not taken by the
IOmcu" in place of its help line – until a call names it no longer. Sensor SDA and Sensor SCL are one mark: the pins are one frame.
| int settings_screen_text_row | ( | setting_cat_t | cat, |
| setting_text_id_t | id ) |
The list row that shows string id of cat, after its settings (settings_texts_in_category()), or -1 for a string not in cat.
| const ui_textkey_t * settings_screen_textkey | ( | void | ) |
The keyboard a string's row opens, in folder mode for SD CARD's log folders (ui_textkey.h): open over the list and the strip until OK takes the text, CANCEL or the home tag drops it, or SETUP is left. OK sets the string as an edit; SAVE keeps it.
| bool settings_screen_unheld | ( | setting_id_t | id | ) |
Whether the row of id is marked by settings_screen_set_unheld() or settings_screen_set_hitec_rx().
| bool settings_screen_warn_line | ( | int | i, |
| char * | line, | ||
| size_t | n ) |
Line i of the warning's changes into line, as drawn: "name: saved
-> now", the values as the list shows them, each with its unit; the values in schema order, then the strings. With more changes than SETTINGS_WARN_LINES, the last line counts the rest. False past the last line, and while the warning does not show.
| bool settings_screen_warning | ( | void | ) |
Whether the warning shows: the home tag left SETUP with settings unsaved and no save asked (settings_dirty() and not settings_save_asked()), and nothing has answered it yet. STAY, the home tag again, SAVE, DISCARD and any change of screen close it.