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

The SERVO screen as a workbench (ui_workbench.h): the task strip under the band, TEST's page of run cards, and the output card's TARGET row. More...

#include <stdio.h>
#include <string.h>
#include "kst_panel.h"
#include "outputs_screen.h"
#include "servo_limrun.h"
#include "prog_registry.h"
#include "settings.h"
#include "supply_screen.h"
#include "ui_target_row.h"
#include "ui_text.h"
#include "ui_theme.h"
#include "ui_screen.h"
#include "ui_widgets.h"
#include "ui_workbench.h"
#include "servo_screen_int.h"

Macros

#define SERVO_TASKS
#define TARGET_PROTOCOL   "SERVO PWM"
#define TARGET_CELLS   ((unsigned)((RC_W - UI_TARGET_LABEL_W_TALL - 16) / 10))
 Characters the TARGET row's value holds in the 10 x 20 face ui_target_row draws a row UI_TARGET_TALL_H or taller in: the column less the label, 268px, less 8px each side, 25 cells.

Functions

static int servo_sets (const prog_page_set_t *out[PROG_LIST_MAX])
const prog_page_set_t * prog_shown_set (void)
bool prog_holds (void)
void prog_init (void)
void prog_entry (void)
void prog_leave (void)
void prog_cancel (void)
void prog_armed (bool armed)
void prog_tick (float dt_s)
static uint16_t caps_now (void)
static void prog_list_now (prog_list_t *l)
void prog_follow_hold (void)
static uint32_t prog_signature (void)
void prog_page_follow (void)
static void prog_row_open (uint8_t i)
void prog_page_down (const touch_event_t *evt)
static bool prog_page_rest (const touch_event_t *evt)
void prog_search_done (const char *text)
void draw_prog_page (gfx_canvas_t *c)
static void strip_widen (void)
 The strip's tabs laid out again at SERVO's sizes, SV_TAB_W x SV_STRIP_H from (SV_STRIP_X, SV_STRIP_Y): the tasks, their order and their labels as ui_wb_strip_init() set them.
void wb_init (void)
 The strip, the TARGET row and PROGRAM's list laid out; LIVE.
void wb_enter (void)
void wb_leave (void)
void wb_cancel (void)
bool wb_back (void)
gfx_rect_t strip_area (void)
gfx_rect_t lim_start_rect (void)
 START LIMIT RUN, on the LIMIT RUN card: START TEST's place on its own card.
static void task_changed (void)
static void open_outputs (void)
bool wb_down (const touch_event_t *evt)
bool wb_rest (const touch_event_t *evt)
void test_page_down (const touch_event_t *evt)
void draw_strip (gfx_canvas_t *c)
void draw_caps_line (gfx_canvas_t *c, int x, int y)
 SUPPLY's caps in force, which a run's steps and a set point stay inside, read-only here: their home is SUPPLY > SETTINGS.
void draw_test_page (gfx_canvas_t *c)
 TEST: the two run cards, then the caps.
void draw_target (gfx_canvas_t *c)
bool servo_target_line (char *out, size_t size, uint8_t target, uint8_t gpio, bool pwm, uint64_t pins, bool known)
 The TARGET row's value in the current language: protocol pins.
int servo_screen_task (void)
int servo_screen_settings_page (void)
int servo_screen_run_settings (void)
bool servo_screen_target_locked (void)
bool servo_screen_tester_target_locked (void)
bool servo_screen_port_pwm_locked (void)

Variables

static uint32_t s_outputs_nav

Detailed Description

The SERVO screen as a workbench (ui_workbench.h): the task strip under the band, TEST's page of run cards, and the output card's TARGET row.

The strip shows LIVE (the dial, SWEEP, CENTRE, RELEASE), TEST (the AUTOMATIC TEST and LIMIT RUN cards), PROGRAM (the registry's SERVO rows, prog_registry.h) and SETTINGS (OUTPUT, SWEEP, DUT). A tile opens LIVE; each task keeps its own state for the session – SETTINGS its page, TEST the run whose settings are open, PROGRAM its list's page and search – and a tab switch is no navigation level. A run card's SETTINGS opens that run's settings in the page area, one level down: the home tag (wb_back()) and the page's CLOSE climb from there back to TEST, and the home tag from TEST to the menu. A live row on PROGRAM opens its session over the left column, one level down: the home tag and the session's CLOSE climb back to the list, and a session whose port is in programming asks for LEAVE first.

The TARGET row reads what the tester drives as protocol pins and is the control that picks it, as MOTOR & ESC's is: a tap opens SETUP > OUTPUTS on what the tester drives – the PROG PORT entry with the port as the TARGET setting, SERVO PWM otherwise – where SERVO TESTER and PORT PWM are set. The row takes no tap under the TARGET setting's lock, and the home tag there comes back here on the task the row was tapped on.

The screen is servo_screen.c; the state and the layout the files share are servo_screen_int.h.

SPDX-License-Identifier: MIT

Macro Definition Documentation

◆ SERVO_TASKS

#define SERVO_TASKS
Value:
(UI_WB_HAS(UI_WB_LIVE) | UI_WB_HAS(UI_WB_TEST) \
| UI_WB_HAS(UI_WB_PROGRAM) | UI_WB_HAS(UI_WB_SETTINGS))
#define UI_WB_HAS(task)
Definition ui_workbench.h:48

Function Documentation

◆ draw_caps_line()

void draw_caps_line ( gfx_canvas_t * c,
int x,
int y )

SUPPLY's caps in force, which a run's steps and a set point stay inside, read-only here: their home is SUPPLY > SETTINGS.

Parameters
cthe canvas
xthe line's left edge, px
yits top, px

◆ draw_test_page()

void draw_test_page ( gfx_canvas_t * c)

TEST: the two run cards, then the caps.

Parameters
cthe canvas

◆ lim_start_rect()

gfx_rect_t lim_start_rect ( void )

START LIMIT RUN, on the LIMIT RUN card: START TEST's place on its own card.

Returns
the button

◆ servo_screen_port_pwm_locked()

bool servo_screen_port_pwm_locked ( void )

Whether OUTPUTS' PORT PWM segment takes no press: OUTPUTS as the tester's target, the servo programmer holding the port, or a sweep or a run under way; and to switch it on, the bench ARMED or asked to arm.

◆ servo_screen_run_settings()

int servo_screen_run_settings ( void )

Which run's settings TEST shows, one level down from its card: 0 none, 1 the automatic test's, 2 the limit run's. For tests.

◆ servo_screen_settings_page()

int servo_screen_settings_page ( void )

The page SETTINGS shows: 0 OUTPUT, 1 SWEEP, 2 DUT. For tests.

◆ servo_screen_target_locked()

bool servo_screen_target_locked ( void )

Whether the TARGET row takes no press: the bench ARMED, a sweep (running or paused) or a run under way, the servo programmer holding the port. The row names the target all the same.

◆ servo_screen_task()

int servo_screen_task ( void )

The task the strip shows, a ui_wb_task_t. For tests.

◆ servo_screen_tester_target_locked()

bool servo_screen_tester_target_locked ( void )

Whether OUTPUTS' SERVO TESTER segment (the TARGET setting) takes no press: servo_screen_target_locked(), or the bench ARMED for the motor.

◆ servo_target_line()

bool servo_target_line ( char * out,
size_t size,
uint8_t target,
uint8_t gpio,
bool pwm,
uint64_t pins,
bool known )

The TARGET row's value in the current language: protocol pins.

The outputs read "SERVO PWM GPIO 2 GPIO 4", the protocol name the same in every language: as many pins as the 25 cells hold after it, then a count ("SERVO PWM GPIO 2 +2"). A port target reads "PROG PORT 1 GPIO 13", or "PROG PORT 1" without a known pin; while the port renders no pulse "PORT 1 GPIO 13 PWM OFF" or "PROG PORT 1 PWM OFF": 22 characters at most, of the 25 cells the row's value holds.

The row is the control that picks the target: a tap opens SETUP > OUTPUTS on what the row shows – the PROG PORT entry while the IOmcu drives the port, SERVO PWM while it drives the outputs, the overview while the target is not known – where SERVO TESTER sets it. It takes no press while servo_screen_target_locked().

Parameters
outtakes the text
sizebytes at out
targetthe drive's target, as servo_screen_set_drive(): 0 the outputs, 1 to 4 a port, or SERVO_SCREEN_TARGET_UNKNOWN or SERVO_SCREEN_TARGET_NO_LINK
gpiothe port's pin, or SERVO_SCREEN_NO_PIN
pwmwhether the port renders its pulse
pinsthe SERVO PWM pins, bit n for GPIO n, as servo_screen_set_pins()
knownwhether the binding is read
Returns
whether the line takes the warning colour: a port target, no SERVO PWM pin, no binding read, the target not known, or no link