|
rcbench
Servo and ESC test bench: panel, IOmcu and shared C
|
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. | |
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
| #define SP_AMPS_X 320 |
its current's column
| #define SP_CLR_W UI_TAP_MIN |
X in the field
| #define SP_COUNT_W 360 |
width of the footer's count, px
| #define SP_DOCK_X 352 |
the keyboard's left
| #define SP_FAMILY_X 460 |
its family's column
| #define SP_FIND_W 260 |
the field's width
| #define SP_FIND_X (SP_LIST_UP_X - 8 - SP_FIND_W) |
its left
| #define SP_KEY_W 56 |
"^" and "v", px
| #define SP_LIST_UP_X (SP_LIST_DN_X - 8 - SP_KEY_W) |
"^"
| #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
| #define SP_NOTE 160 |
a note's bytes
| #define SP_QUEUE 8 |
commands queued
| #define SP_ROW_H UI_TAP_MIN |
a row, 48px
| #define SP_ROW_P 56 |
its pitch
| #define SP_ROW_TY ((SP_ROW_H - 20) / 2) |
its text, from its top
| #define SP_ROW_X (PAD + 12) |
a row's left
| #define SP_ROW_Y0 CARD_Y |
the first row's top
| #define SP_ROWS 7 |
rows to a page
| #define SP_TOWER_BASE 26 |
height of the base, px
| #define SP_TOWER_CAP 8 |
height of the cap, px
| #define SP_TOWER_LENS 58 |
height of each lens, px
| #define SP_TOWER_RING 3 |
height of the collar under each lens, px
| #define SP_TOWER_W 44 |
width of the stack light, px
| #define SP_TOWER_X (W - PAD - 16 - SP_TOWER_W) |
left edge of the stack light, px
| #define SP_TOWER_Y (RUN_Y + 14) |
the stack light's top
| #define SP_TRAIL_CELLS |
The trail left of the field, in SP_FONT_CRUMB's cells.
| #define SP_VOLTS_X 384 |
its voltage's column
| const char * sp_action | ( | const esc_manual_t * | m | ) |
What a manual step asks, in the language showing.
| m | the manual step |
| void sp_build_list | ( | bool | keep_scroll | ) |
The level showing built again, from the top or, with keep_scroll, where it was.
| keep_scroll | true to keep the scroll position |
| bool sp_can_run | ( | void | ) |
Whether a run can start now.
| size_t sp_changes | ( | esc_stick_change_t * | ch, |
| size_t * | picked ) |
The picks as changes, in item order.
| ch | the changes, ESC_STICK_MAX_CHANGES of them at most |
| picked | how many were picked in all |
ch | void sp_draw_hand | ( | gfx_canvas_t * | c | ) |
A profile's manual steps drawn.
| c | the canvas |
| void sp_draw_progress | ( | gfx_canvas_t * | c | ) |
A run under way drawn.
| c | the canvas |
| void sp_draw_prompt | ( | gfx_canvas_t * | c | ) |
A run's prompt for a manual step drawn.
| c | the canvas |
| void sp_draw_result | ( | gfx_canvas_t * | c | ) |
A run's result drawn.
| c | the canvas |
| void sp_draw_warning | ( | gfx_canvas_t * | c | ) |
The RUN warning drawn.
| c | the canvas |
| void sp_end_run | ( | esc_stick_reason_t | why | ) |
The run ends now as why; nothing it queued survives.
| why | the reason the run ends |
| uint32_t sp_entry_shown | ( | void | ) |
The entry time the page shows, ms.
| bool sp_hold_blocked | ( | void | ) |
Whether HOLD TO RUN may not count.
| int sp_item_at | ( | int | at | ) |
The profile's index of the at-th item offered, or -1.
| at | the position among the items offered |
| int sp_items | ( | void | ) |
The items the page offers.
| unsigned sp_later_steps | ( | const esc_profile_t * | p | ) |
The steps of p the run stops for after the warning's.
| p | the profile |
| const char * sp_left_text | ( | const esc_stick_t * | e | ) |
What a run waiting for a manual step asks of the operator.
| e | the run |
| 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.
| p | the profile |
| model | the model's index in p |
| 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.
| p | the profile |
| model | the model's index in p |
| buf | the buffer the text is written to |
| n | the size of buf, bytes |
buf, or NULL when there is no warning | 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.
| p | the profile |
| model | the model's index in p |
| buf | the buffer the text is written to |
| n | the size of buf, bytes |
buf, or NULL when the model can run | 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.
| p | the profile |
| 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.
| p | the profile |
| model | the model's index in p |
| mv | the supply voltage, mV |
| by_hand | whether the model is run by hand |
| longer | true for the page's note, false for a row's short form |
| buf | the buffer the text is written to |
| n | the size of buf, bytes |
buf, or NULL when there is no warning | 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.
| p | the profile |
| model | the model's index in p |
| mv | the supply voltage, mV |
| ma | the supply current limit, mA |
| by_hand | whether the model is run by hand |
| longer | true for the page's note, false for a row's short form |
| buf | the buffer the text is written to |
| n | the size of buf, bytes |
buf, or NULL when the set points break nothing | 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.
| e | the run |
| buf | the buffer the text is written to |
| n | the size of buf, bytes |
| 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.
| e | the run |
| shown | how many changes the result shows |
| buf | the buffer the text is written to |
| n | the size of buf, bytes |
| gfx_rect_t sp_row | ( | int | i | ) |
Profile row i, narrowed to the left of the keyboard while it is open.
| i | the row on the page |
| int sp_rows_shown | ( | int | total, |
| int | scroll ) |
The rows a page of ROWS_MAX shows of total from scroll.
| total | the number of entries |
| scroll | the first entry shown |
| 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.
| mv | the voltage, written, mV |
| ma | the current, written, mA |
| bool sp_supply_reads_off | ( | void | ) |
Whether the supply reads off now, by the rule a run holds the supply to.
| 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.
| c | the canvas |
| x | the left edge, px |
| y | the top edge, px |
| text | the text to draw |
| max_chars | the most characters to draw |
| ink | the text colour |
| void sp_timing | ( | esc_stick_timing_t * | t | ) |
The timing as the settings hold it, the profile's own entry where it states one.
| t | the timing, written |
| 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.
| p | the profile |
| const char * sp_when_text | ( | const esc_manual_t * | m | ) |
When a manual step is due, in the language showing.
| m | the manual step |
| const char * sp_why_text | ( | const char * | why | ) |
The engine's reason why in the language showing.
| why | the engine's reason |