rcbench
Servo and ESC test bench: panel, IOmcu and shared C
Toggle main menu visibility
Loading...
Searching...
No Matches
busfault_screen.h
1
/*
2
* The screen a bad CAN (Controller Area Network) bus gets at start-up.
3
*
4
* The panel runs the echo self-test once, before the bench is usable, and
5
* shows this instead of the menu when the test does not pass. It exists
6
* because the fault it reports is not visible from any other screen: a bus
7
* that does not carry frames looks exactly like an IOmcu that is not
8
* there, and both look like a bench that simply shows no numbers.
9
*
10
* What it puts on the panel is the verdict, the counts behind it, and the
11
* things to check in the order that costs least to check. An operator with
12
* no console and no meter can act on it.
13
*
14
* Leaving it takes a two-second hold, the ARM gesture: this is the one screen
15
* that says the bench cannot be trusted, and an acknowledgement given by
16
* brushing the panel is not one.
17
*
18
* SPDX-License-Identifier: MIT
19
*/
20
21
#ifndef RCBENCH_BUSFAULT_SCREEN_H
22
#define RCBENCH_BUSFAULT_SCREEN_H
23
24
#include <stdbool.h>
25
#include <stdint.h>
26
27
#include "can_selftest.h"
28
#include "
ui_screen.h
"
29
30
#ifdef __cplusplus
31
extern
"C"
{
32
#endif
33
35
typedef
enum
{
37
BUSFAULT_SELFTEST = 0,
44
BUSFAULT_LINK_LOST,
45
} busfault_kind_t;
46
54
typedef
enum
{
55
BUSFAULT_BUS_UNKNOWN = 0,
56
BUSFAULT_BUS_RUNNING,
57
BUSFAULT_BUS_RECOVERING,
58
BUSFAULT_BUS_STOPPED,
59
BUSFAULT_BUS_OFF,
60
} busfault_bus_t;
61
69
typedef
struct
{
70
busfault_kind_t kind;
71
can_selftest_verdict_t verdict;
72
73
uint32_t sent;
74
uint32_t echoed;
75
uint32_t corrupt;
76
uint32_t lost;
77
78
uint32_t
tx_errors
;
79
uint32_t rx_errors;
80
uint32_t bus_errors;
81
bool
bus_off;
82
83
/* --- BUSFAULT_LINK_LOST only ------------------------------------- */
84
busfault_bus_t
bus
;
85
uint32_t
down_s
;
86
uint32_t
recoveries
;
87
uint32_t
polls
;
88
uint32_t
timeouts
;
89
90
bool
have_remote
;
91
bool
remote_up
;
92
uint8_t remote_tx_errors;
93
uint8_t remote_rx_errors;
94
uint8_t remote_flags;
95
uint16_t remote_overflows;
96
}
busfault_report_t
;
97
99
void
busfault_screen_set
(
const
busfault_report_t
*r);
100
102
const
busfault_report_t
*
busfault_screen_report
(
void
);
103
110
bool
busfault_screen_take_ack
(
void
);
111
112
void
busfault_screen_invalidate(
void
);
113
118
const
char
*
busfault_verdict_text
(can_selftest_verdict_t v);
119
120
const
ui_screen_t
*busfault_screen(
void
);
121
122
#ifdef __cplusplus
123
}
124
#endif
125
126
#endif
/* RCBENCH_BUSFAULT_SCREEN_H */
busfault_screen_set
void busfault_screen_set(const busfault_report_t *r)
Definition
busfault_screen.c:142
busfault_screen_take_ack
bool busfault_screen_take_ack(void)
Definition
busfault_screen.c:162
busfault_screen_report
const busfault_report_t * busfault_screen_report(void)
Definition
busfault_screen.c:157
busfault_verdict_text
const char * busfault_verdict_text(can_selftest_verdict_t v)
Definition
busfault_screen.c:296
busfault_report_t
Definition
busfault_screen.h:69
busfault_report_t::down_s
uint32_t down_s
Definition
busfault_screen.h:85
busfault_report_t::polls
uint32_t polls
Definition
busfault_screen.h:87
busfault_report_t::recoveries
uint32_t recoveries
Definition
busfault_screen.h:86
busfault_report_t::have_remote
bool have_remote
Definition
busfault_screen.h:90
busfault_report_t::bus
busfault_bus_t bus
Definition
busfault_screen.h:84
busfault_report_t::remote_up
bool remote_up
Definition
busfault_screen.h:91
busfault_report_t::tx_errors
uint32_t tx_errors
Definition
busfault_screen.h:78
busfault_report_t::timeouts
uint32_t timeouts
Definition
busfault_screen.h:88
ui_screen_t
Definition
ui_screen.h:68
ui_screen.h
Screen router.
shared
ui
include
busfault_screen.h
Generated by
1.18.0