mirror of
https://github.com/paparazzi/paparazzi.git
synced 2026-06-07 09:36:19 +08:00
[telemetry] add error report
This commit is contained in:
+6
-1
@@ -1898,7 +1898,12 @@
|
||||
<!--223 is free -->
|
||||
<!--224 is free -->
|
||||
<!--225 is free -->
|
||||
<!--226 is free -->
|
||||
|
||||
<message name="PERIODIC_TELEMETRY_ERR" id="226">
|
||||
<field name="process" type="uint8"/>
|
||||
<field name="mode" type="uint8"/>
|
||||
<field name="id" type="uint8"/>
|
||||
</message>
|
||||
|
||||
<message name="TIME" id="227">
|
||||
<field name="t" type="uint32"/>
|
||||
|
||||
@@ -52,3 +52,20 @@ bool_t register_periodic_telemetry(struct pprz_telemetry * _pt, char * _msg, tel
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
#if USE_PERIODIC_TELEMETRY_REPORT
|
||||
|
||||
#include "subsystems/datalink/downlink.h"
|
||||
|
||||
/** Send an error report when trying to send message that as not been register
|
||||
* @param _process telemetry process id
|
||||
* @param _mode telemetry mode
|
||||
* @param _id id of the message in telemetry system (see var/<AC>/generated/periodic_telemetry.h)
|
||||
*/
|
||||
void periodic_telemetry_err_report(uint8_t _process, uint8_t _mode, uint8_t _id) {
|
||||
uint8_t process = _process;
|
||||
uint8_t mode = _mode;
|
||||
uint8_t id = _id;
|
||||
DOWNLINK_SEND_PERIODIC_TELEMETRY_ERR(DefaultChannel, DefaultDevice, &process, &mode, &id);
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
@@ -58,8 +58,16 @@ struct pprz_telemetry {
|
||||
* @param _cb callback function, called according to telemetry mode and specified period
|
||||
* @return TRUE if message registered with success, FALSE otherwise
|
||||
*/
|
||||
bool_t register_periodic_telemetry(struct pprz_telemetry * _pt, char * _msg, telemetry_cb _cb);
|
||||
extern bool_t register_periodic_telemetry(struct pprz_telemetry * _pt, char * _msg, telemetry_cb _cb);
|
||||
|
||||
#if USE_PERIODIC_TELEMETRY_REPORT
|
||||
/** Send an error report when trying to send message that as not been register
|
||||
* @param _process telemetry process id
|
||||
* @param _mode telemetry mode
|
||||
* @param _id id of the message in telemetry system (see var/<AC>/generated/periodic_telemetry.h)
|
||||
*/
|
||||
extern void periodic_telemetry_err_report(uint8_t _process, uint8_t _mode, uint8_t _id);
|
||||
#endif
|
||||
|
||||
#endif /* TELEMETRY_COMMON_H */
|
||||
|
||||
|
||||
@@ -87,7 +87,7 @@ let output_modes = fun out_h process_name modes freq modules ->
|
||||
lprintf out_h "telemetry_%s.msgs[TELEMETRY_%s_MSG_%s_ID].cb();\n" process_name (String.uppercase process_name) message_name;
|
||||
left ();
|
||||
fprintf out_h "#if USE_PERIODIC_TELEMETRY_REPORT\n";
|
||||
lprintf out_h "else peridodic_telemetry_err_report(TELEMETRY_%s_MSG_%s_ID);\n" (String.uppercase process_name) message_name;
|
||||
lprintf out_h "else periodic_telemetry_err_report(TELEMETRY_PROCESS_%s, telemetry_mode_%s, TELEMETRY_%s_MSG_%s_ID);\n" process_name process_name (String.uppercase process_name) message_name;
|
||||
fprintf out_h "#endif\n";
|
||||
left ();
|
||||
lprintf out_h "}\n"
|
||||
@@ -160,6 +160,9 @@ let _ =
|
||||
let messages = Hashtbl.create 5 in
|
||||
|
||||
fprintf out_h "\n/* Periodic telemetry: %s process */\n" process_name;
|
||||
let p_id = ref 0 in
|
||||
Xml2h.define (sprintf "TELEMETRY_PROCESS_%s" process_name) (string_of_int !p_id);
|
||||
incr p_id;
|
||||
|
||||
let i = ref 0 in
|
||||
(** For each mode of this process *)
|
||||
|
||||
Reference in New Issue
Block a user