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

The drawing of the Hitec programmer's overlay: the tabs, the rows of the tab shown, its notes and the last message, the list of choices and the hold pages. More...

#include "hitec_panel.h"
#include <stdio.h>
#include <string.h>
#include "hitec_reg.h"
#include "ui_tabs.h"
#include "ui_text.h"
#include "ui_theme.h"
#include "ui_widgets.h"
#include "hitec_panel_int.h"

Data Structures

struct  note_t
 One note: its text and its colour. More...
struct  plan_t
 Where the notes and the message of the tab shown go. More...

Macros

#define NOTES_MAX   6
 The notes a tab holds at most.

Functions

static gfx_color_t level_color (unsigned level)
 The text colour of a message's level.
static void note (plan_t *p, const char *s, gfx_color_t color)
 Adds a note.
static void record_notes (plan_t *p)
 What stands of a write: a record of one interrupted, and a READ ALL owed before the next.
static void servo_notes (plan_t *p)
 The SERVO tab's notes: the state, what it needs, what stands.
static void value_notes (plan_t *p)
 The notes of a value tab.
static int rows_foot (void)
 The top of the notes: 8px under the lowest row of the tab shown.
static void plan (plan_t *p)
 Plans the notes and the message of the tab shown: the notes from the rows down, the message's lines under them at the foot. A note that does not fit above the message is not drawn.
static void draw_notes (gfx_canvas_t *c)
 Draws the notes and the message of the tab shown.
const char * hitec_panel_note (int i)
 The note lines of the tab shown, from the top, the message's lines after them.
gfx_rect_t hitec_panel_notes_drawn (void)
 The rows the notes and the message of the tab shown take, from the first note's top to the last line's foot.
static void button (gfx_canvas_t *c, gfx_rect_t r, const char *label, gfx_color_t fill, bool pressed, bool enabled)
 A button of the overlay in HP_FONT.
static void draw_port_label (gfx_canvas_t *c, gfx_rect_t rr)
 Draws the PORT row's label: the port, the pin and the series over the receive mode and the supply, in the warning colour with no pin.
static void draw_row (gfx_canvas_t *c, int i)
 Draws row i: its label and its control.
static void draw_tab (gfx_canvas_t *c)
 Draws the tab shown: the tabs, CLOSE, its rows and its notes.
static void draw_choice (gfx_canvas_t *c)
 Draws the list: its title, its entries and CANCEL.
static void draw_hold (gfx_canvas_t *c)
 Draws a hold page: its title, its lines and the two buttons.
void hitec_panel_render (gfx_canvas_t *c)
 Draws the overlay.

Variables

static char s_msg [HITEC_PANEL_MSG_LINES][HITEC_PANEL_LINE]
 Static: the message's lines, written on the UI task's path.
static char s_buf [3][HITEC_PANEL_LINE]
 Static: the notes' own texts.
static plan_t s_plan
 Static: one plan serves the draw and every query.

Detailed Description

The drawing of the Hitec programmer's overlay: the tabs, the rows of the tab shown, its notes and the last message, the list of choices and the hold pages.

Hitec is a name or trademark of its owner; it is used here only to say which servos this overlay works with. The state and the seam are hitec_panel_int.h.

SPDX-License-Identifier: MIT

Function Documentation

◆ button()

void button ( gfx_canvas_t * c,
gfx_rect_t r,
const char * label,
gfx_color_t fill,
bool pressed,
bool enabled )
static

A button of the overlay in HP_FONT.

Parameters
cthe canvas
rthe button
labelits label
fillits colour
pressedlightens the fill
enabledfalse dims it

◆ draw_choice()

void draw_choice ( gfx_canvas_t * c)
static

Draws the list: its title, its entries and CANCEL.

Parameters
cthe canvas

◆ draw_hold()

void draw_hold ( gfx_canvas_t * c)
static

Draws a hold page: its title, its lines and the two buttons.

Parameters
cthe canvas

◆ draw_notes()

void draw_notes ( gfx_canvas_t * c)
static

Draws the notes and the message of the tab shown.

Parameters
cthe canvas

◆ draw_port_label()

void draw_port_label ( gfx_canvas_t * c,
gfx_rect_t rr )
static

Draws the PORT row's label: the port, the pin and the series over the receive mode and the supply, in the warning colour with no pin.

Parameters
cthe canvas
rrthe row

◆ draw_row()

void draw_row ( gfx_canvas_t * c,
int i )
static

Draws row i: its label and its control.

Parameters
cthe canvas
ithe row's index

◆ draw_tab()

void draw_tab ( gfx_canvas_t * c)
static

Draws the tab shown: the tabs, CLOSE, its rows and its notes.

Parameters
cthe canvas

◆ hitec_panel_note()

const char * hitec_panel_note ( int i)

The note lines of the tab shown, from the top, the message's lines after them.

Parameters
ithe line
Returns
the line; NULL past the last

◆ hitec_panel_notes_drawn()

gfx_rect_t hitec_panel_notes_drawn ( void )

The rows the notes and the message of the tab shown take, from the first note's top to the last line's foot.

Returns
the rectangle; 0 high when nothing is drawn

◆ hitec_panel_render()

void hitec_panel_render ( gfx_canvas_t * c)

Draws the overlay.

Parameters
cthe canvas

◆ level_color()

gfx_color_t level_color ( unsigned level)
static

The text colour of a message's level.

Parameters
levelhitec_prog_level_t
Returns
the colour

◆ note()

void note ( plan_t * p,
const char * s,
gfx_color_t color )
static

Adds a note.

Parameters
pthe plan
sits text
colorits colour

◆ plan()

void plan ( plan_t * p)
static

Plans the notes and the message of the tab shown: the notes from the rows down, the message's lines under them at the foot. A note that does not fit above the message is not drawn.

Parameters
pthe plan

◆ record_notes()

void record_notes ( plan_t * p)
static

What stands of a write: a record of one interrupted, and a READ ALL owed before the next.

Parameters
pthe plan

◆ rows_foot()

int rows_foot ( void )
static

The top of the notes: 8px under the lowest row of the tab shown.

Returns
the y, body pixels

◆ servo_notes()

void servo_notes ( plan_t * p)
static

The SERVO tab's notes: the state, what it needs, what stands.

Parameters
pthe plan

◆ value_notes()

void value_notes ( plan_t * p)
static

The notes of a value tab.

Parameters
pthe plan