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

The warning pages of the programmer's overlay. More...

#include "kst_panel.h"
#include <stdio.h>
#include <string.h>
#include "kst_limits.h"
#include "kst_port.h"
#include "kst_reg.h"
#include "ui_card_text.h"
#include "ui_text.h"
#include "ui_widgets.h"
#include "kst_panel_int.h"

Functions

static void warn_open (int kind, bool danger, const char *title, const char *apply)
 Opens the warning page of kind kind with its title and the label of its hold button.
static char * warn_line (kst_prog_level_t level)
 Takes the next line of the warning page at level and returns its buffer.
static void warn_text (kst_prog_level_t level, const char *s)
 Adds the line s to the warning page at level.
static bool moves_horn (const kst_image_t *to)
 A write of to moves the horn or turns it round: it changes the direction, the centre, an end point or an angle.
static bool horn_due (bool moves)
 The two lines of the first write of a session, and of every write that moves the horn.
static void warn_horn (bool moves)
 Adds the horn warning, when one is due.
static void value_line (kst_field_id_t id, const kst_image_t *to, kst_field_set_t soft)
 One value a write changes: the servo's, the new one, the unit once. In the warning colour where the field is at fault for a soft limit.
int kpn_warn_room (void)
 The rows a warning page's lines may take in the area: those that fit between WARN_TOP and 8px above the buttons, WARN_ROWS at most; 14 in an area 420px tall.
int kpn_warn_rows (void)
 The rows the page's lines take.
static bool warn_room (int i, int n, int rows, int used, int room, int room_rows)
 Line i of n, of rows rows, is shown with used rows taken by the lines before it, on at most room lines and room_rows rows: a line that is not the last leaves a row for the count of the rest.
static void warn_values (const kst_image_t *to, int room, int room_rows)
 The values in which to differs from the servo, in the order of the tabs, on at most room lines and room_rows rows. More than fit leave the last line to their count.
static void warn_rules (kst_rules_t rules, int room, int room_rows)
 The warnings of rules, one line each, on at most room lines and room_rows rows. More than fit leave the last line to their count.
void kpn_warn_soft (const row_t *r)
 The page of an edit of row r that passes a soft limit.
void kpn_warn_enable (void)
 The page of ENABLE WRITE TO SERVO.
static bool no_card (void)
 A write that saves the servo to a file first, and no card to take one: it goes without, and its page says so.
static bool warn_no_file (void)
 What a write with no card leaves out, on the page whose hold sends it.
static int card_rows (void)
 The rows of what warn_card() says.
static void warn_card (void)
 Adds the line that says where the write's backup goes, or that the card is missing.
static unsigned differing (const kst_image_t *a)
 The fields in which a differs from the servo, register 01's copy of Max. Duty left out.
static int kind_text (kst_prog_file_kind_t kind)
 Returns the text id of a file's kind, -1 for any other.
void kpn_warn_file (void)
 The page of a file whose values pass soft limits: its warnings, and the draft takes it after the hold.
void kpn_warn_write (void)
 The page of WRITE: the values, the horn and the card.
ui_text_id_t kpn_from_text (unsigned from)
 The words for where a restore's values come from.
void kpn_warn_restore (const kst_prog_restore_t *plan)
 The page of a restore by plan.
void kpn_warn_check (const kst_prog_restore_t *plan)
 The page of a backup whose values pass soft limits the servo keeps: its warnings first, the restore's page after the hold.
void kpn_warn_release (void)
 The page of RELEASE.
void kpn_warn_leave (void)
 The page of the way back to PWM, with and without a PD mini.
void kpn_warn_hv (uint16_t mv)
 The page of a programming voltage mv, mV, above what a standard servo is rated for.
void kpn_warn_apply (void)
 The hold completed: what the page asked for.

Detailed Description

The warning pages of the programmer's overlay.

The warning pages of the programmer's overlay for KST and Chaservo servos: what a write, a restore, a soft limit, ENABLE WRITE TO SERVO, a file, a release, a leave, a check and HV SERVO each say before they act, and APPLY's hold that acts. The state and the seam are kst_panel_int.h.

SPDX-License-Identifier: MIT

Function Documentation

◆ kpn_from_text()

ui_text_id_t kpn_from_text ( unsigned from)

The words for where a restore's values come from.

Parameters
fromthe source
Returns
the text id

◆ kpn_warn_check()

void kpn_warn_check ( const kst_prog_restore_t * plan)

The page of a backup whose values pass soft limits the servo keeps: its warnings first, the restore's page after the hold.

Parameters
planthe restore

◆ kpn_warn_hv()

void kpn_warn_hv ( uint16_t mv)

The page of a programming voltage mv, mV, above what a standard servo is rated for.

Parameters
mvthe voltage, mV

◆ kpn_warn_restore()

void kpn_warn_restore ( const kst_prog_restore_t * plan)

The page of a restore by plan.

Parameters
planthe restore

◆ kpn_warn_room()

int kpn_warn_room ( void )

The rows a warning page's lines may take in the area: those that fit between WARN_TOP and 8px above the buttons, WARN_ROWS at most; 14 in an area 420px tall.

Returns
the rows

◆ kpn_warn_rows()

int kpn_warn_rows ( void )

The rows the page's lines take.

Returns
the number of rows

◆ kpn_warn_soft()

void kpn_warn_soft ( const row_t * r)

The page of an edit of row r that passes a soft limit.

Parameters
rthe row