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

The poll of the far end, once a control pass: the bench page and the services while the IOmcu answers, its identity while it does not, the link-up and link-lost edges, the model and the log while nothing answers, and the snapshot the screen reads. More...

#include <stdatomic.h>
#include <stdio.h>
#include <string.h>
#include "esp_log.h"
#include "freertos/FreeRTOS.h"
#include "freertos/queue.h"
#include "freertos/semphr.h"
#include "arming.h"
#include "bind_link.h"
#include "can_twai.h"
#include "link_bringup.h"
#include "link_host.h"
#include "link_pages.h"
#include "out_bind.h"
#include "outputs.h"
#include "outputs_screen.h"
#include "outputs_pages.h"
#include "panel.h"
#include "prog_link.h"
#include "sense_link.h"
#include "servo_page.h"
#include "servo_screen.h"
#include "servo_source.h"
#include "supply_link.h"
#include "telemetry_sim.h"
#include "tone_link.h"
#include "ui_text.h"

Functions

static void iface_pins_publish (bool up)
static bool poll_bench (bench_state_t *bench)
static bool probe_identity (link_msg_t *reply)
static void learn_board_pins (void)
static void post_reading (const bind_reading_t *r)
void post_no_reading (void)
void read_outputs_binding (void)
static void link_came_up (const link_msg_t *reply)
static void read_status_counters (void)
bool poll_far_end (bool *link_up, bench_state_t *bench, uint32_t *last_poll, uint32_t *last_status)
static void servo_window_take (bench_state_t *bench)
static void rail_sample (const bench_state_t *bench, float dt_s, bool driving)
 The servo rail's reading for a SERVO run's row, into s_rail, and the run's totals of it: the INA3221's newest window while an INA3221 channel is the rail's meter, the supply's last reading otherwise.
void advance_model_and_log (bool link_up, float emitted, telemetry_sim_t *sim, bench_state_t *bench, bool *new_sample)
void publish_snapshot (const bench_state_t *bench, bool link_up, bool new_sample)

Variables

static const char * TAG = "rcbench"
static uint16_t s_dev_faults
link_uph_mismatch_t s_mismatch
atomic_ullong s_throttle_pins
atomic_bool s_throttle_pins_known
atomic_uint s_throttle_proto
static sense_link_win_t s_rail_win
 The newest window of the rail's INA3221 channel, from SERVO_WIN, for the rows while the INA3221 is the rail's meter. Control task only.
static bool s_rail_win_ok
 s_rail_win holds a window of the meter's current stretch.
atomic_uint s_servo_log = 0x8000u
 The pulse and the angle the render side last handed over (log_servo_pack()), none until it does.

Detailed Description

The poll of the far end, once a control pass: the bench page and the services while the IOmcu answers, its identity while it does not, the link-up and link-lost edges, the model and the log while nothing answers, and the snapshot the screen reads.

SPDX-License-Identifier: MIT

Function Documentation

◆ rail_sample()

void rail_sample ( const bench_state_t * bench,
float dt_s,
bool driving )
static

The servo rail's reading for a SERVO run's row, into s_rail, and the run's totals of it: the INA3221's newest window while an INA3221 channel is the rail's meter, the supply's last reading otherwise.

Parameters
benchThe sample, for its source.
dt_sThe time since the last sample, s.
drivingtrue while the bank is ARMED.

Variable Documentation

◆ s_servo_log

atomic_uint s_servo_log = 0x8000u

The pulse and the angle the render side last handed over (log_servo_pack()), none until it does.

The SERVO screen's pulse and angle for a SERVO run's rows, packed (log_servo_pack()): stored by the render side each frame, read by the control task.

The pulse and the angle the render side last handed over (log_servo_pack()), none until it does.