mirror of
https://github.com/paparazzi/paparazzi.git
synced 2026-05-26 08:22:43 +08:00
[generators] gen_periodic: avoid unused arg warning
don't create var j if there are no messages in a mode
This commit is contained in:
@@ -41,8 +41,6 @@ let output_modes = fun out_h process_name telem_type modes freq modules ->
|
||||
let min_period = 1./.float freq in
|
||||
let max_period = 65536. /. float freq in
|
||||
|
||||
lprintf out_h "uint8_t j;\n";
|
||||
|
||||
(** For each mode in this process *)
|
||||
List.iter
|
||||
(fun mode ->
|
||||
@@ -68,6 +66,10 @@ let output_modes = fun out_h process_name telem_type modes freq modules ->
|
||||
lprintf out_h "static %s %s = 0; %s++; if (%s>=%d) %s=0;\n" _type v v v m v;
|
||||
) modulos;
|
||||
|
||||
(* create var to loop trough callbacks if needed *)
|
||||
if (List.length messages > 0) then
|
||||
lprintf out_h "uint8_t j;\n";
|
||||
|
||||
(** For each message in this mode *)
|
||||
let messages = List.sort (fun (_,p) (_,p') -> compare p p') messages in
|
||||
let i = ref 0 in (** Basic balancing:1 message every 10Hz *)
|
||||
|
||||
Reference in New Issue
Block a user