diff --git a/sw/airborne/subsystems/datalink/telemetry.c b/sw/airborne/subsystems/datalink/telemetry.c index 4dca1d0164..6e4292c823 100644 --- a/sw/airborne/subsystems/datalink/telemetry.c +++ b/sw/airborne/subsystems/datalink/telemetry.c @@ -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++) { diff --git a/sw/tools/generators/gen_periodic.ml b/sw/tools/generators/gen_periodic.ml index 205c02292b..fef8b52090 100644 --- a/sw/tools/generators/gen_periodic.ml +++ b/sw/tools/generators/gen_periodic.ml @@ -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"