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

Panel updates from GitHub: SETUP's UPDATES screen and the reminder. More...

#include <stdbool.h>
#include <stddef.h>
#include <stdint.h>
#include "coproc_update_screen.h"
#include "ui_screen.h"
#include "wifi_screen.h"

Go to the source code of this file.

Data Structures

struct  upd_view_t
struct  upd_cu_view_t
struct  upd_feed_t
struct  upd_driver_t

Macros

#define UPD_REQ_CHECK   0x01u
#define UPD_REQ_CANCEL   0x02u
#define UPD_REQ_DOWNLOAD   0x04u
#define UPD_START_WAIT_MS   (10u * 60u * 1000u)

Enumerations

enum  upd_job_t { UPD_JOB_CHECK = 0 , UPD_JOB_DOWNLOAD }
enum  upd_phase_t {
  UPD_PH_IDLE = 0 , UPD_PH_JOINING , UPD_PH_ASKING , UPD_PH_SUMS ,
  UPD_PH_IMAGE , UPD_PH_CHECKING , UPD_PH_ENDED
}
enum  upd_got_t {
  UPD_GOT_NONE = 0 , UPD_GOT_NEWER , UPD_GOT_CURRENT , UPD_GOT_STAGED ,
  UPD_GOT_NO_NET , UPD_GOT_BLOCKED , UPD_GOT_ABORTED , UPD_GOT_JOIN ,
  UPD_GOT_RADIO , UPD_GOT_TIMEOUT , UPD_GOT_CONNECT , UPD_GOT_REFUSED ,
  UPD_GOT_UNEXPECTED , UPD_GOT_SUMS , UPD_GOT_HASH , UPD_GOT_IMAGE ,
  UPD_GOT_MEMORY , UPD_GOT_LIMIT , UPD_GOT_UNVERSIONED , UPD_GOT_PAST_LINE
}
enum  upd_why_t {
  UPD_WHY_NONE = 0 , UPD_WHY_ARMED , UPD_WHY_SUPPLY , UPD_WHY_RUN ,
  UPD_WHY_STOP , UPD_WHY_FILES , UPD_WHY_COPROC , UPD_WHY_INSTALL ,
  UPD_WHY_CANCEL , UPD_WHY_BUSY , UPD_WHY_DRAWING
}
enum  upd_rel_t {
  UPD_REL_OK = 0 , UPD_REL_MISSING , UPD_REL_LONG , UPD_REL_CHAR ,
  UPD_REL_PLACE , UPD_REL_VERSION , UPD_REL_STATUS , UPD_REL_HOPS ,
  UPD_REL_HOST , UPD_REL_NO_LENGTH , UPD_REL_EMPTY , UPD_REL_TOO_BIG ,
  UPD_REL_SHORT , UPD_REL_OVERRUN , UPD_REL_SUMS_BAD , UPD_REL_SUMS_NONE ,
  UPD_REL_SUMS_TWICE , UPD_REL_TAG_NONE , UPD_REL_TAG_LONG , UPD_REL_TAG_FORM ,
  UPD_REL_SCAN_LONG
}

Functions

void upd_screen_set (const upd_view_t *v)
void upd_screen_set_coproc (const upd_cu_view_t *v)
const upd_cu_view_t * upd_screen_coproc (void)
bool upd_screen_take_coproc (void)
 Whether HOLD 2s: UPDATE IOMCU completed, once.
void upd_cu_text (const upd_cu_view_t *v, const char **line, gfx_color_t *col)
const upd_view_t * upd_screen_view (void)
unsigned upd_screen_take (void)
bool upd_busy (const upd_view_t *v)
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.
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 say them: a check that ended for want of a home network while the card shows "No home network saved." (Wi-Fi set up, no network kept).
void upd_screen_invalidate (void)
const ui_screen_t * upd_screen (void)
const ui_screen_t * upd_remind_screen (void)
bool upd_startup_due (upd_driver_t *d, const upd_feed_t *f)
void upd_remind_drive (upd_driver_t *d, const upd_feed_t *f)

Detailed Description

Panel updates from GitHub: SETUP's UPDATES screen and the reminder.

UPDATES (SCREEN_UPDATES, from SETUP): CHECK FOR UPDATES asks GitHub once which release is the newest, over the home network the panel keeps; the answer stays on the screen. REMINDER AT START switches the start-up check on and off (SET_UPD_REMIND). RELEASES switches between STABLE and TESTING (SET_UPD_CHANNEL): which releases a check looks at; the application drops a result found on the other channel from the view. When a newer release was found, HOLD 2s: DOWNLOAD & INSTALL fetches and installs it.

Its IOmcu section, under the buttons: the version the IOmcu runs, the version of the image this panel carries, and HOLD 2s: UPDATE IOMCU, which starts the update the link-up's question starts, also after that question was declined. The hold is live only while coproc_update_section() reads CU_SEC_READY; any other state greys it and says why in the line above it. coproc_update_drive() hands the section in (upd_screen_set_coproc()) and drains the hold (upd_screen_take_coproc()).

The reminder (SCREEN_UPD_REMIND): the start-up check found a newer release. It opens on OVERVIEW only, with the bench SAFE and the supply off, and never over the IOmcu's update question or its progress, which come first. IGNORE NOW closes it until the next start; NEVER REMIND ME switches SET_UPD_REMIND off and asks for the save; HOLD 2s: DOWNLOAD & INSTALL is the same hold as on UPDATES, and the one confirmation: no question follows the download. Leaving it by the HOME tag is IGNORE NOW.

The screens command nothing. The application hands them what to show (upd_screen_set()) and drains what they ask for (upd_screen_take()), as FILES & UPDATE does. The enums mirror shared/webaccess's wa_fetch.h and shared/fwupdate's fw_release.h; the application maps one onto the other and test_upd_screen holds them equal.

Pure C, no ESP-IDF (Espressif Internet-of-Things Development Framework).

SPDX-License-Identifier: MIT

Macro Definition Documentation

◆ UPD_REQ_CANCEL

#define UPD_REQ_CANCEL   0x02u

CANCEL a check

◆ UPD_REQ_CHECK

#define UPD_REQ_CHECK   0x01u

What the screens ask for: bits of upd_screen_take(). CHECK FOR UPDATES

◆ UPD_REQ_DOWNLOAD

#define UPD_REQ_DOWNLOAD   0x04u

the 2s hold completed

◆ UPD_START_WAIT_MS

#define UPD_START_WAIT_MS   (10u * 60u * 1000u)

The start-up check waits for a moment the bench allows it, and gives up after this long from the panel's start: a check is a start-up thing, not one that comes up an hour into a session.

Enumeration Type Documentation

◆ upd_got_t

◆ upd_job_t

enum upd_job_t

wa_job_t

◆ upd_phase_t

◆ upd_rel_t

◆ upd_why_t

Function Documentation

◆ upd_busy()

bool upd_busy ( const upd_view_t * v)

Whether a job runs: joining to checking.

◆ upd_cu_text()

void upd_cu_text ( const upd_cu_view_t * v,
const char ** line,
gfx_color_t * col )

The section's state line for v, and its colour.

◆ upd_remind_drive()

void upd_remind_drive ( upd_driver_t * d,
const upd_feed_t * f )

The reminder, once a frame, whichever screen is current. Opens it on OVERVIEW when the start-up check found a newer release, the reminder is on, it was not answered at this start, and the bench is not unsafe and the IOmcu's update not offered or running. Takes it down again, unanswered, for any of those changing under it. Drains its answers.

◆ upd_result_said_above()

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 say them: a check that ended for want of a home network while the card shows "No home network saved." (Wi-Fi set up, no network kept).

Parameters
vthe view; NULL is false
Returns
true when the result is not drawn

◆ upd_result_text()

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.

Both screens and the download's progress draw these. Nothing is written when out or second is NULL or has no room. A job stopped for WI-FI (UPD_WHY_FILES) gives two empty lines once the view's radio_free is set: its line says WI-FI is using Wi-Fi, which then no longer holds.

Parameters
vthe view; NULL gives two empty lines
outthe first line, empty for none
nbytes of out
secondthe line under it, or empty
n2bytes of second

◆ upd_screen_coproc()

const upd_cu_view_t * upd_screen_coproc ( void )

What the section shows, for the driver and the tests.

◆ upd_screen_invalidate()

void upd_screen_invalidate ( void )

Repaint on the next frame.

◆ upd_screen_set()

void upd_screen_set ( const upd_view_t * v)

Hand the screens what to show.

◆ upd_screen_set_coproc()

void upd_screen_set_coproc ( const upd_cu_view_t * v)

Hand UPDATES its IOmcu section; a hold the state no longer allows ends unfired.

◆ upd_screen_take()

unsigned upd_screen_take ( void )

The requests since the last call, as UPD_REQ_* bits; cleared.

◆ upd_screen_take_coproc()

bool upd_screen_take_coproc ( void )

Whether HOLD 2s: UPDATE IOMCU completed, once.

Returns
true once after the hold completed; false until the next one

◆ upd_screen_view()

const upd_view_t * upd_screen_view ( void )

What is showing, for the application and the tests.

◆ upd_startup_due()

bool upd_startup_due ( upd_driver_t * d,
const upd_feed_t * f )

Whether the start-up check starts now: once per start, with the reminder on, a home network kept, Wi-Fi available, the gate open, FILES & UPDATE closed, the IOmcu's update neither offered nor running, the router past the splash, and within UPD_START_WAIT_MS of the first drive. True once; the caller starts the check.