|
rcbench
Servo and ESC test bench: panel, IOmcu and shared C
|
The settings the control task follows, handed across from app_main. More...
#include <stdatomic.h>#include <stdlib.h>#include <sys/time.h>#include <time.h>#include "card_tree.h"#include "display.h"#include "endpoints_link.h"#include "esp_log.h"#include "esp_private/esp_clk.h"#include "freertos/FreeRTOS.h"#include "panel.h"#include "panel_main.h"#include "sdkconfig.h"#include "settings.h"#include "settings_sensors.h"#include "soc/rtc.h"#include "tone_link.h"#include "wall_clock.h"Functions | |
| void | publish_poles (void) |
| Each value once, at the start-up, whatever the observer was told. | |
| void | publish_endpoints (void) |
| Publishes the throttle's pulse endpoints (Idle pulse, Full pulse) to the control task. | |
| void | publish_pdmini (void) |
| The PD mini's wiring, as the settings screen left it; see s_pdmini_wiring. | |
| void | publish_tone (void) |
| Publishes the phase tap's set-up to the control task. | |
| tone_setup_t | tone_wanted (void) |
| Returns the phase tap's set-up as SETUP INTERFACES left it, copied under the spinlock. | |
| void | publish_log_auto (void) |
| Publishes the AUTO LOGS setting to the control task. | |
| void | publish_log_folder (setting_text_id_t id) |
| The settings model's observer for texts: hands a log folder to the log writer. | |
| void | publish_hitec_rx (void) |
| Hitec D receive to the control task (s_hitec_rx_want), at the load and at every edit, so the first write after a link-up is the kept mode. | |
| static void | apply_rotation (void) |
| Screen rotation to the display. The next flip takes it: the picture turns in the flush, and touch follows the frame on the glass (display.h). At the load, before display_init(), the display keeps it for its start. | |
| void | publish_time_zone (void) |
| The time zone setting to the C library: setenv("TZ") and tzset(), so FatFs's file stamps and localtime() read it from the next call. At the start-up before the card mounts. | |
| static void | log_slow_clock (const char *tag) |
| The slow clock the RTC timer counts, on the console: the 32.768kHz crystal Y3, or the internal RC oscillator ESP-IDF falls back to when the crystal does not start (esp_system's clk.c, select_rtc_slow_clk()), and its frequency as calibrated at start-up. A fallback is a warning. | |
| void | log_clock_at_start (void) |
| Two console lines at the start-up on the clock: the slow clock the RTC (real-time clock) timer counts, crystal or RC fallback, and the time kept across a software restart, or "not set" after a power-on. | |
| void | settings_changed (setting_id_t id) |
| The settings model's observer for values: hands the changed one to the code that follows it. | |
Variables | |
| endpoints_debt_t | s_endpoints |
| The throttle's pulse endpoints, Idle pulse and Full pulse, on their way to the IOmcu. | |
| static portMUX_TYPE | s_tone_mux = portMUX_INITIALIZER_UNLOCKED |
| The phase tap's set-up, as SETUP INTERFACES left it, for the control task's TONE writes (tone_link.h). Seven values do not fit an atomic word, so the copy is taken under a spinlock both ways, as the current monitors' is. Written by the settings observer on app_main, read once a poll by the control task. | |
| static tone_setup_t | s_tone_want |
| atomic_bool | s_log_auto = true |
| AUTO LOGS, for the control task's log_follow_runs() (main.c). | |
The settings the control task follows, handed across from app_main.
Each value the settings screen writes is published into an atomic or under a spinlock, beside the debt its write to the IOmcu is, and the control task reads it from there. settings_changed() is the settings model's observer; bring_up() (panel_boot.c) publishes every value once. Screen rotation goes to the display (apply_rotation()), whose flush turns picture and touch together from the next frame. The time zone goes to the C library (publish_time_zone()), which FatFs's stamps and every localtime() read from the next call. log_clock_at_start() says at each start which slow clock the RTC (real-time clock) timer counts and what time it kept.
SPDX-License-Identifier: MIT
|
static |
The slow clock the RTC timer counts, on the console: the 32.768kHz crystal Y3, or the internal RC oscillator ESP-IDF falls back to when the crystal does not start (esp_system's clk.c, select_rtc_slow_clk()), and its frequency as calibrated at start-up. A fallback is a warning.
| tag | The log tag. |
| void publish_hitec_rx | ( | void | ) |
Hitec D receive to the control task (s_hitec_rx_want), at the load and at every edit, so the first write after a link-up is the kept mode.
Publishes the Hitec receive set-up to the control task.
Hitec D receive to the control task (s_hitec_rx_want), at the load and at every edit, so the first write after a link-up is the kept mode.
| void publish_log_folder | ( | setting_text_id_t | id | ) |
The settings model's observer for texts: hands a log folder to the log writer.
| id | The text setting that changed. |
| void publish_pdmini | ( | void | ) |
The PD mini's wiring, as the settings screen left it; see s_pdmini_wiring.
Publishes the PD mini's wiring to the control task.
The PD mini's wiring, as the settings screen left it; see s_pdmini_wiring.
| void settings_changed | ( | setting_id_t | id | ) |
The settings model's observer for values: hands the changed one to the code that follows it.
| id | The setting that changed. |
| tone_setup_t tone_wanted | ( | void | ) |
Returns the phase tap's set-up as SETUP INTERFACES left it, copied under the spinlock.
| endpoints_debt_t s_endpoints |
The throttle's pulse endpoints, Idle pulse and Full pulse, on their way to the IOmcu.
Published the way the pole count is, and for the same reason: the settings screen writes the model from app_main and the control task owns the link, so the values travel in atomics beside the debt rather than being read from settings.c on the control task (endpoints_link.h).
The time of the last edit travels too. A key held on + or - steps the value every few hundred milliseconds, and each write of CHAN_CFG is a flash write at the far end; the debt is paid once the value has rested for ENDPOINTS_SETTLE_MS.
Its hold is raised at a link-up edge, control task only: the far end is held disarmed until its throttle endpoints have been brought to the settings. A bench armed with no link – the simulator, or a cable pulled mid-run – would otherwise arm an IOmcu that has just answered on whatever range it kept in flash, and keep that range for the whole run.
|
static |
the phase tap's set-up, guarded by s_tone_mux