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

The updates: the IOmcu's over CAN (Controller Area Network) from the image this panel carries, the panel's own from WI-FI or from GitHub, and the IOmcu update's screen on the render side. cu_service() runs on the control task; the rest runs on app_main. More...

#include <stdatomic.h>
#include <stdbool.h>
#include <stdint.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include "esp_heap_caps.h"
#include "esp_log.h"
#include "esp_system.h"
#include "freertos/FreeRTOS.h"
#include "freertos/task.h"
#include "can_twai.h"
#include "coproc_update_screen.h"
#include "display.h"
#include "flash_gate.h"
#include "fw_install.h"
#include "fw_ota.h"
#include "fw_release.h"
#include "gfx.h"
#include "link_host.h"
#include "link_pages.h"
#include "link_port.h"
#include "link_update_host.h"
#include "panel.h"
#include "rcbench_version.h"
#include "settings.h"
#include "upd_screen.h"
#include "ui_screen.h"
#include "ui_text.h"
#include "wa_fetch.h"
#include "wifi_access.h"
#include "wifi_screen.h"

Macros

#define CU_IMG   _binary_rcbench_iomcu_bin_start
#define CU_LEN
#define CU_SLICE_MS   20u

Enumerations

enum  cu_state_t {
  CU_IDLE = 0 , CU_CHECKING , CU_OFFERED , CU_DECLINED ,
  CU_UPDATING , CU_CONFIRMING
}

Functions

static void cu_enter (cu_state_t st)
static void cu_publish_check (cu_check_t check)
bool cu_may_start (void)
static cu_version_t cu_carried (void)
static bool cu_port_exchange (void *ctx, link_host_t *host, const link_msg_t *req, link_msg_t *reply)
static void cu_publish_offer (bool offered)
static cu_step_t cu_step_of (uint8_t phase)
static void cu_publish_progress (bool active)
void cu_link_up (const link_msg_t *reply)
static void cu_alert_failed (void)
static void cu_checked (void)
static void cu_ended (void)
bool cu_service (bool *link_up, bench_state_t *bench, uint32_t *last_poll, uint32_t *last_status)
static bool run_open_now (void)
static fw_gate_t fw_gate_now (bool armed)
static void update_frame (update_state_t st, const char *version, uint32_t written, uint32_t total)
static void fw_install_run (void)
static void wifi_unavailable_service (void)
void wifi_service (bool armed, uint32_t stops_now)
static wa_why_t why_of_fw_gate (fw_gate_t g)
static wa_why_t upd_check_gate (bool armed)
static wa_channel_t upd_channel (void)
static upd_feed_t upd_feed_now (bool armed, bool unsafe, const cu_snap_t *cs, const wa_fetch_t *f, bool have_net)
void upd_remind_service (bool armed, bool unsafe, const cu_snap_t *cs)
static void upd_ver_text (fw_version_t v, char *out, size_t n)
void upd_service (bool armed, bool unsafe, uint32_t stops_now, const cu_snap_t *cs)
 Once a frame, after wifi_service(): the start-up check, what UPDATES and the reminder ask for, the job's aborts, the download's screen, and what UPDATES shows. armed includes an arm waiting; panel.h names each parameter.
void cu_render_service (bool unsafe, bool link_up, const cu_snap_t *cs)

Variables

static const char * TAG = "rcbench"
atomic_bool s_fw_quiet_req
atomic_bool s_fw_quiet_ack
static atomic_bool s_fw_installing
static atomic_bool s_cu_busy
bool s_wifi_ok
static ui_screen_id_t s_update_back = SCREEN_LOGS
const uint8_t _binary_rcbench_iomcu_bin_start []
const uint8_t _binary_rcbench_iomcu_bin_end []
static link_uph_t s_cu
static cu_state_t s_cu_state
static cu_version_t s_cu_running
static bool s_cu_missed
static bool s_cu_took_down
static uint32_t s_cu_starts_taken
static bool s_cu_declined
static cu_version_t s_cu_declined_for
static atomic_uint s_cu_starts
static atomic_uint s_cu_declined_gen
static uint32_t s_cu_offer_gen
static const link_port_t k_cu_port
static upd_driver_t s_upd
static uint32_t s_upd_boot_gen
static bool s_upd_dl

Detailed Description

The updates: the IOmcu's over CAN (Controller Area Network) from the image this panel carries, the panel's own from WI-FI or from GitHub, and the IOmcu update's screen on the render side. cu_service() runs on the control task; the rest runs on app_main.

SPDX-License-Identifier: MIT

Macro Definition Documentation

◆ CU_LEN

#define CU_LEN
Value:
((uint32_t)(_binary_rcbench_iomcu_bin_end \
- _binary_rcbench_iomcu_bin_start))

Function Documentation

◆ upd_service()

void upd_service ( bool armed,
bool unsafe,
uint32_t stops_now,
const cu_snap_t * cs )

Once a frame, after wifi_service(): the start-up check, what UPDATES and the reminder ask for, the job's aborts, the download's screen, and what UPDATES shows. armed includes an arm waiting; panel.h names each parameter.

SETUP > UPDATES, the reminder and the download, once a frame.

Once a frame, after wifi_service(): the start-up check, what UPDATES and the reminder ask for, the job's aborts, the download's screen, and what UPDATES shows. armed includes an arm waiting; panel.h names each parameter.

Parameters
armedARMED, or an arm waiting
unsafeARMED, an arm waiting, or the supply's output on or coming on
stops_nowSTOP presses since the start; a change is a STOP
csthe IOmcu update's state this frame

Variable Documentation

◆ k_cu_port

const link_port_t k_cu_port
static
Initial value:
= {
cu_port_exchange, port_now, NULL, port_between,
}