rcbench
Servo and ESC test bench: panel, IOmcu and shared C
Loading...
Searching...
No Matches
upd_screen.h
Go to the documentation of this file.
1
42
43#ifndef RCBENCH_UPD_SCREEN_H
44#define RCBENCH_UPD_SCREEN_H
45
46#include <stdbool.h>
47#include <stddef.h>
48#include <stdint.h>
49
51#include "ui_screen.h"
52#include "wifi_screen.h"
53
54#ifdef __cplusplus
55extern "C" {
56#endif
57
59typedef enum {
60 UPD_JOB_CHECK = 0,
61 UPD_JOB_DOWNLOAD,
62} upd_job_t;
63
65typedef enum {
66 UPD_PH_IDLE = 0,
67 UPD_PH_JOINING,
68 UPD_PH_ASKING,
69 UPD_PH_SUMS,
70 UPD_PH_IMAGE,
71 UPD_PH_CHECKING,
72 UPD_PH_ENDED,
74
76typedef enum {
77 UPD_GOT_NONE = 0,
78 UPD_GOT_NEWER,
79 UPD_GOT_CURRENT,
80 UPD_GOT_STAGED,
81 UPD_GOT_NO_NET,
82 UPD_GOT_BLOCKED,
83 UPD_GOT_ABORTED,
84 UPD_GOT_JOIN,
85 UPD_GOT_RADIO,
86 UPD_GOT_TIMEOUT,
87 UPD_GOT_CONNECT,
88 UPD_GOT_REFUSED,
89 UPD_GOT_UNEXPECTED,
90 UPD_GOT_SUMS,
91 UPD_GOT_HASH,
92 UPD_GOT_IMAGE,
93 UPD_GOT_MEMORY,
94 UPD_GOT_LIMIT,
95 UPD_GOT_UNVERSIONED,
96 UPD_GOT_PAST_LINE,
97} upd_got_t;
98
100typedef enum {
101 UPD_WHY_NONE = 0,
102 UPD_WHY_ARMED,
103 UPD_WHY_SUPPLY,
104 UPD_WHY_RUN,
105 UPD_WHY_STOP,
106 UPD_WHY_FILES,
107 UPD_WHY_COPROC,
108 UPD_WHY_INSTALL,
109 UPD_WHY_CANCEL,
110 UPD_WHY_BUSY,
111 UPD_WHY_DRAWING,
112} upd_why_t;
113
115typedef enum {
116 UPD_REL_OK = 0,
117 UPD_REL_MISSING,
118 UPD_REL_LONG,
119 UPD_REL_CHAR,
120 UPD_REL_PLACE,
121 UPD_REL_VERSION,
122 UPD_REL_STATUS,
123 UPD_REL_HOPS,
124 UPD_REL_HOST,
125 UPD_REL_NO_LENGTH,
126 UPD_REL_EMPTY,
127 UPD_REL_TOO_BIG,
128 UPD_REL_SHORT,
129 UPD_REL_OVERRUN,
130 UPD_REL_SUMS_BAD,
131 UPD_REL_SUMS_NONE,
132 UPD_REL_SUMS_TWICE,
133 UPD_REL_TAG_NONE,
134 UPD_REL_TAG_LONG,
135 UPD_REL_TAG_FORM,
136 UPD_REL_SCAN_LONG,
137} upd_rel_t;
138
139typedef struct {
140 /* What may run. */
142 bool have_net;
143 char net[WIFI_SSID_MAX + 1];
149 char running[WIFI_VER_MAX + 1];
153
154 /* The last job. */
155 upd_job_t job;
156 upd_phase_t phase;
157 upd_got_t got;
161 int status;
162 uint32_t budget_s;
163 char found[WIFI_VER_MAX + 1];
165 uint32_t left_s;
166 uint32_t done;
167 uint32_t total;
168} upd_view_t;
169
171#define UPD_REQ_CHECK 0x01u
172#define UPD_REQ_CANCEL 0x02u
173#define UPD_REQ_DOWNLOAD 0x04u
174
176void upd_screen_set(const upd_view_t *v);
177
179typedef struct {
180 cu_sec_t sec;
181 bool known;
183 cu_version_t running;
184 cu_version_t carried;
186
190
193
198bool upd_screen_take_coproc(void);
199
201void upd_cu_text(const upd_cu_view_t *v, const char **line,
202 gfx_color_t *col);
203
205const upd_view_t *upd_screen_view(void);
206
208unsigned upd_screen_take(void);
209
211bool upd_busy(const upd_view_t *v);
212
229void upd_result_text(const upd_view_t *v, char *out, size_t n,
230 char *second, size_t n2);
231
240bool upd_result_said_above(const upd_view_t *v);
241
243void upd_screen_invalidate(void);
244
245const ui_screen_t *upd_screen(void);
246const ui_screen_t *upd_remind_screen(void);
247
248/* ------------------------------------------------------ the driver */
249
255#define UPD_START_WAIT_MS (10u * 60u * 1000u)
256
258typedef struct {
259 uint32_t now_ms;
260 bool remind;
262 bool have_net;
265 bool coproc;
266 bool unsafe;
267 bool newer;
268} upd_feed_t;
269
270typedef struct {
271 bool started;
272 uint32_t start_ms;
276
284bool upd_startup_due(upd_driver_t *d, const upd_feed_t *f);
285
293void upd_remind_drive(upd_driver_t *d, const upd_feed_t *f);
294
295#ifdef __cplusplus
296}
297#endif
298
299#endif /* RCBENCH_UPD_SCREEN_H */
The IOmcu's firmware update, as the panel offers and shows it.
cu_sec_t
Definition coproc_update_screen.h:97
Definition coproc_update_screen.h:51
Definition ui_screen.h:68
Definition upd_screen.h:179
bool have_image
Definition upd_screen.h:182
bool known
Definition upd_screen.h:181
Definition upd_screen.h:270
bool check_done
Definition upd_screen.h:273
bool started
Definition upd_screen.h:271
bool dismissed
Definition upd_screen.h:274
uint32_t start_ms
Definition upd_screen.h:272
Definition upd_screen.h:258
bool remind
Definition upd_screen.h:260
bool gate_open
Definition upd_screen.h:263
bool coproc
Definition upd_screen.h:265
bool unsafe
Definition upd_screen.h:266
bool available
Definition upd_screen.h:261
bool newer
Definition upd_screen.h:267
bool files_open
Definition upd_screen.h:264
Definition upd_screen.h:139
int status
Definition upd_screen.h:161
uint32_t left_s
Definition upd_screen.h:165
char found[WIFI_VER_MAX+1]
Definition upd_screen.h:163
wifi_join_t join
Definition upd_screen.h:159
bool radio_free
Definition upd_screen.h:145
upd_why_t why
Definition upd_screen.h:158
upd_rel_t rel
Definition upd_screen.h:160
uint32_t budget_s
Definition upd_screen.h:162
bool unavailable
Definition upd_screen.h:141
upd_why_t block
Definition upd_screen.h:144
uint32_t done
Definition upd_screen.h:166
bool line_capped
Definition upd_screen.h:150
upd_why_t dl_block
Definition upd_screen.h:148
Screen router.
void upd_screen_set_coproc(const upd_cu_view_t *v)
Definition upd_screen.c:225
upd_job_t
Definition upd_screen.h:59
const upd_view_t * upd_screen_view(void)
Definition upd_screen.c:223
upd_why_t
Definition upd_screen.h:100
upd_got_t
Definition upd_screen.h:76
upd_phase_t
Definition upd_screen.h:65
void upd_remind_drive(upd_driver_t *d, const upd_feed_t *f)
Definition upd_screen.c:1123
void upd_cu_text(const upd_cu_view_t *v, const char **line, gfx_color_t *col)
Definition upd_screen.c:713
void upd_screen_set(const upd_view_t *v)
Definition upd_screen.c:211
void upd_screen_invalidate(void)
Definition upd_screen.c:154
bool upd_result_said_above(const upd_view_t *v)
Whether the result card leaves out upd_result_text()'s lines because the status lines above already s...
Definition upd_screen.c:357
const upd_cu_view_t * upd_screen_coproc(void)
Definition upd_screen.c:236
bool upd_busy(const upd_view_t *v)
Definition upd_screen.c:158
void upd_result_text(const upd_view_t *v, char *out, size_t n, char *second, size_t n2)
The line that says how the last job ended, or what it does now, and the line under it.
Definition upd_screen.c:363
unsigned upd_screen_take(void)
Definition upd_screen.c:245
upd_rel_t
Definition upd_screen.h:115
bool upd_screen_take_coproc(void)
Whether HOLD 2s: UPDATE IOMCU completed, once.
Definition upd_screen.c:238
bool upd_startup_due(upd_driver_t *d, const upd_feed_t *f)
Definition upd_screen.c:1096
WI-FI: the panel's Wi-Fi, for two jobs in a browser – every file on the card to download,...
#define WIFI_VER_MAX
The longest version string an image or a release carries.
Definition wifi_screen.h:50
wifi_join_t
Definition wifi_screen.h:82
#define WIFI_SSID_MAX
The longest network name, in bytes.
Definition wifi_screen.h:44