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

The SERVO screen's automatic test: START TEST, on TEST's AUTOMATIC TEST card, runs it (servo_test.h). This file hands the run the steps, the servo's profile and ends, the meter and the supply's caps; does what the run asks – the servo's position, SUPPLY's set points and output – through the same paths a finger uses; puts SUPPLY's set points back after it; and draws its box on LIVE's card and its button and lines on the AUTOMATIC TEST card. It also serves the card writer the outbox of both runs, the automatic test's first, then the limit run's. More...

#include <math.h>
#include <stdio.h>
#include <string.h>
#include "log_name.h"
#include "rcbench_version.h"
#include "sensors_rows.h"
#include "servo_limrun.h"
#include "settings.h"
#include "settings_sensors.h"
#include "supply_screen.h"
#include "ui_text.h"
#include "ui_theme.h"
#include "ui_widgets.h"
#include "servo_screen_int.h"

Functions

static void test_apply (const servo_test_do_t *d)
void test_meter_follow (servo_source_id_t id, uint32_t changes)
static uint8_t test_steps (float *v)
float test_top_v (void)
static void test_ends (uint16_t *end_lo, uint16_t *end_hi)
static bool test_on_ina_now (void)
static servo_test_ina_t test_ina_why (void)
static void test_cfg (servo_test_cfg_t *c)
void test_restore_service (void)
void test_end_now (servo_test_abort_t why)
int test_blocked (void)
void test_begin (void)
void ask_hv_test (void)
bool servo_screen_testing (void)
servo_test_out_t servo_screen_test_peek (const char **text)
void servo_screen_test_pop (void)
void servo_screen_test_files (int number, bool report)
void servo_screen_test_logger_busy (bool busy)
static void test_file_name (char *b, size_t n)
void draw_test_box (gfx_canvas_t *c)
 The run on LIVE's card: the step and phase while it runs, with STOP TEST; PASS, FAIL or ABORTED and why, and the files, after it, with CLOSE.
void draw_test_start (gfx_canvas_t *c)
 START TEST: green, fading to the danger red across its hold, as ARM; STOP TEST in red while a run is under way.
static void test_plan (char *plan, size_t size)
 The steps a run would take, as the card says them: "4.8 6.0V BROWN-OUT", the unit joined to the last step, or NO STEP CHOSEN.
void draw_test_stall (gfx_canvas_t *c, int x, int y)
 A STALL AT the run's readings cannot pass, in the warning colour: the current limit first, then the meter's range. Nothing when it can.
void draw_test_lines (gfx_canvas_t *c)
 The AUTOMATIC TEST card's lines: over START TEST the steps and the length of each, and under it why a run cannot start or what it does now, the last result and its file, and a STALL AT no reading can pass.
uint32_t test_signature (void)
void test_tick (void)

Detailed Description

The SERVO screen's automatic test: START TEST, on TEST's AUTOMATIC TEST card, runs it (servo_test.h). This file hands the run the steps, the servo's profile and ends, the meter and the supply's caps; does what the run asks – the servo's position, SUPPLY's set points and output – through the same paths a finger uses; puts SUPPLY's set points back after it; and draws its box on LIVE's card and its button and lines on the AUTOMATIC TEST card. It also serves the card writer the outbox of both runs, the automatic test's first, then the limit run's.

The screen is servo_screen.c; the state and the layout both share are servo_screen_int.h.

SPDX-License-Identifier: MIT

Function Documentation

◆ draw_test_box()

void draw_test_box ( gfx_canvas_t * c)

The run on LIVE's card: the step and phase while it runs, with STOP TEST; PASS, FAIL or ABORTED and why, and the files, after it, with CLOSE.

Parameters
cthe canvas

◆ draw_test_lines()

void draw_test_lines ( gfx_canvas_t * c)

The AUTOMATIC TEST card's lines: over START TEST the steps and the length of each, and under it why a run cannot start or what it does now, the last result and its file, and a STALL AT no reading can pass.

Parameters
cthe canvas

◆ draw_test_stall()

void draw_test_stall ( gfx_canvas_t * c,
int x,
int y )

A STALL AT the run's readings cannot pass, in the warning colour: the current limit first, then the meter's range. Nothing when it can.

Parameters
cthe canvas
xthe line's left edge, px
yits top, px

◆ draw_test_start()

void draw_test_start ( gfx_canvas_t * c)

START TEST: green, fading to the danger red across its hold, as ARM; STOP TEST in red while a run is under way.

Parameters
cthe canvas

◆ servo_screen_test_files()

void servo_screen_test_files ( int number,
bool report )

The number of the files the run's items went to – ATESTnnn.CSV and, with REPORT, ATESTnnn.TXT, or a limit run's LIMITnnn.TXT – or -1 when the card took none; and whether the card took the .TXT whole. Ignored for a run started with USER LOGS off, which sent the logger nothing.

◆ servo_screen_test_logger_busy()

void servo_screen_test_logger_busy ( bool busy)

Whether the logger still holds an OPEN or an END the outbox gave it, or an OPEN waits for the queue. While it does no automatic test and no limit run starts (LAST REPORT STILL WRITING), so the number and report state servo_screen_test_files() passes go to the run that sent them. Every frame, after servo_screen_test_files().

◆ servo_screen_test_peek()

servo_test_out_t servo_screen_test_peek ( const char ** text)

The run's next item for the card, without taking it (servo_test_peek()), and taking it once it is on its way. The application drains these every frame, whichever screen is up. A run started with USER LOGS off on SETUP > SD CARD has no item: its items are dropped here.

◆ servo_screen_testing()

bool servo_screen_testing ( void )

Whether a run is under way, for the application and tests.

◆ test_plan()

void test_plan ( char * plan,
size_t size )
static

The steps a run would take, as the card says them: "4.8 6.0V BROWN-OUT", the unit joined to the last step, or NO STEP CHOSEN.

Parameters
plantakes the line
sizebytes at plan