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

The SUPPLY screen: a programmable supply set, switched and watched. More...

#include <stdbool.h>
#include <stddef.h>
#include "supply.h"
#include "ui_keypad.h"
#include "ui_screen.h"

Go to the source code of this file.

Data Structures

struct  supply_cmd_t

Enumerations

enum  supply_by_t { SUPPLY_BY_NONE = 0 , SUPPLY_BY_SUPPLY , SUPPLY_BY_SERVO , SUPPLY_BY_STICK }
enum  supply_pane_t { SUPPLY_PANE_PLOT = 0 , SUPPLY_PANE_TABLE , SUPPLY_PANE_COUNT }
 LIVE's views of the readings: the plot or the table.

Functions

int supply_screen_task (void)
void supply_screen_push (const supply_state_t *s)
const supply_state_t * supply_screen_reading (void)
void supply_screen_set_output (bool on)
void supply_screen_set_caps (const supply_caps_t *caps)
void supply_screen_set_model (bool model)
bool supply_screen_model (void)
 Whether the numbers come from the panel's model.
void supply_screen_set_baud (uint32_t baud)
void supply_screen_set_pins (int tx, int rx)
 The PD mini's UART pins, IOmcu GPIO numbers, named in the header ("PD MINI TX GPIO 12 RX GPIO 13").
void supply_screen_header_text (char *out, size_t size)
 The left text of the header strip: the supply and its pins, the answer and the rate ("PD MINI TX GPIO 12 RX GPIO 13 ONLINE 38400"), 47 characters at most.
float supply_screen_set_v (void)
float supply_screen_set_i (void)
 The current limit's set point as the screen holds it, snapped to the caps.
void supply_screen_settings_loaded (void)
supply_limits_t supply_screen_limits (void)
void supply_screen_limits_changed (void)
supply_caps_t supply_screen_caps (void)
bool supply_screen_typed_asks (void)
void supply_screen_put (float v, float i)
void supply_screen_set_port_held (bool held)
void supply_screen_set_hitec_held (bool held)
 The Hitec programmer's word on the same hold: the supply is held while either programmer says so. supply_screen_set_port_held() is the KST programmer's.
bool supply_screen_port_held (void)
 Whether a programming port holds the supply (supply_screen_set_port_held()).
void supply_screen_adopt (float v, float i)
bool supply_screen_output_on (void)
 Whether the output is on as this screen believes it: what the supply reported, with an OFF this screen asked for and has not yet seen answered counted as off.
bool supply_screen_output_live (void)
uint32_t supply_screen_off_count (void)
void supply_screen_ask_on (supply_by_t by)
supply_by_t supply_screen_owner (void)
void supply_screen_claim (supply_by_t by)
void supply_screen_left (supply_by_t by)
void supply_screen_entered (supply_by_t by)
bool supply_screen_off_owed (void)
void supply_screen_ask_off (void)
bool supply_screen_output_held (void)
bool supply_screen_off_pending (void)
void supply_screen_cancel_on (void)
void supply_screen_set_on_coming (bool coming)
bool supply_screen_poll_cmd (supply_cmd_t *out)
void supply_invalidate (void)
 Everything SUPPLY draws is drawn again on its next frame.
const ui_screen_t * supply_screen (void)
 The SUPPLY screen as the router drives it.
const ui_keypad_t * supply_screen_keypad (void)
 The keypad of the set points and of SETTINGS' rows, open or closed, for a test to read what it opened with and where its keys are.

Detailed Description

The SUPPLY screen: a programmable supply set, switched and watched.

MOTOR & ESC's layout with a supply's controls: the plot of voltage, current and power on the left, the readouts on the right, the two set points below the plot and the output switch beside them. The output comes on with a hold, as ARM does, and goes off with a tap.

A workbench (ui_workbench.h): the strip at the top shows LIVE, the plot and the set points, and SETTINGS, the operator's limits in the same column – caps on the set points, the set points after a restart, the trips and the questions – kept in the settings model. The menu's tile opens LIVE; a tab switch is no navigation level.

A set point is shown beside its reading everywhere: in brackets on the rail's cards and dashed in the plot. A tap on a card or on a set point's value opens a keypad over the left column. The right column stays live on both tasks and under the keypad and the question, so OUTPUT OFF is always a tap away.

Owns no hardware and performs no I/O (input/output): it is handed a supply_state_t and touch events, and commands are read back out.

SPDX-License-Identifier: MIT

Enumeration Type Documentation

◆ supply_by_t

The screen whose ON the output is. Leaving that screen switches the output off (supply_screen_left()); no other screen names a live output, so none is left on behind one that is not shown.

Function Documentation

◆ supply_screen()

const ui_screen_t * supply_screen ( void )

The SUPPLY screen as the router drives it.

Returns
The screen; never NULL.

◆ supply_screen_adopt()

void supply_screen_adopt ( float v,
float i )

The set points a programming port gave the supply, onto the screen: supply_screen_put() for the one caller that reports and does not ask.

◆ supply_screen_ask_off()

void supply_screen_ask_off ( void )

OUTPUT OFF tapped elsewhere: an OFF is posted, and any ON dropped.

◆ supply_screen_ask_on()

void supply_screen_ask_on ( supply_by_t by)

OUTPUT ON's hold completed elsewhere, as it does here: an ON is posted unless an OFF already is, and the output is by's from then on.

◆ supply_screen_cancel_on()

void supply_screen_cancel_on ( void )

A hold under way is abandoned and a pending ON dropped: STOP.

◆ supply_screen_caps()

supply_caps_t supply_screen_caps ( void )

The set points' range: the supply's caps narrowed by the operator's.

◆ supply_screen_claim()

void supply_screen_claim ( supply_by_t by)

An output reported on that nobody here asked for becomes by's: the servo programmer's CONNECT, which switches a PD mini on through the IOmcu and not through this screen. An owned output keeps its owner.

◆ supply_screen_entered()

void supply_screen_entered ( supply_by_t by)

Screen by is shown again: an OFF owed for leaving it is dropped.

◆ supply_screen_header_text()

void supply_screen_header_text ( char * out,
size_t size )

The left text of the header strip: the supply and its pins, the answer and the rate ("PD MINI TX GPIO 12 RX GPIO 13 ONLINE 38400"), 47 characters at most.

Parameters
outtakes the text
sizebytes at out

◆ supply_screen_keypad()

const ui_keypad_t * supply_screen_keypad ( void )

The keypad of the set points and of SETTINGS' rows, open or closed, for a test to read what it opened with and where its keys are.

Returns
The keypad; never NULL.

◆ supply_screen_left()

void supply_screen_left ( supply_by_t by)

Screen by is left. An output it owns – on, or an ON on its way – is switched off. While a servo programming port holds the supply (supply_screen_set_port_held()) an OFF would end the port's session and cut a write on the wire: the OFF is owed instead, and sent when the port lets go, unless supply_screen_entered() came first. An output another screen owns, or none, stays as it is.

◆ supply_screen_limits()

supply_limits_t supply_screen_limits ( void )

The operator's limits as the screen last read them from the settings.

◆ supply_screen_limits_changed()

void supply_screen_limits_changed ( void )

The caps were changed in the settings from elsewhere, so read them again.

◆ supply_screen_model()

bool supply_screen_model ( void )

Whether the numbers come from the panel's model.

Returns
True for the model, false for a supply.

◆ supply_screen_off_count()

uint32_t supply_screen_off_count ( void )

How many times the output has been reported going off. A question about a live output records it and stands only while it is unchanged: an OFF and a new ON between two frames end the run it was about.

◆ supply_screen_off_owed()

bool supply_screen_off_owed ( void )

Whether an OFF is owed for a screen left while a port held the supply.

◆ supply_screen_off_pending()

bool supply_screen_off_pending ( void )

Whether an OFF is posted and not yet taken by supply_screen_poll_cmd().

◆ supply_screen_output_held()

bool supply_screen_output_held ( void )

Whether OUTPUT ON is being held on this screen: a press on the switch that began with the output off.

◆ supply_screen_output_live()

bool supply_screen_output_live ( void )

The output on, or an ON asked for and still on its way: what a set point change is asked about.

◆ supply_screen_output_on()

bool supply_screen_output_on ( void )

Whether the output is on as this screen believes it: what the supply reported, with an OFF this screen asked for and has not yet seen answered counted as off.

Returns
True for on.

◆ supply_screen_owner()

supply_by_t supply_screen_owner ( void )

The screen whose ON the output is, or SUPPLY_BY_NONE: off, no ON on its way, or an OFF asked since.

◆ supply_screen_poll_cmd()

bool supply_screen_poll_cmd ( supply_cmd_t * out)

True when anything was asked; clears it.

◆ supply_screen_port_held()

bool supply_screen_port_held ( void )

Whether a programming port holds the supply (supply_screen_set_port_held()).

Returns
True while it holds it.

◆ supply_screen_push()

void supply_screen_push ( const supply_state_t * s)

One sample, for the readouts and, while the output is on, the plot.

◆ supply_screen_put()

void supply_screen_put ( float v,
float i )

Both set points, typed elsewhere and confirmed where they needed it; snapped to the caps.

◆ supply_screen_reading()

const supply_state_t * supply_screen_reading ( void )

The newest sample supply_screen_push() took, as it took it: zeroed, so not online, before the first.

◆ supply_screen_set_baud()

void supply_screen_set_baud ( uint32_t baud)

The PD mini's UART (universal asynchronous receiver-transmitter) rate in baud, shown after ONLINE in the header ("ONLINE 38400"); 0 shows none. Not shown for the model, nor while the module does not answer.

◆ supply_screen_set_caps()

void supply_screen_set_caps ( const supply_caps_t * caps)

What the set points may be; the sliders and steps follow it.

◆ supply_screen_set_hitec_held()

void supply_screen_set_hitec_held ( bool held)

The Hitec programmer's word on the same hold: the supply is held while either programmer says so. supply_screen_set_port_held() is the KST programmer's.

Parameters
heldwhether the Hitec programmer, or the SUPPLY page's own LINK_SP_PORT, says a programming port holds the supply

◆ supply_screen_set_i()

float supply_screen_set_i ( void )

The current limit's set point as the screen holds it, snapped to the caps.

Returns
The set point, A.

◆ supply_screen_set_model()

void supply_screen_set_model ( bool model)

Whether the numbers come from the panel's model rather than a supply.

◆ supply_screen_set_on_coming()

void supply_screen_set_on_coming ( bool coming)

Whether an ON this screen asked for can still be on its way: false once the application has taken every ON it sent and the output is not on, so an ON it dropped – stale, or lost to a full queue – stops counting as live. An ON this screen holds and has not handed over still counts.

◆ supply_screen_set_output()

void supply_screen_set_output ( bool on)

Whether the supply's output is on, as the supply reports it. That bounds a run: switching on clears the plot and starts it, switching off holds it.

◆ supply_screen_set_pins()

void supply_screen_set_pins ( int tx,
int rx )

The PD mini's UART pins, IOmcu GPIO numbers, named in the header ("PD MINI TX GPIO 12 RX GPIO 13").

With either pin not set, or both on one GPIO, the header says "PD MINI NO PINS": the page holds no pins then. Not shown for the model.

Parameters
txthe TX pin; negative is not set
rxthe RX pin; negative is not set

◆ supply_screen_set_port_held()

void supply_screen_set_port_held ( bool held)

The output as the supply last reported it. Whether a servo programming port is out of PWM. The IOmcu then takes an OFF from the panel and no other command (supply_page.h), and this screen offers the same: OUTPUT OFF and RESET PEAKS work, OUTPUT ON, the sliders, the steps and the set points' keypads take no press and are drawn dimmed, supply_screen_put() and supply_screen_ask_on() do nothing, and the MODE card says who holds the supply. What was under way when the port left PWM – a hold on OUTPUT ON, a drag, a keypad of a set point, a question – ends unanswered.

◆ supply_screen_set_v()

float supply_screen_set_v ( void )

The set points as the screen holds them, snapped to the caps.

◆ supply_screen_settings_loaded()

void supply_screen_settings_loaded ( void )

The settings have been loaded: take the limits from them and start the set points at the start values. Called once after settings_init(); the screen reads nothing from the settings before it.

◆ supply_screen_task()

int supply_screen_task ( void )

The task shown, a ui_wb_task_t: LIVE or SETTINGS. A tile opens LIVE; a tap on the other tab switches, and takes an open keypad with it.

◆ supply_screen_typed_asks()

bool supply_screen_typed_asks ( void )

Whether a set point typed now waits for a question before it reaches the supply: the output live or an ON on its way, and SETTINGS, CONFIRM WHILE ON, KEYPAD on.