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

The render side's services, once a frame on app_main: the programmer's model, the supply's levels, the servo test's lines, the rotary knob, the touch drain and the screens' commands on their way to the control task. More...

#include <math.h>
#include <stdatomic.h>
#include <stdio.h>
#include "esp_log.h"
#include "freertos/FreeRTOS.h"
#include "freertos/queue.h"
#include "hitec_panel.h"
#include "knob.h"
#include "knob_task.h"
#include "kst_panel.h"
#include "kst_prog.h"
#include "motor_screen.h"
#include "panel.h"
#include "esc_stick_panel.h"
#include "servo_link.h"
#include "servo_screen.h"
#include "settings.h"
#include "storage.h"
#include "supply_screen.h"
#include "touch_loss.h"
#include "ui_screen.h"

Functions

void kst_ui_service (void)
void hitec_ui_service (void)
 The Hitec programmer's model, once a frame on app_main: it reads what the control task published (hitec_publish()), and its commands go to the control task's queue.
void flush_screen_commands (uint32_t stops_now)
static void send_cmd (const panel_cmd_t *in)
bool supply_live_or_coming (void)
void publish_supply_levels (void)
void test_lines_service (void)
knob_turn_t knob_take (void)
static void knob_withdraw (void)
void knob_apply (const knob_turn_t *turn, bool frame_lost)
static void touch_stream_broke (uint32_t stops_now, uint32_t cur, bool cur_is_event)
 The screens' record of the glass is stale: an event between the last one they saw and the next never reached them. Every gesture in progress is dropped, which asks for nothing – what letting go early already does – except where abandoning is itself the failure (a disarm press; see ui_router_cancel_gestures()). What that posts goes now, not at the end of the frame: a lost event is what a stalled renderer produces, and a DISARM must not wait behind the render and the flip.
bool drain_touch (uint32_t stops_now)
 Hand the screens what the control task saw of the panel. Render loop only.
void outputs_apply (const outbind_t *b)

Variables

static const char * TAG = "rcbench"
static touch_seq_rx_t s_tq_rx = { .next = 1u }
unsigned s_tq_lost

Detailed Description

The render side's services, once a frame on app_main: the programmer's model, the supply's levels, the servo test's lines, the rotary knob, the touch drain and the screens' commands on their way to the control task.

SPDX-License-Identifier: MIT

Function Documentation

◆ drain_touch()

bool drain_touch ( uint32_t stops_now)

Hand the screens what the control task saw of the panel. Render loop only.

Parameters
stops_nowthe stop count the commands flushed here carry
Returns
whether the stream was found broken

◆ hitec_ui_service()

void hitec_ui_service ( void )

The Hitec programmer's model, once a frame on app_main: it reads what the control task published (hitec_publish()), and its commands go to the control task's queue.

The Hitec programmer's model, once a frame on app_main.

A command the queue does not take stays with the model; one the model hands over and the queue then refuses is lost, and the model says so when its answer does not come (HITEC_PROG_MSG_TIMEOUT).

The Hitec programmer's model, once a frame on app_main: it reads what the control task published (hitec_publish()), and its commands go to the control task's queue.

◆ touch_stream_broke()

void touch_stream_broke ( uint32_t stops_now,
uint32_t cur,
bool cur_is_event )
static

The screens' record of the glass is stale: an event between the last one they saw and the next never reached them. Every gesture in progress is dropped, which asks for nothing – what letting go early already does – except where abandoning is itself the failure (a disarm press; see ui_router_cancel_gestures()). What that posts goes now, not at the end of the frame: a lost event is what a stalled renderer produces, and a DISARM must not wait behind the render and the flip.

The STOP marker goes too, unless a request is already raised or the marked press is still to come. The marker says the router will latch a stop the control task already applied. A marked press the router has taken was cancelled with its gestures, and one among the lost never reaches it, so no request follows to consume the marker; one left standing would swallow the next stop that genuinely needs the backstop. A marked press queued after the item at cur, or the event at cur itself, is dispatched after the cancel and latches, so its marker stays (stop_mark_keeps()). A request the router latched before the loss will consume it as it should – including one still in the router's own latch, which this frame would hand over only later: it is handed over here first, the same way, so the marker is kept for it. The residual is a request raised by the backstop between the load and the store, which resolves to a stop applied twice, and that latches the same way one does.

Parameters
stops_nowthe stop count the commands flushed here carry
curthe s_touch_q number of the item that showed the loss, or the last published number for a loss at the end of a drain
cur_is_eventwhether that item is an event dispatched next