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

A run of ESC STICK drawn. More...

#include "esc_stick_panel.h"
#include <stdio.h>
#include <string.h>
#include "esc_profile.h"
#include "ui_text.h"
#include "ui_theme.h"
#include "ui_widgets.h"
#include "esc_stick_panel_int.h"

Macros

#define SP_TONE_COL_CELLS   30
 The beeps' two columns and the cells each takes.

Functions

static void sp_cylinder (gfx_canvas_t *c, int x, int y, int w, int h, gfx_color_t base, bool lit, bool ribs)
 One lens or the base of the stack light: a cylinder seen from the side. Lit, the colour runs to a near-white band down the middle; unlit, the same colour greyed and dark. Both darken toward the edges, and a darker line every 6px is a rib of the lens. Drawn row by row in runs of one colour, since the panel's frame buffer is cached by rows.
static void sp_lens (gfx_canvas_t *c, int x, int y, gfx_color_t colour, bool lit)
 A lens, lit or dark, with a glow around it when lit.
static void sp_draw_tower (gfx_canvas_t *c, bool red, bool green)
 The stack light: red over green on a light grey base, as a signal tower on a machine. Green: the detector holds a beep. Red: the run ended for a reason esc_stick_reason_is_fault() names.
static const char * sp_pos (float pct)
 "MIN", "MID" or "MAX" for a percentage the run commands.
static const char * sp_reason_help (esc_stick_reason_t r)
 Returns the help line for a run's end, in the language showing.
static const char * sp_phase_text (esc_stick_phase_t ph)
 The run's phase and its end in the language showing; the engine's esc_stick_phase_text() and esc_stick_reason_text() are the English.
static const char * sp_reason_text (esc_stick_reason_t r)
 Returns the name of a run's end, in the language showing.
static void sp_change_text (const esc_stick_change_t *ch, char *out, size_t n)
 "3 Cutoff mode -> 2 hard cutoff" for a change.
static bool sp_power_up_text (const esc_profile_t *p, const esc_stick_change_t *ch, size_t n, char *out, size_t size)
 "POWER-UP AT MID" for the positions the power-ups of n changes take, in the order first met: "MAX, MID" where a one-stage run takes both. False, and nothing written, when every one is MIN.
static uint32_t sp_hold_ms (const esc_profile_t *p)
 The longest hold of the profile's at_power_up steps, ms; 0 for none.
static const char * sp_tone_state (const tone_readout_t *r)
 The phase tap's state as its readout is worded.
static void sp_tone_beep (const tone_beep_t *b, char *buf, size_t n)
 One beep of the readout: its number, length in ms and pitch in Hz, to the tenth, as the page reports them.
static DRAWER void sp_draw_tone (gfx_canvas_t *c, int y, int pitch)
 The phase tap, read only, on the run's page while the tap is enabled on SETUP: a head line, then the last four beeps two to a line.
DRAWER void sp_draw_progress (gfx_canvas_t *c)
 A run under way drawn.
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.
DRAWER void sp_draw_result (gfx_canvas_t *c)
 A run's result drawn.
static gfx_rect_t sp_panel (gfx_canvas_t *c, const char *title)
 A panel over the session's pages, edged and titled in the danger colour: the warning's, the manual steps' and the prompt's. The output strip above it stays in sight. Its area.
static DRAWER void sp_draw_warning_hand (gfx_canvas_t *c, const esc_profile_t *p, gfx_rect_t a, int y)
 The before-power-up steps of the profile, under the warning's lines: the hold that starts the run is the operator's word that they are done. Then, where the run asks for more on its way, a line that it will.
DRAWER void sp_draw_warning (gfx_canvas_t *c)
 The RUN warning drawn.
DRAWER void sp_draw_hand (gfx_canvas_t *c)
 A profile's manual steps drawn.
const char * sp_left_text (const esc_stick_t *e)
 What a run waiting for a manual step asks of the operator.
DRAWER void sp_draw_prompt (gfx_canvas_t *c)
 A run's prompt for a manual step drawn.

Detailed Description

A run of ESC STICK drawn.

A run of ESC STICK drawn: the stack light, the beeps the detector hears, the progress, the result, the RUN warning, the manual steps and a run's prompt. The state and the seam are esc_stick_panel_int.h.

SPDX-License-Identifier: MIT

Function Documentation

◆ sp_draw_hand()

DRAWER void sp_draw_hand ( gfx_canvas_t * c)

A profile's manual steps drawn.

Parameters
cthe canvas

◆ sp_draw_progress()

DRAWER void sp_draw_progress ( gfx_canvas_t * c)

A run under way drawn.

Parameters
cthe canvas

◆ sp_draw_prompt()

DRAWER void sp_draw_prompt ( gfx_canvas_t * c)

A run's prompt for a manual step drawn.

Parameters
cthe canvas

◆ sp_draw_result()

DRAWER void sp_draw_result ( gfx_canvas_t * c)

A run's result drawn.

Parameters
cthe canvas

◆ sp_draw_warning()

DRAWER void sp_draw_warning ( gfx_canvas_t * c)

The RUN warning drawn.

Parameters
cthe canvas

◆ 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_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