|
rcbench
Servo and ESC test bench: panel, IOmcu and shared C
|
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 |
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
| #define SERVO_TASKS |
| 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.
| c | the canvas |
| x | the line's left edge, px |
| y | its top, px |
| void draw_test_page | ( | gfx_canvas_t * | c | ) |
TEST: the two run cards, then the caps.
| c | the canvas |
| gfx_rect_t lim_start_rect | ( | void | ) |
START LIMIT RUN, on the LIMIT RUN card: START TEST's place on its own card.
| 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.
| 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.
| int servo_screen_settings_page | ( | void | ) |
The page SETTINGS shows: 0 OUTPUT, 1 SWEEP, 2 DUT. For tests.
| 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.
| int servo_screen_task | ( | void | ) |
The task the strip shows, a ui_wb_task_t. For tests.
| 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.
| 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().
| out | takes the text |
| size | bytes at out |
| target | the 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 |
| gpio | the port's pin, or SERVO_SCREEN_NO_PIN |
| pwm | whether the port renders its pulse |
| pins | the SERVO PWM pins, bit n for GPIO n, as servo_screen_set_pins() |
| known | whether the binding is read |