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

splash_screen.h says what this screen is for. More...

#include "splash_screen.h"
#include <stdio.h>
#include <string.h>
#include "ui_text.h"
#include "ui_theme.h"
#include "ui_widgets.h"

Data Structures

struct  [struct].s
 Driver state of the UART: the claimed machines and the pins. More...

Macros

#define W   UI_PANEL_W
 The panel's width, px.
#define H   UI_PANEL_H
 The panel's height, px.
#define HOLD_S   1.6f
 The hold after the last step has answered, s.
#define SP_FONT_MARK   (&gfx_font_20x36)
 The mark's face, drawn at MARK_SCALE: 20 x 36.
#define SP_FONT_BODY   UI_FONT_BODY
 The tagline and the steps: 12 x 24.
#define SP_FONT_LABEL   (&gfx_font_10x20)
 The credit: 10 x 20.
#define MARK_SCALE   2
 The mark's scale: twice the home tag.
#define MARK_Y   40
 The mark's top.
#define MARK_H   (MARK_SCALE * UI_TAG_H)
#define MARK_PAD   (MARK_SCALE * 12)
#define MARK_CHAMFER   (MARK_SCALE * UI_CHAMFER)
 The mark's chamfer, px.
#define TAGLINE_Y   (MARK_Y + MARK_H + 20)
 The tagline's top.
#define ROW_H   40
 A step's row, px.
#define LIST_Y   200
 The first step's top.
#define LIST_X   192
 The steps' names' left edge.
#define MARK_X   (LIST_X + 180)
#define DETAIL_X   (LIST_X + 240)
 A step's detail's left edge.
#define DETAIL_W   (W - 24 - DETAIL_X)
 A step's detail's width: 47 cells of SP_FONT_BODY.
#define CREDIT_Y   (H - 36)
 The credit's top.

Functions

void splash_invalidate (void)
 Draw the whole splash again on both framebuffers.
static void reset (void)
 Every step pending, nothing held.
void splash_screen_set (splash_step_t step, splash_result_t result, const char *detail)
 A step's result and its detail.
static bool all_answered (void)
 Whether every step has answered.
bool splash_screen_done (void)
 Whether the splash may hand over.
static void tick (float dt_s)
 Time passed: the hold runs once every step has answered.
static void event (const touch_event_t *evt)
 A touch: a tap skips the hold.
static gfx_color_t colour_of (splash_result_t r)
 A result's colour.
static const char * mark_of (splash_result_t r)
 A result's mark.
static void draw_mark (gfx_canvas_t *c, const char *text, gfx_color_t fill)
 The mark: the home tag's chamfered shape at MARK_SCALE times its size, centred, with text on it.
static void render (gfx_canvas_t *c, int buffer_index)
 The splash: the mark, the tagline and the credit once per framebuffer, the steps' rows every frame.
const ui_screen_t * splash_screen (void)
 The splash.

Variables

static const ui_text_id_t k_labels [SPLASH_STEP_COUNT]
 Each step's name, in the order of splash_step_t.
static struct  s
static const ui_screen_t k_screen
 The splash, as the router takes it.

Detailed Description

splash_screen.h says what this screen is for.

SPDX-License-Identifier: MIT

Macro Definition Documentation

◆ MARK_H

#define MARK_H   (MARK_SCALE * UI_TAG_H)

88px

◆ MARK_PAD

#define MARK_PAD   (MARK_SCALE * 12)

text to either edge

◆ MARK_X

#define MARK_X   (LIST_X + 180)

a step's OK, –, !!

Function Documentation

◆ all_answered()

bool all_answered ( void )
static

Whether every step has answered.

Returns
true when none is pending

◆ colour_of()

gfx_color_t colour_of ( splash_result_t r)
static

A result's colour.

Parameters
rThe result.
Returns
OK green, warning, danger, or faint while pending

◆ draw_mark()

void draw_mark ( gfx_canvas_t * c,
const char * text,
gfx_color_t fill )
static

The mark: the home tag's chamfered shape at MARK_SCALE times its size, centred, with text on it.

Parameters
cCanvas, the whole panel.
textThe word.
fillThe shape's colour.

◆ event()

void event ( const touch_event_t * evt)
static

A touch: a tap skips the hold.

Parameters
evtThe event.

◆ mark_of()

const char * mark_of ( splash_result_t r)
static

A result's mark.

Parameters
rThe result.
Returns
"OK", "--", "!!", or ".." while pending

◆ render()

void render ( gfx_canvas_t * c,
int buffer_index )
static

The splash: the mark, the tagline and the credit once per framebuffer, the steps' rows every frame.

Parameters
cCanvas, the whole panel.
buffer_indexThe framebuffer drawn into.

◆ splash_screen()

const ui_screen_t * splash_screen ( void )

The splash.

Returns
its screen

◆ splash_screen_done()

bool splash_screen_done ( void )

Whether the splash may hand over.

Returns
true once every step has answered and the hold has expired, or a tap skipped the hold.

◆ splash_screen_set()

void splash_screen_set ( splash_step_t step,
splash_result_t result,
const char * detail )

A step's result and its detail.

Parameters
stepThe step.
resultIts result.
detailWhat it found, or NULL for nothing.

◆ tick()

void tick ( float dt_s)
static

Time passed: the hold runs once every step has answered.

Parameters
dt_sThe time since the last tick, in seconds.

Variable Documentation

◆ k_labels

const ui_text_id_t k_labels[SPLASH_STEP_COUNT]
static
Initial value:
= {
TX_SPLASH_BOARD, TX_SPLASH_DISPLAY, TX_SPLASH_TOUCH, TX_SPLASH_STORAGE,
TX_SPLASH_SETTINGS, TX_SPLASH_LINK, TX_SPLASH_IOMCU,
}

Each step's name, in the order of splash_step_t.

◆ k_screen

const ui_screen_t k_screen
static
Initial value:
= {
.title = "rcbench",
.reset = reset,
.enter = NULL,
.leave = NULL,
.tick = tick,
.event = event,
.render = render,
}
static void event(const touch_event_t *evt)
One touch event: the tabs are the screen's one control.
Definition analyser_screen.c:242
static void reset(void)
The screen's state cleared: CHANNELS shown, nothing decoded, the tabs laid out.
Definition analyser_screen.c:176
static void render(gfx_canvas_t *c, int buffer_index)
The screen drawn on a revision not yet drawn: both cards once per framebuffer, then the tabs,...
Definition analyser_screen.c:618
static void tick(float dt_s)
Time passed: the acknowledge flash runs on by dt_s.
Definition busfault_screen.c:359

The splash, as the router takes it.

◆ s

struct [struct].s s

the steps and the hold