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

ESC STICK's profile list. More...

#include "esc_stick_panel.h"
#include <limits.h>
#include <math.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include "esc_profile.h"
#include "settings.h"
#include "supply_screen.h"
#include "ui_text.h"
#include "ui_theme.h"
#include "ui_widgets.h"
#include "esc_stick_panel_int.h"

Data Structures

struct  [struct].k_why

Functions

void sp_text (gfx_canvas_t *c, int x, int y, const char *text, int max_chars, gfx_color_t ink)
 text at (x, y) cut to max_chars, with ".." in place of what did not fit.
int esc_stick_panel_wrap_lines (const char *text, int cells)
const char * esc_stick_panel_step_text (const esc_manual_t *m)
const char * sp_action (const esc_manual_t *m)
 What a manual step asks, in the language showing.
const char * sp_when_text (const esc_manual_t *m)
 When a manual step is due, in the language showing.
const char * esc_stick_panel_why_text (const char *why)
const char * sp_why_text (const char *why)
 The engine's reason why in the language showing.
const char * sp_rating_why (const esc_profile_t *p, int model, uint32_t mv, uint32_t ma, bool by_hand, bool longer, char *buf, size_t n)
 What the supply's set points break of a model's ratings, into buf, or NULL: the short form for a row, longer for the page's note.
const char * sp_rating_warn (const esc_profile_t *p, int model, uint32_t mv, bool by_hand, bool longer, char *buf, size_t n)
 The warning for a voltage the data cannot vouch for, into buf, or NULL; the run goes ahead.
const char * sp_model_warn (const esc_profile_t *p, int model, char *buf, size_t n)
 sp_rating_warn() for model model with the settings now.
const char * sp_model_why (const esc_profile_t *p, int model, char *buf, size_t n)
 Why model model cannot run, into buf, or NULL when it can.
uint32_t sp_list_key (void)
 VOLTAGE and the SUPPLY cap, mV: what decides from outside a profile whether it runs.
static int sp_casecmp (const char *a, const char *b)
 a against b with the letters A to Z folded, as the search folds them: the makers' order and their grouping.
bool sp_model_runs (const esc_profile_t *p, int model)
 Whether model model of p runs on this bench.
static void sp_build_makers (stick_t *t)
 The first level: every maker, alphabetical with case folded, that the search finds a model of (esc_model_matches(); every one while it is empty), with its models, those found and those of them that run. A card profile joins its maker as a built-in one does.
static int sp_key_cmp (uint32_t a, uint32_t b)
 One key of the models' order: smaller first, 0 – not stated – last.
static int sp_by_model (const void *a, const void *b)
 Current, then voltage, then name with case folded; a key a model does not state sorts it last on that key. Ties keep the registry's order.
static void sp_build_models (stick_t *t)
 The second level: the open maker's models the search finds, one row a model, by current, voltage and name; each row is its family's profile. The registry holds a maker to ESC_MAKER_MODELS_MAX, SP_MODELS, so every one of them has a row.
void sp_build_list (bool keep_scroll)
 The level showing built again, from the top or, with keep_scroll, where it was.
void sp_pick_profile (const esc_profile_t *p)
 Profile p picked: its picks cleared, and its manual steps shown the first time it is opened.
int sp_items (void)
 The items the page offers.
int sp_item_at (int at)
 The profile's index of the at-th item offered, or -1.
void sp_pick_shown (void)
 The picked item kept among those shown; the first otherwise.

Variables

static const struct  k_why []
 The stick engine's refusals, English, held where the engine writes them (esc_stick.c), each with the text the screen shows in the language showing. A refusal the table does not know shows as the engine wrote it.

Detailed Description

ESC STICK's profile list.

ESC STICK's profile list: the texts a row and a page are drawn from, why a profile cannot run on this bench, the makers and the models built from the profiles and the search, and the profile picked. The state and the seam are esc_stick_panel_int.h.

SPDX-License-Identifier: MIT

Function Documentation

◆ esc_stick_panel_step_text()

const char * esc_stick_panel_step_text ( const esc_manual_t * m)

A manual step's text in the language showing: its action_de where the profile gives one and German shows, else its English action.

◆ esc_stick_panel_why_text()

const char * esc_stick_panel_why_text ( const char * why)

A refusal of the stick engine (esc_stick_kind(), esc_stick_check(), esc_stick_start()) in the language showing, found by the engine's words; one the screen does not know comes back as given, and NULL as "refused".

◆ esc_stick_panel_wrap_lines()

int esc_stick_panel_wrap_lines ( const char * text,
int cells )

The lines text takes broken as the screen breaks it, in lines of cells, one cell at least; for tests.

◆ sp_action()

const char * sp_action ( const esc_manual_t * m)

What a manual step asks, in the language showing.

Parameters
mthe manual step
Returns
the text, static

◆ sp_build_list()

void sp_build_list ( bool keep_scroll)

The level showing built again, from the top or, with keep_scroll, where it was.

Parameters
keep_scrolltrue to keep the scroll position

◆ sp_item_at()

int sp_item_at ( int at)

The profile's index of the at-th item offered, or -1.

Parameters
atthe position among the items offered
Returns
the profile's index, or -1

◆ sp_items()

int sp_items ( void )

The items the page offers.

Returns
the number of items

◆ sp_list_key()

uint32_t sp_list_key ( void )

VOLTAGE and the SUPPLY cap, mV: what decides from outside a profile whether it runs.

Returns
the key

◆ sp_model_runs()

bool sp_model_runs ( const esc_profile_t * p,
int model )

Whether model model of p runs on this bench.

Parameters
pthe profile
modelthe model's index in p
Returns
true when the model runs

◆ sp_model_warn()

const char * sp_model_warn ( const esc_profile_t * p,
int model,
char * buf,
size_t n )

sp_rating_warn() for model model with the settings now.

Parameters
pthe profile
modelthe model's index in p
bufthe buffer the text is written to
nthe size of buf, bytes
Returns
buf, or NULL when there is no warning

◆ sp_model_why()

const char * sp_model_why ( const esc_profile_t * p,
int model,
char * buf,
size_t n )

Why model model cannot run, into buf, or NULL when it can.

Parameters
pthe profile
modelthe model's index in p
bufthe buffer the text is written to
nthe size of buf, bytes
Returns
buf, or NULL when the model can run

◆ sp_pick_profile()

void sp_pick_profile ( const esc_profile_t * p)

Profile p picked: its picks cleared, and its manual steps shown the first time it is opened.

Parameters
pthe profile

◆ sp_rating_warn()

const char * sp_rating_warn ( const esc_profile_t * p,
int model,
uint32_t mv,
bool by_hand,
bool longer,
char * buf,
size_t n )

The warning for a voltage the data cannot vouch for, into buf, or NULL; the run goes ahead.

Parameters
pthe profile
modelthe model's index in p
mvthe supply voltage, mV
by_handwhether the model is run by hand
longertrue for the page's note, false for a row's short form
bufthe buffer the text is written to
nthe size of buf, bytes
Returns
buf, or NULL when there is no warning

◆ sp_rating_why()

const char * sp_rating_why ( const esc_profile_t * p,
int model,
uint32_t mv,
uint32_t ma,
bool by_hand,
bool longer,
char * buf,
size_t n )

What the supply's set points break of a model's ratings, into buf, or NULL: the short form for a row, longer for the page's note.

Parameters
pthe profile
modelthe model's index in p
mvthe supply voltage, mV
mathe supply current limit, mA
by_handwhether the model is run by hand
longertrue for the page's note, false for a row's short form
bufthe buffer the text is written to
nthe size of buf, bytes
Returns
buf, or NULL when the set points break nothing

◆ sp_text()

void sp_text ( gfx_canvas_t * c,
int x,
int y,
const char * text,
int max_chars,
gfx_color_t ink )

text at (x, y) cut to max_chars, with ".." in place of what did not fit.

Parameters
cthe canvas
xthe left edge, px
ythe top edge, px
textthe text to draw
max_charsthe most characters to draw
inkthe text colour

◆ sp_when_text()

const char * sp_when_text ( const esc_manual_t * m)

When a manual step is due, in the language showing.

Parameters
mthe manual step
Returns
the text, static

◆ sp_why_text()

const char * sp_why_text ( const char * why)

The engine's reason why in the language showing.

Parameters
whythe engine's reason
Returns
the text, static