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

The link to the IOmcu: exchange(), through which every request to the far end goes, and the control page, which carries ARM, THROTTLE, the pole count, CLEAR and the throttle's endpoints. The link report is here too. Control task only, and app_main before that task exists. More...

#include <stdatomic.h>
#include <stdio.h>
#include <string.h>
#include "esp_log.h"
#include "esp_timer.h"
#include "freertos/FreeRTOS.h"
#include "freertos/queue.h"
#include "arming.h"
#include "busfault_screen.h"
#include "can_twai.h"
#include "link_bringup.h"
#include "link_host.h"
#include "link_pages.h"
#include "link_port.h"
#include "outputs.h"
#include "outputs_pages.h"
#include "panel.h"
#include "ui_text.h"

Functions

static void exchange_unanswered (void)
bool exchange (link_host_t *host, const link_msg_t *req, link_msg_t *reply)
static bool port_exchange (void *ctx, link_host_t *host, const link_msg_t *req, link_msg_t *reply)
uint32_t port_now (void *ctx)
void port_between (void *ctx)
static bool write_page (link_host_t *host, uint8_t page, uint8_t count, const uint16_t *regs, link_msg_t *reply)
static uint16_t arm_value_wanted (void)
bool control_arm (link_msg_t *reply)
static bool control_write_poles (link_msg_t *reply)
bool poles_service (void)
static endpoints_outcome_t endpoints_pay (uint16_t lo, uint16_t hi)
void endpoints_service (bool far_disarmed)
void far_end_stop_here (void)
void arm_write_failed (uint32_t quiet_before, const char *alert)
static void debug_log (const char *line)
static const char * u32 (char *out, size_t n, uint32_t v)
static busfault_bus_t bus_state (void)
void link_lost_report (busfault_report_t *r)
void link_report (void)
 One block naming the most fundamental fault rather than the loudest. Printed every 5s while the link is down and every 60s while it is up.

Variables

static const char * TAG = "rcbench"
uint32_t s_unanswered
bool s_link_is_up
bool s_link_quiet
const link_port_t k_port
uint16_t s_arm_value
static uint32_t s_poles_alert_gen
static uint32_t s_pulse_alert_gen

Detailed Description

The link to the IOmcu: exchange(), through which every request to the far end goes, and the control page, which carries ARM, THROTTLE, the pole count, CLEAR and the throttle's endpoints. The link report is here too. Control task only, and app_main before that task exists.

SPDX-License-Identifier: MIT

Function Documentation

◆ link_report()

void link_report ( void )

One block naming the most fundamental fault rather than the loudest. Printed every 5s while the link is down and every 60s while it is up.

The verdict judges the window since the previous report, not the session: one burst of late answers at an IOmcu drop is the verdict of the report that covers it, and a link that is healthy again reads as healthy at the next one. The first report's window is everything since start-up. A window of under 4 polls says "link healthy" (link_bringup_diagnose()). A link that is down gets one identity probe about every 1000ms (poll_far_end()'s gate; an unanswered probe waits LINK_HOST_TIMEOUT_MS, 1000ms, of it), so a 5s window holds 4 or 5 polls and a silent link reads as silent.

The panel and iomcu lines keep the totals since start-up; the window's counts have a line of their own.

Variable Documentation

◆ k_port

const link_port_t k_port
Initial value:
= {
port_exchange, port_now, NULL, port_between,
}