Skip to content

Commit

Permalink
[generators] gen_periodic: avoid unused arg warning
Browse files Browse the repository at this point in the history
don't create var j if there are no messages in a mode
  • Loading branch information
flixr committed Jan 30, 2016
1 parent 9078b5a commit 7b1ddd6
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions sw/tools/generators/gen_periodic.ml
Expand Up @@ -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 ->
Expand All @@ -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 *)
Expand Down

0 comments on commit 7b1ddd6

Please sign in to comment.