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

The MOTOR & ESC screen's private seam between motor_screen.c, the screen and LIVE's page (with motor_events.c and motor_draw.c, which share its state through motor_live_int.h), motor_workbench.c, its task strip and the CONTROL card's TARGET row, motor_program_page.c, PROGRAM's list and its sessions, and motor_settings_page.c, SETTINGS' page: the layout they draw on and the functions each calls of the others. Nothing outside shared/ui includes this header; the screen's interface is motor_screen.h. More...

#include <stdbool.h>
#include <stdint.h>
#include "gfx.h"
#include "prog_registry.h"
#include "touch_types.h"
#include "ui_screen.h"
#include "ui_workbench.h"

Go to the source code of this file.

Macros

#define W   UI_PANEL_W
#define H   UI_BODY_H
#define PAD   UI_MARGIN
#define INNER   10
#define LEFT_W   620
 The left column's width, px: SERVO's left card, 620px. The page on the left, the readouts and the CONTROL card on a rail on the right, so a glance at the numbers and a hand on the throttle do not compete for the same part of the screen. The rail is the same on every task.
#define LEFT_X   PAD
#define RIGHT_X   (LEFT_X + LEFT_W + 8)
#define RIGHT_W   (W - PAD - RIGHT_X)
#define RC_X   (RIGHT_X + 12)
 The rail's inner column, as SERVO's output card's: x 648.
#define RC_W   (RIGHT_W - 24)
#define MO_STRIP_X   UI_WB_STRIP_X
 The task strip at the 1024 x 600 sizes, as SERVO's: tabs of 150 x 40px, 4px apart, from y 8, and the page from y 56. LIVE | PROGRAM | SETTINGS take 458px of the left column. The shared UI_WB_ figures stay at their 24px strip for SUPPLY until it is laid out at the new sizes; these are MOTOR & ESC's own, the shared figures plus the difference.
#define MO_STRIP_Y   (UI_WB_STRIP_Y + 2)
#define MO_STRIP_H   (UI_WB_STRIP_H + 16)
#define MO_TAB_W   (UI_WB_TAB_W + 38)
#define MO_TAB_GAP   UI_WB_TAB_GAP
#define MO_PAGE_Y   (UI_WB_PAGE_Y + 18)
#define STOP_FLOOR   (UI_ALERT_Y - UI_BAND_H - 4)
 The lowest row a control that stops what the bench drives, or a line of text, may reach: 4px above the alert band.
#define MO_FONT_LABEL   (&gfx_font_10x20)
 The faces of the 1024 x 600 type scale this screen draws in.
#define MO_FONT_FINE   UI_FONT_FINE
#define MO_FONT_HEAD   (&gfx_font_20x36)
#define MO_FONT_NUM   (&gfx_font_num_32x44)
#define TITLE_H   20
 A panel's title strip, the accent tag on its top edge, px.
#define HDR_Y   (PAD + 4)
#define HDR_H   20
#define HERO_Y0   (HDR_Y + HDR_H + 8)
#define HERO_H   56
#define HERO_GAP   4
#define CTL_Y   (HERO_Y0 + 4 * HERO_H + 4 * HERO_GAP)
 The CONTROL card's top: under the fourth reading card.
#define CTL_H   (H - PAD - CTL_Y)
#define BTN_H   UI_TAP_MIN
#define TARGET_Y   (CTL_Y + TITLE_H + 8)
#define TARGET_H   UI_TAP_MIN
#define RESET_Y   (TARGET_Y + TARGET_H + 10)
#define ARM_Y   (RESET_Y + BTN_H + 10)
#define ARM_H   60
#define UP_Y   MO_PAGE_Y
#define UP_H   288
#define LO_Y   (UP_Y + UP_H + 8)
#define LO_H   (H - PAD - LO_Y)
#define PAGE_X   LEFT_X
#define PAGE_Y   MO_PAGE_Y
#define PAGE_W   LEFT_W
#define PAGE_H   (H - PAGE_Y - PAD)

Enumerations

enum  mwb_ev_t { MWB_NONE = 0 , MWB_TAKEN , MWB_TASK , MWB_TARGET }

Functions

void mwb_reset (void)
 The strip and the TARGET row laid out; LIVE.
void mwb_enter (void)
void mwb_cancel (void)
void mwb_opened_outputs (void)
ui_wb_task_t mwb_task (void)
mwb_ev_t mwb_event (const touch_event_t *evt, bool strip, bool locked)
bool mwb_pressed (void)
uint32_t mwb_revision (void)
void mwb_render_strip (gfx_canvas_t *c)
void mwb_render_target (gfx_canvas_t *c, const char *value, bool warn, bool locked)
gfx_rect_t mwb_strip_area (void)
gfx_rect_t mwb_target_rect (void)
void mpp_reset (void)
void mpp_enter (void)
void mpp_leave (void)
void mpp_cancel (void)
void mpp_armed (bool armed)
void mpp_tick (float dt_s)
const prog_page_set_t * mpp_shown (void)
bool mpp_back (void)
bool mpp_event (const touch_event_t *evt)
bool mpp_pressed (void)
void mpp_cancel_press (void)
uint32_t mpp_revision (void)
void mpp_render_page (gfx_canvas_t *c)
void mpp_render_strip (gfx_canvas_t *c, uint8_t proto, uint64_t pins, bool known, bool armed)
 The strip in its row, over the clear, in PROG_FULL_STRIP_FONT: TARGET dim, the target in the text colour (the warning colour with no pin or the binding not read), the supply dim, and the bench SAFE or, in the danger colour, ARMED.
uint32_t mpp_strip_signature (uint8_t proto, uint64_t pins, bool known, bool armed)
void msp_reset (void)
void msp_leave (void)
void msp_cancel (void)
bool msp_modal (void)
bool msp_back (void)
void msp_event (const touch_event_t *evt, bool safe)
bool msp_pressed (void)
void msp_tick (bool safe)
uint32_t msp_revision (void)
void msp_render (gfx_canvas_t *c, bool safe)
 SETTINGS' page in its two columns, or the keypad over it.

Detailed Description

The MOTOR & ESC screen's private seam between motor_screen.c, the screen and LIVE's page (with motor_events.c and motor_draw.c, which share its state through motor_live_int.h), motor_workbench.c, its task strip and the CONTROL card's TARGET row, motor_program_page.c, PROGRAM's list and its sessions, and motor_settings_page.c, SETTINGS' page: the layout they draw on and the functions each calls of the others. Nothing outside shared/ui includes this header; the screen's interface is motor_screen.h.

Each part keeps its own state; psram_bss.lf places each one's .bss. Included last, or last but one before motor_live_int.h: its layout macros have short names (W, H, PAD), which no other header included after it may meet.

SPDX-License-Identifier: MIT

Macro Definition Documentation

◆ ARM_H

#define ARM_H   60

ARM's height: 9.0mm.

◆ ARM_Y

#define ARM_Y   (RESET_Y + BTN_H + 10)

ARM and DISARM, px.

◆ BTN_H

#define BTN_H   UI_TAP_MIN

RESET PEAKS' height, px.

◆ CTL_H

#define CTL_H   (H - PAD - CTL_Y)

To the body's margin.

◆ H

#define H   UI_BODY_H

The body's height under the band, px.

◆ HDR_H

#define HDR_H   20

Its height, px.

◆ HDR_Y

#define HDR_Y   (PAD + 4)

The temperatures' line, px.

◆ HERO_GAP

#define HERO_GAP   4

Between two of them, px.

◆ HERO_H

#define HERO_H   56

A reading card's height.

◆ HERO_Y0

#define HERO_Y0   (HDR_Y + HDR_H + 8)

The first reading card, px.

◆ INNER

#define INNER   10

A card's own padding, px.

◆ LEFT_X

#define LEFT_X   PAD

The left column, px.

◆ LO_H

#define LO_H   (H - PAD - LO_Y)

To the body's margin.

◆ LO_Y

#define LO_Y   (UP_Y + UP_H + 8)

The THROTTLE card, px.

◆ MO_FONT_FINE

#define MO_FONT_FINE   UI_FONT_FINE

8 x 16: data lines.

◆ MO_FONT_HEAD

#define MO_FONT_HEAD   (&gfx_font_20x36)

20 x 36: a wide reading.

◆ MO_FONT_LABEL

#define MO_FONT_LABEL   (&gfx_font_10x20)

The faces of the 1024 x 600 type scale this screen draws in.

MO_FONT_LABEL (10 x 20) for every label, button, row and value; MO_FONT_FINE (8 x 16) for the data lines: the legend's scales, the IOmcu's refusals and SETTINGS' help lines; MO_FONT_HEAD (20 x 36) for a reading wider than its place; MO_FONT_NUM (32 x 44, digits, sign, point and space only) for the four readings and the throttle.

◆ MO_FONT_NUM

#define MO_FONT_NUM   (&gfx_font_num_32x44)

32 x 44: the readings.

◆ MO_PAGE_Y

#define MO_PAGE_Y   (UI_WB_PAGE_Y + 18)

The page's top: 56px.

◆ MO_STRIP_H

#define MO_STRIP_H   (UI_WB_STRIP_H + 16)

A tab's height: 40px.

◆ MO_STRIP_Y

#define MO_STRIP_Y   (UI_WB_STRIP_Y + 2)

The strip's top: 8px.

◆ MO_TAB_GAP

#define MO_TAB_GAP   UI_WB_TAB_GAP

Between two tabs: 4px.

◆ MO_TAB_W

#define MO_TAB_W   (UI_WB_TAB_W + 38)

A tab's width: 150px.

◆ PAD

#define PAD   UI_MARGIN

The screen's outer margin, px.

◆ PAGE_H

#define PAGE_H   (H - PAGE_Y - PAD)

Its height: 476px.

◆ PAGE_W

#define PAGE_W   LEFT_W

Its width: 620px.

◆ PAGE_X

#define PAGE_X   LEFT_X

The page's left edge.

◆ PAGE_Y

#define PAGE_Y   MO_PAGE_Y

Its top: 56px.

◆ RC_W

#define RC_W   (RIGHT_W - 24)

Its width: 356px.

◆ RESET_Y

#define RESET_Y   (TARGET_Y + TARGET_H + 10)

RESET PEAKS, px.

◆ RIGHT_W

#define RIGHT_W   (W - PAD - RIGHT_X)

The rail's width: 380px.

◆ RIGHT_X

#define RIGHT_X   (LEFT_X + LEFT_W + 8)

The rail: x 636.

◆ TARGET_H

#define TARGET_H   UI_TAP_MIN

Its height, px.

◆ TARGET_Y

#define TARGET_Y   (CTL_Y + TITLE_H + 8)

The TARGET row, px.

◆ UP_H

#define UP_H   288

Its height, px.

◆ UP_Y

#define UP_Y   MO_PAGE_Y

The telemetry card, px.

◆ W

#define W   UI_PANEL_W

The panel's width, px: the screen's own.

Function Documentation

◆ mpp_render_strip()

void mpp_render_strip ( gfx_canvas_t * c,
uint8_t proto,
uint64_t pins,
bool known,
bool armed )

The strip in its row, over the clear, in PROG_FULL_STRIP_FONT: TARGET dim, the target in the text colour (the warning colour with no pin or the binding not read), the supply dim, and the bench SAFE or, in the danger colour, ARMED.

Parameters
cThe canvas.
protoThe throttle's protocol.
pinsThe pins bound as throttle, one bit each.
knownWhether the binding is read.
armedWhether the bench is ARMED.

◆ msp_render()

void msp_render ( gfx_canvas_t * c,
bool safe )

SETTINGS' page in its two columns, or the keypad over it.

Parameters
cthe canvas
safewhether the pulse rows take a press