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

The IOmcu's firmware update, as the panel offers and shows it. More...

#include <stdbool.h>
#include <stdint.h>
#include "ui_screen.h"

Go to the source code of this file.

Data Structures

struct  cu_version_t
struct  cu_feed_t
struct  cu_driver_t
struct  cu_hand_t

Enumerations

enum  cu_view_t { CU_VIEW_QUESTION = 0 , CU_VIEW_PROGRESS }
enum  cu_step_t {
  CU_STEP_PREPARE = 0 , CU_STEP_SEND , CU_STEP_VERIFY , CU_STEP_RESTART ,
  CU_STEP_BUY
}
enum  cu_check_t {
  CU_CHECK_NONE = 0 , CU_CHECK_RUNNING , CU_CHECK_SAME , CU_CHECK_DIFFERENT ,
  CU_CHECK_USB , CU_CHECK_FAILED , CU_CHECK_UPDATING
}
enum  cu_sec_t {
  CU_SEC_NO_IMAGE = 0 , CU_SEC_BUSY , CU_SEC_NO_LINK , CU_SEC_UNKNOWN ,
  CU_SEC_CHECKING , CU_SEC_FAILED , CU_SEC_USB , CU_SEC_SAME ,
  CU_SEC_UNSAFE , CU_SEC_RADIO , CU_SEC_INSTALL , CU_SEC_READY
}

Functions

bool coproc_update_older (cu_version_t running, cu_version_t carried)
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)
void coproc_update_screen_invalidate (void)
cu_sec_t coproc_update_section (const cu_driver_t *d, const cu_feed_t *f, bool unsafe)
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)

Detailed Description

The IOmcu's firmware update, as the panel offers and shows it.

Two views. The question: which version the IOmcu runs, which one this panel carries, whether that one is older, CANCEL and START. START takes the 2s hold (UI_HOLD_S), the ARM gesture. The progress: a full screen without the band, like the bus-fault screen, with the step under way and the blocks sent. The bench cannot be armed while it shows: the IOmcu refuses ARM for the whole update session.

The screen decides nothing about the update. The application offers it, takes START or CANCEL from the latches, reports the step, and moves the router away when the update has ended.

SETUP > UPDATES starts the same update from its IOmcu section, offered or declined: coproc_update_section() says whether it may and why not, and coproc_update_drive() hands UPDATES that answer every frame, takes its hold, opens the progress and returns to UPDATES at the end.

SPDX-License-Identifier: MIT

Enumeration Type Documentation

◆ cu_check_t

enum cu_check_t

The control task's last look at the IOmcu's build.

Enumerator
CU_CHECK_NONE 

no IOmcu checked since the start

CU_CHECK_RUNNING 

the build check runs

CU_CHECK_SAME 

it runs the build this panel carries

CU_CHECK_DIFFERENT 

another build: offered, or declined

CU_CHECK_USB 

it takes no update over CAN

CU_CHECK_FAILED 

the check ended without an answer

CU_CHECK_UPDATING 

an update, or the BUY of an image on trial

◆ cu_sec_t

enum cu_sec_t

UPDATES' IOmcu section: whether its hold may start the update, and if not why. coproc_update_section() picks the first that holds, in this order. Only CU_SEC_READY takes the hold.

Enumerator
CU_SEC_NO_IMAGE 

this build carries no IOmcu image

CU_SEC_BUSY 

an update runs, or a START is not yet taken

CU_SEC_NO_LINK 

no IOmcu answers

CU_SEC_UNKNOWN 

it answers; its build was not looked at yet

CU_SEC_CHECKING 

the build check runs

CU_SEC_FAILED 

the build check ended without an answer

CU_SEC_USB 

it takes no update over CAN

CU_SEC_SAME 

it runs the carried build: nothing to do

CU_SEC_UNSAFE 

ARMED, an arm waiting, the supply on

CU_SEC_RADIO 

the panel's radio is not wholly off

CU_SEC_INSTALL 

an install of a panel image is under way

CU_SEC_READY 

the hold starts the update

◆ cu_step_t

enum cu_step_t

The step the progress view names.

Enumerator
CU_STEP_PREPARE 

hashing the image before the first block

CU_STEP_SEND 

blocks going out

CU_STEP_VERIFY 

the IOmcu hashes what it wrote

CU_STEP_RESTART 

it restarts into the new slot

CU_STEP_BUY 

and this panel keeps the new image

Function Documentation

◆ coproc_update_drive()

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.

◆ coproc_update_older()

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.

◆ coproc_update_screen_offer()

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.

◆ coproc_update_screen_progress()

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.

◆ coproc_update_screen_take_cancel()

bool coproc_update_screen_take_cancel ( void )

True once after CANCEL, or after the question was left another way.

◆ coproc_update_screen_take_start()

bool coproc_update_screen_take_start ( void )

True once after START's hold completed; the view is then PROGRESS.

◆ coproc_update_section()

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.