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

The seam between the files of ESC STICK's pages. More...

#include <stdbool.h>
#include <stdint.h>
#include "esc_profile.h"
#include "esc_stick.h"
#include "settings.h"
#include "ui_keypad.h"
#include "ui_textkey.h"
#include "esc_stick_int.h"

Go to the source code of this file.

Data Structures

struct  sp_maker_t
 A maker on the list's first level. More...
struct  sp_row_t
 A model on the list's second level: its profile's index in the registry and its own index in that profile. More...
struct  stick_t
 The stick class's state: the profile list, the picked profile, the run, the warning, the search, the manual steps and the rectangles the presses are matched against. More...
struct  sp_state_t
 The panel's state: the stick class's, and the phase tap's. More...

Macros

#define SP_MAX   (128)
 The profile list: SP_ROWS rows to a page, UI_TAP_MIN tall at an SP_ROW_P pitch from SP_ROW_Y0, as wide as the body less 20px a side; the footer's line under them ends 4px above the alert band.
#define SP_ROWS   7
#define SP_ROW_Y0   CARD_Y
#define SP_ROW_H   UI_TAP_MIN
#define SP_ROW_P   56
#define SP_ROW_X   (PAD + 12)
#define SP_ROW_TY   ((SP_ROW_H - 20) / 2)
#define SP_QUEUE   8
#define SP_NOTE   160
#define SP_NAME_CELLS   30
 A model's row, from its left edge: the name in SP_NAME_CELLS cells from 12px, the current and the voltage right-aligned in 56 and 64px, and the family. Right of the family, what the profile is or why it does not run: 260px, or up to SP_WHY_CELLS where a reason needs them, the family giving way.
#define SP_AMPS_X   320
#define SP_VOLTS_X   384
#define SP_FAMILY_X   460
#define SP_WHY_CELLS   ((W - 2 * PAD - 24 - 12 - SP_FAMILY_X) / SP_CELL)
 The cells right of the family's column.
#define SP_MAKER_RIGHT_W   370
 A maker's count of models, right-aligned at its row's end.
#define SP_FIND_MAX   16
 The search field in the crumb row, X at its right end, and the page keys right of it; the keyboard docks right of SP_DOCK_X below them while the field is typed in.
#define SP_KEY_W   56
#define SP_LIST_DN_X   (W - PAD - 12 - SP_KEY_W)
#define SP_LIST_UP_X   (SP_LIST_DN_X - 8 - SP_KEY_W)
#define SP_FIND_W   260
#define SP_FIND_X   (SP_LIST_UP_X - 8 - SP_FIND_W)
#define SP_CLR_W   UI_TAP_MIN
#define SP_DOCK_X   352
#define SP_TRAIL_CELLS
 The trail left of the field, in SP_FONT_CRUMB's cells.
#define SP_FOOT_Y   (SP_ROW_Y0 + (SP_ROWS - 1) * SP_ROW_P + SP_ROW_H + 4)
 The footer under the rows: the count at its right, or at its left beside the docked keyboard.
#define SP_COUNT_W   360
#define SP_MODELS   ((int)ESC_MAKER_MODELS_MAX)
 Most models one maker holds: ESC_MAKER_MODELS_MAX, so the count and the rows agree.
#define SP_TOWER_W   44
#define SP_TOWER_X   (W - PAD - 16 - SP_TOWER_W)
#define SP_TOWER_Y   (RUN_Y + 14)
#define SP_TOWER_CAP   8
#define SP_TOWER_LENS   58
#define SP_TOWER_RING   3
#define SP_TOWER_BASE   26
#define SP_LINE_CELLS   ((SP_TOWER_X - 12 - (PAD + 12)) / SP_CELL)
 What the run's and the result's lines may take left of the stack light, in SP_CELL cells: 92.
#define SP_WIDE_CELLS   ((W - 2 * PAD - 24) / SP_CELL)
 What a result's lines under the stack light may take, from its seventh line on, in SP_CELL cells: 98.
#define SP_SETTINGS   14
 The settings the TIMING page shows, in esc_stick_panel.c, and their count.
#define s   esc_stick_s
 Short name for esc_stick_s inside the five stick-class files.

Functions

size_t sp_changes (esc_stick_change_t *ch, size_t *picked)
 The picks as changes, in item order.
void sp_timing (esc_stick_timing_t *t)
 The timing as the settings hold it, the profile's own entry where it states one.
void sp_supply (uint32_t *mv, uint32_t *ma)
 The supply's set points for a run, mV and mA: VOLTAGE, or the profile's cell count when it is 0.
bool sp_supply_reads_off (void)
 Whether the supply reads off now, by the rule a run holds the supply to.
bool sp_warn_gated (void)
 Whether the warning asks a step at an unpowered ESC of the operator and may not, as the supply does not read off.
bool sp_warn_steps_fit (const esc_profile_t *p)
 Whether the warning shows every before-power step of p whole.
unsigned sp_later_steps (const esc_profile_t *p)
 The steps of p the run stops for after the warning's.
bool sp_hold_blocked (void)
 Whether HOLD TO RUN may not count.
bool sp_can_run (void)
 Whether a run can start now.
void sp_follow (void)
 What the run asks for, onto the paths an operator's own presses take.
void sp_end_hold (void)
 The warning's hold dropped, with nothing started.
void sp_end_run (esc_stick_reason_t why)
 The run ends now as why; nothing it queued survives.
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.
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 * 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.
bool sp_model_runs (const esc_profile_t *p, int model)
 Whether model model of p runs on this bench.
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.
int sp_rows_shown (int total, int scroll)
 The rows a page of ROWS_MAX shows of total from scroll.
gfx_rect_t sp_row (int i)
 Profile row i, narrowed to the left of the keyboard while it is open.
void sp_find_close (void)
 The keyboard closes; the search stays as typed.
void sp_kp_close (void)
 TIMING's keypad closes, with nothing typed taken.
uint32_t sp_entry_shown (void)
 The entry time the page shows, ms.
bool sp_red (void)
 The red light: a result on screen, until OK, of a run that ended on something not as expected.
void sp_result_head (const esc_stick_t *e, char *buf, size_t n)
 Into buf: the result's count of the selections made for certain.
void sp_result_more (const esc_stick_t *e, unsigned shown, char *buf, size_t n)
 Into buf: the changes past the first shown, as the result's last line says them.
const char * sp_left_text (const esc_stick_t *e)
 What a run waiting for a manual step asks of the operator.
void sp_draw_progress (gfx_canvas_t *c)
 A run under way drawn.
void sp_draw_result (gfx_canvas_t *c)
 A run's result drawn.
void sp_draw_warning (gfx_canvas_t *c)
 The RUN warning drawn.
void sp_draw_hand (gfx_canvas_t *c)
 A profile's manual steps drawn.
void sp_draw_prompt (gfx_canvas_t *c)
 A run's prompt for a manual step drawn.

Variables

const setting_id_t sp_settings_list [SP_SETTINGS]
 The TIMING page's settings, SP_SETTINGS of them, in the order the page lists them.
sp_state_t esc_stick_s
 The state, esc_stick_s, in esc_stick_panel.c, so its .bss stays where psram_bss.lf puts esc_stick_panel's. The files read it as s, the name it had as the one file's static: the object's own name keeps it apart from the SERVO screen's s.

Detailed Description

The seam between the files of ESC STICK's pages.

The private seam between the files of ESC STICK's pages: esc_stick_panel.c, the state, a run and the application's side; esc_stick_list.c, the profile list and its texts; esc_stick_touch.c, the presses; esc_stick_draw.c, the list and a profile's pages drawn; and esc_stick_draw_run.c, a run, the RUN warning and the manual steps drawn. The pages' own layout, the state they read and write, and the functions one calls of another, all prefixed sp_. The seam with the page set, esc_stick_pages.c, is esc_stick_int.h, which this header includes. Nothing outside these five files includes this header; the interface is esc_stick_panel.h.

SPDX-License-Identifier: MIT

Macro Definition Documentation

◆ SP_AMPS_X

#define SP_AMPS_X   320

its current's column

◆ SP_CLR_W

#define SP_CLR_W   UI_TAP_MIN

X in the field

◆ SP_COUNT_W

#define SP_COUNT_W   360

width of the footer's count, px

◆ SP_DOCK_X

#define SP_DOCK_X   352

the keyboard's left

◆ SP_FAMILY_X

#define SP_FAMILY_X   460

its family's column

◆ SP_FIND_W

#define SP_FIND_W   260

the field's width

◆ SP_FIND_X

#define SP_FIND_X   (SP_LIST_UP_X - 8 - SP_FIND_W)

its left

◆ SP_KEY_W

#define SP_KEY_W   56

"^" and "v", px

◆ SP_LIST_DN_X

#define SP_LIST_DN_X   (W - PAD - 12 - SP_KEY_W)

"v"

◆ SP_LIST_UP_X

#define SP_LIST_UP_X   (SP_LIST_DN_X - 8 - SP_KEY_W)

"^"

◆ SP_NAME_CELLS

#define SP_NAME_CELLS   30

A model's row, from its left edge: the name in SP_NAME_CELLS cells from 12px, the current and the voltage right-aligned in 56 and 64px, and the family. Right of the family, what the profile is or why it does not run: 260px, or up to SP_WHY_CELLS where a reason needs them, the family giving way.

a model's name, cells

◆ SP_NOTE

#define SP_NOTE   160

a note's bytes

◆ SP_QUEUE

#define SP_QUEUE   8

commands queued

◆ SP_ROW_H

#define SP_ROW_H   UI_TAP_MIN

a row, 48px

◆ SP_ROW_P

#define SP_ROW_P   56

its pitch

◆ SP_ROW_TY

#define SP_ROW_TY   ((SP_ROW_H - 20) / 2)

its text, from its top

◆ SP_ROW_X

#define SP_ROW_X   (PAD + 12)

a row's left

◆ SP_ROW_Y0

#define SP_ROW_Y0   CARD_Y

the first row's top

◆ SP_ROWS

#define SP_ROWS   7

rows to a page

◆ SP_TOWER_BASE

#define SP_TOWER_BASE   26

height of the base, px

◆ SP_TOWER_CAP

#define SP_TOWER_CAP   8

height of the cap, px

◆ SP_TOWER_LENS

#define SP_TOWER_LENS   58

height of each lens, px

◆ SP_TOWER_RING

#define SP_TOWER_RING   3

height of the collar under each lens, px

◆ SP_TOWER_W

#define SP_TOWER_W   44

width of the stack light, px

◆ SP_TOWER_X

#define SP_TOWER_X   (W - PAD - 16 - SP_TOWER_W)

left edge of the stack light, px

◆ SP_TOWER_Y

#define SP_TOWER_Y   (RUN_Y + 14)

the stack light's top

◆ SP_TRAIL_CELLS

#define SP_TRAIL_CELLS
Value:
((SP_FIND_X - 8 - (PAD + 12 + BACK_W + 16)) \
#define PAD
Definition analyser_screen.c:26
#define SP_FIND_X
Definition esc_stick_panel_int.h:75
#define BACK_W
Definition esc_stick_int.h:69
#define SP_CRUMB_CELL
Definition esc_stick_int.h:49

The trail left of the field, in SP_FONT_CRUMB's cells.

◆ SP_VOLTS_X

#define SP_VOLTS_X   384

its voltage's column

Function Documentation

◆ 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_can_run()

bool sp_can_run ( void )

Whether a run can start now.

Returns
true when a run can start

◆ sp_changes()

size_t sp_changes ( esc_stick_change_t * ch,
size_t * picked )

The picks as changes, in item order.

Parameters
chthe changes, ESC_STICK_MAX_CHANGES of them at most
pickedhow many were picked in all
Returns
the changes written to ch

◆ sp_draw_hand()

void sp_draw_hand ( gfx_canvas_t * c)

A profile's manual steps drawn.

Parameters
cthe canvas

◆ sp_draw_progress()

void sp_draw_progress ( gfx_canvas_t * c)

A run under way drawn.

Parameters
cthe canvas

◆ sp_draw_prompt()

void sp_draw_prompt ( gfx_canvas_t * c)

A run's prompt for a manual step drawn.

Parameters
cthe canvas

◆ sp_draw_result()

void sp_draw_result ( gfx_canvas_t * c)

A run's result drawn.

Parameters
cthe canvas

◆ sp_draw_warning()

void sp_draw_warning ( gfx_canvas_t * c)

The RUN warning drawn.

Parameters
cthe canvas

◆ sp_end_run()

void sp_end_run ( esc_stick_reason_t why)

The run ends now as why; nothing it queued survives.

Parameters
whythe reason the run ends

◆ sp_entry_shown()

uint32_t sp_entry_shown ( void )

The entry time the page shows, ms.

Returns
the entry time, ms

◆ sp_hold_blocked()

bool sp_hold_blocked ( void )

Whether HOLD TO RUN may not count.

Returns
true when the hold is blocked

◆ 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_later_steps()

unsigned sp_later_steps ( const esc_profile_t * p)

The steps of p the run stops for after the warning's.

Parameters
pthe profile
Returns
the number of steps

◆ sp_left_text()

const char * sp_left_text ( const esc_stick_t * e)

What a run waiting for a manual step asks of the operator.

Parameters
ethe run
Returns
the text, static

◆ 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_red()

bool sp_red ( void )

The red light: a result on screen, until OK, of a run that ended on something not as expected.

Returns
true when the red light is on

◆ sp_result_head()

void sp_result_head ( const esc_stick_t * e,
char * buf,
size_t n )

Into buf: the result's count of the selections made for certain.

Parameters
ethe run
bufthe buffer the text is written to
nthe size of buf, bytes

◆ sp_result_more()

void sp_result_more ( const esc_stick_t * e,
unsigned shown,
char * buf,
size_t n )

Into buf: the changes past the first shown, as the result's last line says them.

Parameters
ethe run
shownhow many changes the result shows
bufthe buffer the text is written to
nthe size of buf, bytes

◆ sp_row()

gfx_rect_t sp_row ( int i)

Profile row i, narrowed to the left of the keyboard while it is open.

Parameters
ithe row on the page
Returns
the row's rectangle

◆ sp_rows_shown()

int sp_rows_shown ( int total,
int scroll )

The rows a page of ROWS_MAX shows of total from scroll.

Parameters
totalthe number of entries
scrollthe first entry shown
Returns
the number of rows shown

◆ sp_supply()

void sp_supply ( uint32_t * mv,
uint32_t * ma )

The supply's set points for a run, mV and mA: VOLTAGE, or the profile's cell count when it is 0.

Parameters
mvthe voltage, written, mV
mathe current, written, mA

◆ sp_supply_reads_off()

bool sp_supply_reads_off ( void )

Whether the supply reads off now, by the rule a run holds the supply to.

Returns
true when the supply reads off

◆ 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_timing()

void sp_timing ( esc_stick_timing_t * t)

The timing as the settings hold it, the profile's own entry where it states one.

Parameters
tthe timing, written

◆ sp_warn_gated()

bool sp_warn_gated ( void )

Whether the warning asks a step at an unpowered ESC of the operator and may not, as the supply does not read off.

Returns
true when the warning is gated

◆ sp_warn_steps_fit()

bool sp_warn_steps_fit ( const esc_profile_t * p)

Whether the warning shows every before-power step of p whole.

Parameters
pthe profile
Returns
true when every step fits

◆ 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