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

The panel's start-up: the board, the settings, the display, touch, the card, the link and the IOmcu, each reported to the splash as it happens. More...

#include <stdatomic.h>
#include <stdio.h>
#include "esp_log.h"
#include "art_flash_esp.h"
#include "board_pins.h"
#include "busfault_screen.h"
#include "can_selftest.h"
#include "can_twai.h"
#include "display.h"
#include "fw_ota.h"
#include "log_viewer_screen.h"
#include "panel.h"
#include "panel_main.h"
#include "panel_perf.h"
#include "panel_trial.h"
#include "rcbench_version.h"
#include "selftest.h"
#include "settings.h"
#include "settings_screen.h"
#include "splash_screen.h"
#include "storage.h"
#include "touch.h"
#include "ui_card_text.h"
#include "ui_screen.h"
#include "ui_text.h"
#include "wifi_access.h"

Macros

#define CAN_SELFTEST_MS   1200u
 How long the start-up echo test runs.
#define IDENTITY_WAIT_MS   3000u
 How long to keep asking who is there: 3000ms is about three attempts, because a poll with no answer costs the 1000ms host timeout.

Functions

static bool bench_armed (void)
 Whether the bench is ARMED, as the router's status says; the settings model's ARMED source (settings_set_armed()).
static void pump (void)
 Draws one frame of the splash between initialisation steps, so the splash fills in as it happens.
static bool poll_identity (link_host_t *host, link_msg_t *reply)
 Ask the IOmcu who it is, repeatedly, for IDENTITY_WAIT_MS.
bool bring_up (void)
 Bring the board up and report each step to the splash.

Variables

static const char * TAG = "rcbench"
 Log tag.
static busfault_report_t s_busfault
 The start check's bus-fault report, shown on the band after the splash.
bool s_bus_ok = true
 The start-up's CAN (Controller Area Network) echo test passed; until it says otherwise, true.
bool s_touch_ok = true
 touch_init() answered.
char s_boot_alert [ALERT_MAX]
 What the start check found, for the band once the splash has gone.

Detailed Description

The panel's start-up: the board, the settings, the display, touch, the card, the link and the IOmcu, each reported to the splash as it happens.

app_main (main.c) calls bring_up() once.

SPDX-License-Identifier: MIT

Macro Definition Documentation

◆ CAN_SELFTEST_MS

#define CAN_SELFTEST_MS   1200u

How long the start-up echo test runs.

A verdict needs CAN_SELFTEST_MIN_PROBES (8) probes and one probe is in flight at a time, so with a far end that answers this is hundreds of probes and with one that does not it is tens. It is spent inside the splash, which holds afterwards anyway, so it costs no start-up time an operator waits through.

Function Documentation

◆ bench_armed()

bool bench_armed ( void )
static

Whether the bench is ARMED, as the router's status says; the settings model's ARMED source (settings_set_armed()).

Returns
True while ARMED.

◆ bring_up()

bool bring_up ( void )

Bring the board up and report each step to the splash.

Returns
false when a step the bench cannot run without failed (no display, no touch, an IOmcu that speaks another protocol); the splash names it.

◆ poll_identity()

bool poll_identity ( link_host_t * host,
link_msg_t * reply )
static

Ask the IOmcu who it is, repeatedly, for IDENTITY_WAIT_MS.

The two boards do not finish booting at the same instant, and a first frame onto a bus whose far end is not listening is retransmitted in silicon until it is acknowledged, so a single attempt can miss a working IOmcu. The wait is bounded: a bench with no IOmcu attached must not sit on the splash for ever.

Variable Documentation

◆ s_bus_ok

bool s_bus_ok = true

The start-up's CAN (Controller Area Network) echo test passed; until it says otherwise, true.

whether the CAN self-test passed

◆ s_touch_ok

bool s_touch_ok = true

touch_init() answered.

whether touch_init() answered