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

ESC STICK's pages drawn. More...

#include "esc_stick_panel.h"
#include <stdio.h>
#include "esc_profile.h"
#include "settings.h"
#include "ui_keypad.h"
#include "ui_text.h"
#include "ui_textkey.h"
#include "ui_theme.h"
#include "ui_widgets.h"
#include "esc_stick_panel_int.h"

Macros

#define SP_TAG_H   28
 The red MANUAL tag's height, px: drawn, not tapped.

Functions

static DRAWER void sp_draw_find (gfx_canvas_t *c)
 The search field: what is searched for, or SEARCH; X clears it while the keyboard is closed.
static int sp_tag_w (void)
 The red MANUAL tag's width, px.
static int sp_draw_tag (gfx_canvas_t *c, int right, int y)
 The red MANUAL tag, its right edge at right, in the middle of the row from y; its width, px.
static void sp_amps (char *out, size_t n, const esc_model_t *m)
 "55A" and "25V" or "25.2V" for a model's current and voltage; "-" where it states none.
static void sp_volts (char *out, size_t n, const esc_model_t *m)
 Writes a model's voltage as "25V" or "25.2V" into out, "-" where it states none.
static void sp_mark_runs (gfx_canvas_t *c, gfx_rect_t r, bool runs)
 The run mark of a narrowed row: filled in the accent, or a ring.
static DRAWER void sp_draw_maker (gfx_canvas_t *c, gfx_rect_t r, const sp_maker_t *m, bool dock, bool searching)
 A maker's row: its name, the MANUAL tag where a model it lists has manual steps, and its models: those that run of all, or while a search is typed those found of all and those of them that run.
static DRAWER void sp_draw_model (gfx_canvas_t *c, gfx_rect_t r, const sp_row_t *row, bool dock)
 A model's row: its name, current and voltage, its family, the MANUAL tag, and what its family's profile is or why it does not run.
static DRAWER void sp_draw_list (gfx_canvas_t *c)
 The list: the crumb and the search field above, a level's rows, and the footer: the count at the right under the rows, or beside the docked keyboard at the left; the line that no profile is verified while the keyboard is closed.
static const char * sp_mark (ui_text_id_t id)
 A word after a space, as the supply line carries " (profile)".
uint32_t sp_entry_shown (void)
 The entry time the page shows, ms.
static int sp_side_room (int y)
 The lines of text that fit from y to SIDE_B at LINE_P.
static void sp_side (gfx_canvas_t *c, const char *title, const char *count, bool up, bool dn)
 The side column's card and its page keys' row: title at the left, count right-aligned before "^" and "v" where it is not NULL.
static void sp_parm_card (gfx_canvas_t *c)
 The parameter card, left of the side column.
static void sp_row_shade (gfx_canvas_t *c, int i)
 Row i's picked shade, behind its name, value and keys.
static void sp_setting_text (setting_id_t id, char *out, size_t n)
 Writes a setting's value with its unit into out; the voltage reads as the profile's own when set to 0.
static DRAWER void sp_draw_timing (gfx_canvas_t *c)
 TIMING: the settings in the parameter card; in the side column the title and the page keys, the note that the values are defaults, and the picked setting's label and help; DEFAULTS and CLOSE at the foot.
static int sp_device_lines (gfx_canvas_t *c, int x, int y, int cells, bool split)
 How the profile's menu works and the supply and entry time a run uses: in the side column each part on lines of its own, wrapped to cells; across the run's device card one line of each.
static DRAWER void sp_draw_values (gfx_canvas_t *c, const esc_item_t *it, int y)
 An item's values in the side column from y: each on lines of its own where all of them fit so, else one after another, wrapped, the last line ending in ".." where they go on.
static DRAWER void sp_draw_items (gfx_canvas_t *c)
 A profile's items in the parameter card; in the side column CHANGE and the page keys, MANUAL INTERVENTION REQUIRED, how the menu works, and the picked item's values and where it applies; the note and RUN at the foot.
static DRAWER void sp_draw_crumb (gfx_canvas_t *c)
 The profile page's crumb: BACK and the profile's name in SP_FONT_CRUMB, up to TIMING where the page shows it.
static DRAWER void sp_draw_run_cards (gfx_canvas_t *c)
 A run's and a result's two cards across the body: the device card with how the profile's menu works and the supply and entry time, and the run's card under it; TIMING in the crumb row, dark.
static void sp_draw_device (gfx_canvas_t *c)
 The profile page, or TIMING, or TIMING's keypad alone while it is open. Its parts are drawn one after another, so none of their buffers is on the stack below the stage drawn last.
void esc_stick_panel_render (gfx_canvas_t *c)
 Draws the page set by the stage: the manual steps, the prompt, the warning, the list or the profile's page.

Detailed Description

ESC STICK's pages drawn.

ESC STICK's pages drawn: the search field, the makers and the models of the list, the TIMING page, a profile's items, the crumb row, the device card, and the render that picks what to draw. The state and the seam are esc_stick_panel_int.h.

SPDX-License-Identifier: MIT

Function Documentation

◆ esc_stick_panel_render()

void esc_stick_panel_render ( gfx_canvas_t * c)

Draws the page set by the stage: the manual steps, the prompt, the warning, the list or the profile's page.

Parameters
cthe canvas

◆ sp_device_lines()

int sp_device_lines ( gfx_canvas_t * c,
int x,
int y,
int cells,
bool split )
static

How the profile's menu works and the supply and entry time a run uses: in the side column each part on lines of its own, wrapped to cells; across the run's device card one line of each.

Parameters
cThe canvas.
xThe lines' left.
yThe first line's top.
cellsA line's cells.
splitEach part of how the menu works on its own lines.
Returns
The top of the line under the last one drawn.

◆ sp_draw_device()

void sp_draw_device ( gfx_canvas_t * c)
static

The profile page, or TIMING, or TIMING's keypad alone while it is open. Its parts are drawn one after another, so none of their buffers is on the stack below the stage drawn last.

Parameters
cThe canvas.

◆ sp_draw_run_cards()

DRAWER void sp_draw_run_cards ( gfx_canvas_t * c)
static

A run's and a result's two cards across the body: the device card with how the profile's menu works and the supply and entry time, and the run's card under it; TIMING in the crumb row, dark.

Parameters
cThe canvas.

◆ sp_draw_values()

DRAWER void sp_draw_values ( gfx_canvas_t * c,
const esc_item_t * it,
int y )
static

An item's values in the side column from y: each on lines of its own where all of them fit so, else one after another, wrapped, the last line ending in ".." where they go on.

Parameters
cThe canvas.
itThe item.
yThe first line's top.

◆ sp_entry_shown()

uint32_t sp_entry_shown ( void )

The entry time the page shows, ms.

Returns
the entry time, ms

◆ sp_mark()

const char * sp_mark ( ui_text_id_t id)
static

A word after a space, as the supply line carries " (profile)".

Parameters
idThe word.
Returns
It with a space before it, in a static buffer.

◆ sp_row_shade()

void sp_row_shade ( gfx_canvas_t * c,
int i )
static

Row i's picked shade, behind its name, value and keys.

Parameters
cThe canvas.
iThe row on the page.

◆ sp_side()

void sp_side ( gfx_canvas_t * c,
const char * title,
const char * count,
bool up,
bool dn )
static

The side column's card and its page keys' row: title at the left, count right-aligned before "^" and "v" where it is not NULL.

Parameters
cThe canvas.
titleThe row's title.
countThe rows shown of how many, or NULL.
upWhether "^" pages.
dnWhether "v" pages.

◆ sp_side_room()

int sp_side_room ( int y)
static

The lines of text that fit from y to SIDE_B at LINE_P.

Parameters
yThe first line's top.
Returns
The lines, 0 where none fits.