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

The texts of the Hitec programmer's overlay: the rows' labels, the values as read, the PORT row, the state line and the messages. More...

#include "hitec_panel.h"
#include <stdio.h>
#include <string.h>
#include "hitec_reg.h"
#include "link_pages.h"
#include "ui_text.h"
#include "hitec_panel_int.h"

Macros

#define W_NAME   ((uint8_t)HITEC_P_COUNT)
 The classic model name row, as hitec_panel.c names it.
#define DEG   "\xc2\xb0"
 The degree sign, UTF-8.

Functions

static const char * series_name (uint8_t series)
 The series' name.
const char * hpn_label (const hpn_row_t *r)
 A row's label as it is drawn now.
const char * hpn_choice_text (uint8_t id, int32_t value)
 The words of a CHOICE value of id: "CW", "ON".
static void fmt_value (uint8_t id, uint8_t unit, const hitec_value_t *v, bool with_raw, char *out, size_t n)
 A decoded value in its unit, with the stored value beside it where the two differ and with_raw asks for it.
void hpn_fmt_param (uint8_t id, int32_t value, char *out, size_t n)
 A value of parameter id in its unit, without the stored value: "30%", "CW", "1500.00us".
const char * hpn_param_label (uint8_t id)
 The label of parameter id's row in the series in use.
static void image_value (uint8_t id, const hitec_image_t *img, char *out, size_t n)
 Parameter id of img as a line's value: decoded, or RAW.
void hpn_change_line (uint8_t id, const hitec_image_t *img, char *out, size_t n)
 "LABEL: was -> now" of parameter id, the servo's value and img's.
bool hpn_row_edited (const hpn_row_t *r)
 Whether row r shows a value the draft changes.
static void name_value (char *out, size_t n)
 The classic model's name: Hitec's, the name cells as read, or "--".
static void act_value (const hpn_row_t *r, char *out, size_t n)
 The text on an action row's button.
void hpn_value_text (const hpn_row_t *r, char *out, size_t n, bool *warn)
 The text in a row's control into out.
bool hpn_port_unbound (void)
 Whether the PORT row names no pin: the warning colour.
static void supply_text (char *out, size_t n)
 The supply a CONNECT asks, or the session's, into out.
bool hpn_port_line (int i, char *out, size_t n)
 Line i of the PORT row into out.
static void pwm_line (char *out, size_t n)
 The state line while the tester has the port.
static void held_line (char *out, size_t n)
 The state line while the port is this panel's and nothing runs.
static void writing_line (char *out, size_t n)
 The state line while a write runs: the step, the save, the check.
void hpn_state_line (char *out, size_t n)
 The state line of the SERVO tab into out.
static bool rec_by_pin (const hitec_prog_msg_t *m)
 Whether a record message names the record's pin: it names its port where the pin is not known.
static unsigned rec_num (const hitec_prog_msg_t *m)
 The number a record line names: the pin, or the port counted from 1.
static void cut_line (char *out, unsigned kind, unsigned addr)
 The line of a write cut at step kind kind.
static int write_lines (const hitec_prog_msg_t *m, char out[HITEC_PANEL_MSG_LINES][HITEC_PANEL_LINE])
 The lines of a write's message: what it wrote, where it was cut, what an edit refused.
static int formatted (const hitec_prog_msg_t *m, char out[HITEC_PANEL_MSG_LINES][HITEC_PANEL_LINE])
 The lines of a message whose text takes its arguments.
int hitec_panel_message_lines (const hitec_prog_msg_t *m, char out[HITEC_PANEL_MSG_LINES][HITEC_PANEL_LINE])
 A message's lines, in the language in force.

Variables

static const int16_t k_lines [HITEC_PROG_MSG_COUNT][2]
 A message's first line and, where it has one, its second.

Detailed Description

The texts of the Hitec programmer's overlay: the rows' labels, the values as read, the PORT row, the state line and the messages.

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

◆ act_value()

void act_value ( const hpn_row_t * r,
char * out,
size_t n )
static

The text on an action row's button.

Parameters
rthe row
outthe text
nbytes at out

◆ cut_line()

void cut_line ( char * out,
unsigned kind,
unsigned addr )
static

The line of a write cut at step kind kind.

Parameters
outthe line
kindhitec_step_kind_t, or HITEC_PROG_CUT_CHECK for the read-back
addrthe register or cell

◆ fmt_value()

void fmt_value ( uint8_t id,
uint8_t unit,
const hitec_value_t * v,
bool with_raw,
char * out,
size_t n )
static

A decoded value in its unit, with the stored value beside it where the two differ and with_raw asks for it.

Parameters
idhitec_param_t
unithitec_unit_t
vthe value
with_rawthe stored value in brackets
outthe text
nbytes at out

◆ formatted()

int formatted ( const hitec_prog_msg_t * m,
char out[HITEC_PANEL_MSG_LINES][HITEC_PANEL_LINE] )
static

The lines of a message whose text takes its arguments.

Parameters
mthe message
outthe lines
Returns
the lines used

◆ held_line()

void held_line ( char * out,
size_t n )
static

The state line while the port is this panel's and nothing runs.

Parameters
outthe text
nbytes at out

◆ hitec_panel_message_lines()

int hitec_panel_message_lines ( const hitec_prog_msg_t * m,
char out[HITEC_PANEL_MSG_LINES][HITEC_PANEL_LINE] )

A message's lines, in the language in force.

Parameters
mthe message
outreceives the lines
Returns
the lines used, 0 for no message

◆ hpn_change_line()

void hpn_change_line ( uint8_t id,
const hitec_image_t * img,
char * out,
size_t n )

"LABEL: was -> now" of parameter id, the servo's value and img's.

Parameters
idhitec_param_t
imgthe image the write leaves
outthe text
nbytes at out

◆ hpn_choice_text()

const char * hpn_choice_text ( uint8_t id,
int32_t value )

The words of a CHOICE value of id: "CW", "ON".

Parameters
idhitec_param_t
valuethe value
Returns
the text

◆ hpn_fmt_param()

void hpn_fmt_param ( uint8_t id,
int32_t value,
char * out,
size_t n )

A value of parameter id in its unit, without the stored value: "30%", "CW", "1500.00us".

Parameters
idhitec_param_t
valuethe decoded value
outthe text
nbytes at out

◆ hpn_label()

const char * hpn_label ( const hpn_row_t * r)

A row's label as it is drawn now.

Parameters
rthe row
Returns
the label, static for the PORT and SERVO rows

◆ hpn_param_label()

const char * hpn_param_label ( uint8_t id)

The label of parameter id's row in the series in use.

Parameters
idhitec_param_t
Returns
the label; "" for none

◆ hpn_port_line()

bool hpn_port_line ( int i,
char * out,
size_t n )

Line i of the PORT row into out.

Parameters
i0 or 1
outthe text
nbytes at out
Returns
false for no such line

◆ hpn_port_unbound()

bool hpn_port_unbound ( void )

Whether the PORT row names no pin: the warning colour.

Returns
true when no pin is known

◆ hpn_row_edited()

bool hpn_row_edited ( const hpn_row_t * r)

Whether row r shows a value the draft changes.

Parameters
rthe row
Returns
true when edited

◆ hpn_state_line()

void hpn_state_line ( char * out,
size_t n )

The state line of the SERVO tab into out.

Parameters
outthe text
nbytes at out

◆ hpn_value_text()

void hpn_value_text ( const hpn_row_t * r,
char * out,
size_t n,
bool * warn )

The text in a row's control into out.

Parameters
rthe row
outthe text
nbytes at out
warnset when the value shows raw, as it fits no encoding

◆ image_value()

void image_value ( uint8_t id,
const hitec_image_t * img,
char * out,
size_t n )
static

Parameter id of img as a line's value: decoded, or RAW.

Parameters
idhitec_param_t
imgthe image
outthe text
nbytes at out

◆ name_value()

void name_value ( char * out,
size_t n )
static

The classic model's name: Hitec's, the name cells as read, or "--".

Parameters
outthe text
nbytes at out

◆ pwm_line()

void pwm_line ( char * out,
size_t n )
static

The state line while the tester has the port.

Parameters
outthe text
nbytes at out

◆ rec_by_pin()

bool rec_by_pin ( const hitec_prog_msg_t * m)
static

Whether a record message names the record's pin: it names its port where the pin is not known.

Parameters
mthe message: arg the pin, reg the port
Returns
true for the pin

◆ rec_num()

unsigned rec_num ( const hitec_prog_msg_t * m)
static

The number a record line names: the pin, or the port counted from 1.

Parameters
mthe message
Returns
the number

◆ series_name()

const char * series_name ( uint8_t series)
static

The series' name.

Parameters
serieshitec_family_t
Returns
the text

◆ supply_text()

void supply_text ( char * out,
size_t n )
static

The supply a CONNECT asks, or the session's, into out.

Parameters
outthe text
nbytes at out

◆ write_lines()

int write_lines ( const hitec_prog_msg_t * m,
char out[HITEC_PANEL_MSG_LINES][HITEC_PANEL_LINE] )
static

The lines of a write's message: what it wrote, where it was cut, what an edit refused.

Parameters
mthe message
outthe lines
Returns
the lines used; 0 for a message of another kind

◆ writing_line()

void writing_line ( char * out,
size_t n )
static

The state line while a write runs: the step, the save, the check.

Parameters
outthe text
nbytes at out