|
rcbench
Servo and ESC test bench: panel, IOmcu and shared C
|
coproc_update_screen.h says what this screen is for. More...
#include "coproc_update_screen.h"#include <stdio.h>#include <string.h>#include "ui_text.h"#include "ui_theme.h"#include "ui_widgets.h"#include "upd_screen.h"Data Structures | |
| struct | [struct].s |
| Driver state of the UART: the claimed machines and the pins. More... | |
Macros | |
| #define | CU_FONT_HEAD (&gfx_font_20x36) |
| The title and the step: 20 x 36. | |
| #define | CU_FONT_BODY UI_FONT_BODY |
| The lines read at a distance: 12 x 24. | |
| #define | CU_FONT_LABEL (&gfx_font_10x20) |
| The buttons: 10 x 20. | |
| #define | Q_BOX gfx_rect_make(82, 120, 860, 248) |
| The question's box, in the body. | |
| #define | Q_TEXT_X (82 + 24) |
| #define | Q_TEXT_W (860 - 48) |
| #define | Q_CANCEL gfx_rect_make(106, 288, 398, 56) |
| CANCEL, in the body. | |
| #define | Q_START gfx_rect_make(520, 288, 398, 56) |
| START, in the body. | |
| #define | W UI_PANEL_W |
| The panel's width, px. | |
| #define | BAR_H 64 |
| The progress's title bar's height, px. | |
| #define | COL_X 24 |
| The progress's left edge. | |
| #define | COL_W (W - 2 * COL_X) |
| #define | PITCH 28 |
| #define | STEP_Y (BAR_H + 20) |
| The step's top. | |
| #define | FROM_Y (STEP_Y + 48) |
| The versions' top. | |
| #define | PBAR gfx_rect_make(COL_X, 180, COL_W, 36) |
| The progress bar, 36px tall. | |
| #define | COUNT_Y 228 |
| The block count's top. | |
| #define | NOTE_Y 288 |
| The first note's top. | |
Functions | |
| void | coproc_update_screen_invalidate (void) |
| bool | coproc_update_older (cu_version_t running, cu_version_t carried) |
| static bool | same_version (void) |
| static void | drop_press (void) |
| static void | reset (void) |
| void | coproc_update_screen_offer (cu_version_t running, cu_version_t carried) |
| void | coproc_update_screen_progress (cu_step_t step, uint16_t block, uint16_t blocks) |
| cu_view_t | coproc_update_screen_view (void) |
| bool | coproc_update_screen_take_start (void) |
| bool | coproc_update_screen_take_cancel (void) |
| static int | button_at (int16_t x, int16_t y) |
| static void | event (const touch_event_t *evt) |
| static void | tick (float dt_s) |
| static void | leave (void) |
| static void | enter (void) |
| static void | cancel (void) |
| static void | fmt_version (char *out, size_t n, cu_version_t v) |
| static void | render_question (gfx_canvas_t *c, unsigned bit) |
| The question: the box and its lines once per framebuffer, the two buttons every frame. | |
| static const char * | step_text (cu_step_t step) |
| static void | render_progress (gfx_canvas_t *c, unsigned bit) |
| The progress on the whole panel: the bar, the step and the notes once per framebuffer, the bar and the block count every frame. | |
| static void | render (gfx_canvas_t *c, int buffer_index) |
| cu_sec_t | coproc_update_section (const cu_driver_t *d, const cu_feed_t *f, bool unsafe) |
| static void | start_from_updates (const cu_feed_t *f) |
| static void | progress_done (const cu_driver_t *d) |
| void | coproc_update_drive (cu_driver_t *d, const cu_feed_t *f, bool unsafe, cu_hand_t *out) |
| const ui_screen_t * | coproc_update_screen (void) |
Variables | |
| static struct | s = { .press_btn = -1 } |
| static const ui_screen_t | k_screen |
coproc_update_screen.h says what this screen is for.
SPDX-License-Identifier: MIT
| #define PITCH 28 |
a CU_FONT_BODY line's pitch
| #define Q_TEXT_W (860 - 48) |
67 cells of CU_FONT_BODY
| #define Q_TEXT_X (82 + 24) |
the lines' left edge
| void coproc_update_drive | ( | cu_driver_t * | d, |
| const cu_feed_t * | f, | ||
| bool | unsafe, | ||
| cu_hand_t * | out ) |
The screen's half of the update, once a frame, whichever screen is current: moves the router to the question, the progress and back, and drains both latches.
Leaving the question any way but START – CANCEL, the HOME tag, an alert, STOP, any jump of the router – latches CANCEL on the way out, after the router has left the screen; the latch is drained here on the next frame and handed over as a decline while the offer stands. The question opens once per offer, on the overview of a bench that is not unsafe, with the radio wholly off and no panel install under way.
And UPDATES' section: its state (coproc_update_section()) and the two versions go to upd_screen_set_coproc() every frame, and a completed hold (upd_screen_take_coproc()) on a section still READY opens the progress and hands over a START as the question's does. That progress returns to UPDATES when the update ends or its START was spent; the question's returns to the menu.
| bool coproc_update_older | ( | cu_version_t | running, |
| cu_version_t | carried ) |
Whether carried is older than running: the question then says so, and START still takes it after the hold.
| void coproc_update_screen_offer | ( | cu_version_t | running, |
| cu_version_t | carried ) |
Offer the update: the question view, with the version the IOmcu runs and the one this panel carries. Clears both latches.
| void coproc_update_screen_progress | ( | cu_step_t | step, |
| uint16_t | block, | ||
| uint16_t | blocks ) |
The step under way and the blocks committed of blocks.
| bool coproc_update_screen_take_cancel | ( | void | ) |
True once after CANCEL, or after the question was left another way.
| bool coproc_update_screen_take_start | ( | void | ) |
True once after START's hold completed; the view is then PROGRESS.
| cu_sec_t coproc_update_section | ( | const cu_driver_t * | d, |
| const cu_feed_t * | f, | ||
| bool | unsafe ) |
Whether UPDATES' hold may start the update now, and if not why: the first of cu_sec_t's reasons that holds. unsafe: ARMED, an arm waiting, or the supply's output on or coming. A START handed over and not yet taken (d's starts_sent against f's starts_taken) is BUSY.
The hold asks for what the question asks for: an IOmcu that runs another build (CU_CHECK_DIFFERENT; the same version number with another build is one), offered or declined, a bench that is not unsafe, the radio wholly off and no panel install. An older image is READY, as the question offers it too. One that runs the carried build is SAME: the check found nothing to send, and the link-up offers nothing either.
|
static |
The progress on the whole panel: the bar, the step and the notes once per framebuffer, the bar and the block count every frame.
| c | Canvas, the whole panel. |
| bit | The framebuffer's bit in the drawn mask. |
|
static |
The question: the box and its lines once per framebuffer, the two buttons every frame.
| c | Canvas, the body under the band. |
| bit | The framebuffer's bit in the drawn mask. |
|
static |
| struct [struct].s s |
the question's or the progress's state