mirror of
https://github.com/paparazzi/paparazzi.git
synced 2026-06-07 09:36:19 +08:00
[generators] gen_periodic: no need to hardcode number of slots
use {{ NULL }} instead of {{NULL, NULL, NULL, NULL}} to initialize all slots to NULL
- and fix return of register_periodic_telemetry
This commit is contained in:
@@ -46,8 +46,8 @@ struct periodic_telemetry pprz_telemetry = { TELEMETRY_NB_MSG, telemetry_msgs, t
|
||||
*/
|
||||
int8_t register_periodic_telemetry(struct periodic_telemetry *_pt, const char *_msg, telemetry_cb _cb)
|
||||
{
|
||||
// return FALSE if NULL is passed as periodic_telemetry
|
||||
if (_pt == NULL) { return FALSE; }
|
||||
// return if NULL is passed as periodic_telemetry
|
||||
if (_pt == NULL) { return -1; }
|
||||
// look for message name
|
||||
uint8_t i, j;
|
||||
for (i = 0; i < _pt->nb; i++) {
|
||||
|
||||
@@ -163,12 +163,8 @@ let print_message_table = fun out_h xml ->
|
||||
fprintf out_h "};\n\n";
|
||||
fprintf out_h "#define TELEMETRY_CBS_NULL { \\\n";
|
||||
for i = 1 to (Hashtbl.length messages) do
|
||||
fprintf out_h " {{";
|
||||
(* TODO: fix hardcoded value of 4 *)
|
||||
for j = 1 to 4 do
|
||||
fprintf out_h "NULL, "
|
||||
done;
|
||||
fprintf out_h "}}, \\\n"
|
||||
(* use one 0 to init all slots (number TELEMETRY_NB_CBS) to NULL *)
|
||||
fprintf out_h " {{ NULL }}, \\\n";
|
||||
done;
|
||||
fprintf out_h "}\n\n"
|
||||
|
||||
|
||||
Reference in New Issue
Block a user