|
rcbench
Servo and ESC test bench: panel, IOmcu and shared C
|
The OUTPUTS screen's PROG PORT entry: the left column under the list when a programming port is picked. See outputs_screen.h. More...
#include "outputs_screen.h"#include <stdio.h>#include <string.h>#include "link_pages.h"#include "picker_screen.h"#include "port_view.h"#include "servo_screen.h"#include "settings.h"#include "ui_screen.h"#include "ui_tabs.h"#include "ui_text.h"#include "ui_theme.h"#include "ui_widgets.h"#include "outputs_screen_int.h"Data Structures | |
| struct | [struct].p |
| The page's state. More... | |
Macros | |
| #define | PIN_Y (DD_Y + DD_H + 4) |
| The column under the dropdown, from body y 112 to OU_FOOT: the PIN button, each segment row under its label, the WATCHED BY line, and up to three lines of reason. | |
| #define | PIN_H UI_TAP_MIN |
| #define | FN_Y (PIN_Y + PIN_H + 6) |
| #define | WATCH_Y (FN_Y + SEG_DY + SEG_H + 8) |
| #define | TESTER_Y (WATCH_Y + 26) |
| #define | PWM_Y (TESTER_Y + SEG_DY + SEG_H + 8) |
| #define | WHY_Y (PWM_Y + SEG_DY + SEG_H + 8) |
| The reason's first line. | |
| #define | SEG_DY 22 |
| #define | SEG_H UI_TAP_MIN |
| #define | WATCH_LEN 24 |
| #define | FN_ROW_H UI_TAP_MIN |
| The FUNCTION list's rows under its face. | |
| #define | FN_ROWS_MAX 5 |
Functions | |
| void | outputs_port_touched (void) |
| uint32_t | outputs_port_revision (void) |
| void | outputs_screen_set_port_watch (uint8_t port, const char *label) |
| static gfx_rect_t | seg_row (int label_y) |
| static gfx_rect_t | pin_rect (void) |
| static gfx_rect_t | fn_face (void) |
| static int | fn_rows (void) |
| static gfx_rect_t | fn_list (void) |
| static gfx_rect_t | fn_row (int i) |
| static void | fn_close (void) |
| void | outputs_port_reset (void) |
| void | outputs_port_cancel (void) |
| void | outputs_port_hide (void) |
| void | outputs_screen_select_port (uint8_t port) |
| int | outputs_screen_port_shown (void) |
| void | outputs_port_name (uint8_t port, char *buf, size_t cap) |
| static int | target (void) |
| static bool | known (void) |
| static bool | held (void) |
| static bool | fn_pwm (void) |
| static bool | fn_locked (void) |
| static bool | tester_locked (void) |
| static bool | pwm_locked (void) |
| static void | sync_tabs (void) |
| bool | outputs_screen_port_reason (char *buf, size_t cap) |
| static uint32_t | signature (void) |
| void | outputs_port_tick (void) |
| static int | seg_event (ui_tabs_t *t, const touch_event_t *evt, bool locked, bool *took) |
| static bool | pin_event (const touch_event_t *evt) |
| static bool | fn_event (const touch_event_t *evt) |
| bool | outputs_port_event (const touch_event_t *evt) |
| static void | pin_label (char *buf, size_t cap) |
| void | outputs_port_draw (gfx_canvas_t *c, gfx_rect_t dd, bool pressed, bool open) |
| bool | outputs_port_fn_open (void) |
| bool | outputs_port_back (void) |
Variables | |
| static struct | p = { .port = -1 } |
| static char | g_watch [LINK_PG_PORTS_MAX][WATCH_LEN] |
The OUTPUTS screen's PROG PORT entry: the left column under the list when a programming port is picked. See outputs_screen.h.
Every port's entry has the same rows:
PIN a button with the port's pin; a tap opens PICK A PIN on PROG PORT n, where a tap on a pin asks the IOmcu for it. FUNCTION a choice face with the port's FUNC (protocol 4.26); a tap opens the list over the rows under it: SERVO PWM, NONE, and from 4.28 DSHOT150, DSHOT300, DSHOT600. A tap on an entry asks the IOmcu for it (port_view_ask()). WATCHED BY the INA3221 channel that watches the port, from the sensor map (outputs_screen_set_port_watch()), or none. SERVO TESTER OUTPUTS | PORT n: SET_SERVO_TARGET, 0 or n. PORT PWM ON | OFF: SET_SERVO_PORT_PWM, the target port's pulse.
and one amber line that says why a row takes no press, or how the last ask for this port stands. The pin and the function are the IOmcu's, kept in its flash; the entry asks and never writes a page itself. The two tester settings are the panel's; the control task takes them to the IOmcu on a bench at rest.
SPDX-License-Identifier: MIT
| #define FN_ROWS_MAX 5 |
The functions the list can hold.
| #define PIN_H UI_TAP_MIN |
Its height, px.
The column under the dropdown, from body y 112 to OU_FOOT: the PIN button, each segment row under its label, the WATCHED BY line, and up to three lines of reason.
The PIN button and the segment rows are 48px (UI_TAP_MIN) tall; a label is 10 x 20 with its segment row 22px under its top. The FUNCTION list opens under its face: 5 rows of 48px with its 4px margins end at body y 488, its shadow at OU_FOOT. The PIN button's top.
| #define SEG_DY 22 |
label to segment
| #define SEG_H UI_TAP_MIN |
A segment row's height, px.
| #define TESTER_Y (WATCH_Y + 26) |
SERVO TESTER's label.
| #define WATCH_LEN 24 |
A watch label's bytes.
| bool outputs_screen_port_reason | ( | char * | buf, |
| size_t | cap ) |
The amber line of the PROG PORT entry shown, as the screen draws it under the segments, or an empty string and false with none or no entry shown. In this order: the servo programmer holds the port; the last ask for this port's PIN or FUNCTION waits, was refused or was lost (port_view_ask_line()); the ports are not read yet; the bench is ARMED or a test or sweep runs; the tester drives another port; the port's function is not SERVO PWM; the IOmcu is older than 4.26; the tester drives this port; PORT PWM without this port as the tester's target. outputs_screen_reason() returns the same while an entry is shown.
| int outputs_screen_port_shown | ( | void | ) |
The PROG PORT entry shown, 0 for port 1, or -1 for a protocol.
| void outputs_screen_select_port | ( | uint8_t | port | ) |
Select the PROG PORT entry of port port (0 for port 1), as a pick in the list does: the overview's pins with the port's lit, none taking a tick. A port past outputs_screen_port_entries() is ignored. outputs_screen_select() leaves it.
| void outputs_screen_set_port_watch | ( | uint8_t | port, |
| const char * | label ) |
What watches port port's current, as its entry names it: an INA3221 channel ("INA3221 0x40 CH1", at most 23 characters), or NULL or "" for none. The sensor map sets it; until then every entry says no channel watches it.
| struct [struct].p p |
The entry's state.