Skip to content

Commit

Permalink
Fix -Wextra warnings in components.
Browse files Browse the repository at this point in the history
  • Loading branch information
BsAtHome committed Feb 21, 2025
1 parent bd2c432 commit 5133dac
Show file tree
Hide file tree
Showing 100 changed files with 195 additions and 33 deletions.
1 change: 1 addition & 0 deletions src/hal/components/abs.comp
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ pin out bit sign "Sign of input, false for positive, true for negative" ;
pin out bit is_positive "TRUE if input is positive, FALSE if input is 0 or negative";
pin out bit is_negative "TRUE if input is negative, FALSE if input is 0 or positive";

option period no;
function _;
license "GPL";
author "John Kasunich";
Expand Down
1 change: 1 addition & 0 deletions src/hal/components/abs_s32.comp
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ pin out bit sign "Sign of input, false for positive, true for negative" ;
pin out bit is_positive "TRUE if input is positive, FALSE if input is 0 or negative";
pin out bit is_negative "TRUE if input is negative, FALSE if input is 0 or positive";

option period no;
function _ nofp;
license "GPL";
author "Sebastian Kuzminsky";
Expand Down
1 change: 1 addition & 0 deletions src/hal/components/abs_s64.comp
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ pin out bit sign "Sign of input, false for positive, true for negative" ;
pin out bit is_positive "true if input is positive, false if input is 0 or negative";
pin out bit is_negative "true if input is negative, false if input is 0 or positive";

option period no;
function _ nofp;
license "GPL";
author "ArcEye based on code from Sebastian Kuzminsky";
Expand Down
1 change: 1 addition & 0 deletions src/hal/components/and2.comp
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ Otherwise,
\\fBout=FALSE\\fR
.RE"""
;
option period no;
function _ nofp;
see_also """
\\fBlogic\\fR(9),
Expand Down
1 change: 1 addition & 0 deletions src/hal/components/bin2gray.comp
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ pin in unsigned in "binary code in";
pin out unsigned out "gray code out";
license "GPL";
author "Andy Pugh";
option period no;
function _ nofp;
;;
out = (in >> 1) ^ in;
2 changes: 2 additions & 0 deletions src/hal/components/biquad.comp
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,8 @@ typedef struct {

EXTRA_SETUP()
{
(void)prefix;
(void)extra_arg;
data.lastEnable = 0;

return(0);
Expand Down
1 change: 1 addition & 0 deletions src/hal/components/bitslice.comp
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ author "Andy Pugh";
license "GPL2+";
function _ nofp;
option personality yes;
option period no;
;;
int i;
for (i = 0; i < personality ; i++){
Expand Down
1 change: 1 addition & 0 deletions src/hal/components/bitwise.comp
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ pin out u32 out-xnor "The inverse of the bitwise XOR";
author "Andy Pugh";
license "GPL 2+";
function _ nofp;
option period no;
;;

out_and = (in0 & in1);
Expand Down
5 changes: 3 additions & 2 deletions src/hal/components/bldc.comp
Original file line number Diff line number Diff line change
Expand Up @@ -515,7 +515,7 @@ FUNCTION(_) {
phase_angle -= floor(phase_angle);

if (! (ph & old_ph)){ hall_error = 1;}
if (pattern != old_pattern){hall_error = 0;}
if (pattern != (unsigned)old_pattern){hall_error = 0;}

if (force_trap) break;

Expand Down Expand Up @@ -797,7 +797,7 @@ FUNCTION(_) {
return;

case 0x400: // Hall Output
for (i = 0; P[(output_pattern << 3) + i] != ph && i < 8 ; i++) {}
for (i = 0; P[(output_pattern << 3) + i] != ((unsigned)ph & 0xff) && i < 8 ; i++) {}
hall1_out = (i & 0x04);
hall2_out = (i & 0x02);
hall3_out = (i & 0x01);
Expand Down Expand Up @@ -849,6 +849,7 @@ FUNCTION(_) {
}

EXTRA_SETUP(){
(void)prefix;
int i;
char c;
for (i = 0; cfg[extra_arg][i] != 0 && i < NUM_TAG ; i++){
Expand Down
1 change: 1 addition & 0 deletions src/hal/components/blend.comp
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ pin out float out "Output value.";

param rw bit open "If true, select values outside the range 0.0 to 1.0 give values outside the range in2 to in1. If false, outputs are clamped to the the range in2 to in1";

option period no;
function _;
license "GPL";
author "Jeff Epler";
Expand Down
1 change: 1 addition & 0 deletions src/hal/components/carousel.comp
Original file line number Diff line number Diff line change
Expand Up @@ -547,6 +547,7 @@ FUNCTION(_){
}

EXTRA_SETUP(){
(void)prefix;
if (pockets[extra_arg] > 0) default_pockets = pockets[extra_arg];
if (encoding[extra_arg] == NULL) {
//it's already default_code
Expand Down
1 change: 1 addition & 0 deletions src/hal/components/charge_pump.comp
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ have a base period of 100,000ns that is 0.0001 seconds and the formula would be
1/(0.0001 x 2) = 5,000 Hz or 5 kHz. Two additional outputs are provided that run
a factor of 2 and 4 slower for hardware that requires a lower frequency.""";
license "GPL";
option period no;
author "Jeff Epler";
;;
FUNCTION(_) {
Expand Down
1 change: 1 addition & 0 deletions src/hal/components/clarke2.comp
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ pin in float a;
pin in float b "first two phases of three phase input";
pin out float x;
pin out float y "cartesian components of output";
option period no;
function _;
license "GPL";
author "John Kasunich";
Expand Down
1 change: 1 addition & 0 deletions src/hal/components/clarke3.comp
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ pin in float c "three phase input vector";
pin out float x;
pin out float y "cartesian components of output";
pin out float h "homopolar component of output";
option period no;
function _;
license "GPL";
author "John Kasunich";
Expand Down
1 change: 1 addition & 0 deletions src/hal/components/clarkeinv.comp
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ pin in float theta "rotation angle: 0.00 to 1.00 = 0 to 360 degrees";
pin out float a;
pin out float b;
pin out float c "three phase output vector";
option period no;
function _;
license "GPL";
author "John Kasunich";
Expand Down
1 change: 1 addition & 0 deletions src/hal/components/comp.comp
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ separated by distance \\fBhyst\\fR around the point where \\fBin1\\fR = \\fBin0\
Keep in mind that floating point calculations are never absolute
and it is wise to always set \\fBhyst\\fR if you intend to use equal """;

option period no;
function _ fp "Update the comparator";
license "GPL";
author "Jeff Epler";
Expand Down
1 change: 1 addition & 0 deletions src/hal/components/constant.comp
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
component constant "Use a parameter to set the value of a pin";
pin out float out;
param rw float value;
option period no;
function _;
license "GPL";
author "John Kasunich";
Expand Down
1 change: 1 addition & 0 deletions src/hal/components/conv.comp.in
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ pin in @IN@ in;
pin out @OUT@ out;
@CC@pin out bit out_of_range "TRUE when 'in' is not in the range of @OUT@";
@CC@param rw bit clamp """If TRUE, then clamp to the range of @OUT@. If FALSE, then allow the value to "wrap around".""";
option period no;
function _ @FP@ "Update 'out' based on 'in'";
license "GPL";
author "Jeff Epler";
Expand Down
1 change: 1 addition & 0 deletions src/hal/components/corexy_by_hal.comp
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@ switches triggered by the \\fB j0,j1 motor\\fR positions.
(man kins for more information)
""";

option period no;
license "GPL";
author "Dewey Garrett based on forum post from nbremond";
;;
Expand Down
3 changes: 2 additions & 1 deletion src/hal/components/dbounce.comp
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,8 @@ pin in bit in;
pin out bit out;
pin in u32 delay = 5;

variable int state;
variable unsigned state;
option period no;
function _ nofp;
license "GPL";
author "Dewey Garrett";
Expand Down
1 change: 1 addition & 0 deletions src/hal/components/deadzone.comp
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ param rw float threshold = 1.0 "The dead zone is \\fBcenter\\fR \\(+- (\\fBthres
pin in float in;
pin out float out;

option period no;
function _ "Update \\fBout\\fR based on \\fBin\\fR and the parameters.";

license "GPL";
Expand Down
1 change: 1 addition & 0 deletions src/hal/components/demux.comp
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ see_also "\\fBselect8\\fR(9)";
license "GPL 2+";
author "Andy Pugh";

option period no;
function _;

;;
Expand Down
1 change: 1 addition & 0 deletions src/hal/components/differential.comp
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ pin out float motor1-cmd "position command to motor1 (based on roll & pitch inpu
pin in float motor0-fb "position feedback from motor0";
pin in float motor1-fb "position feedback from motor1";

option period no;
function _;
license "GPL";
author "Sebastian Kuzminsky";
Expand Down
1 change: 1 addition & 0 deletions src/hal/components/div2.comp
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ This is simple mathematics. """;
license "GPL"; // indicates GPL v2 or later
author "Noel Rodes";
see_also "mult2(9), invert(9) ";
option period no;
function _;

;;
Expand Down
1 change: 1 addition & 0 deletions src/hal/components/eoffset_per_angle.comp
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,7 @@ variable int err_stop = 0;
option data the_data;
//---------------------------------------------------------------------

option period no;
function _;
license "GPL";
author "Dewey Garrett";
Expand Down
1 change: 1 addition & 0 deletions src/hal/components/estop_latch.comp
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,7 @@ pin in bit reset;
pin out bit ok_out = false;
pin out bit fault_out = true;
pin out bit watchdog;
option period no;
function _ nofp;
option data estop_data;
license "GPL";
Expand Down
1 change: 1 addition & 0 deletions src/hal/components/feedcomp.comp
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ pin in float vel "Current velocity";
param rw float feed "Feed rate reference value";
notes "Note that if enable is false, out = in.";

option period no;
function _;
license "GPL";
author "Eric H. Johnson";
Expand Down
2 changes: 2 additions & 0 deletions src/hal/components/filter_kalman.comp
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,7 @@ param rw float Rk = 1.17549e-38 "Estimation of the noise covariances
param rw float Qk = 1.17549e-38 "Estimation of the noise covariances (observation).";

option extra_setup yes;
option period no;

function _ "Update \\fBxk-out\\fR based on \\fBzk\\fR input.";

Expand Down Expand Up @@ -87,6 +88,7 @@ static void print_info(const int id, const D in_val, const D out_val) {
}

EXTRA_SETUP() {
(void)prefix;
cidx = extra_arg; // Let us hope 'extra_arg' will forever contain component index.
return 0;
}
Expand Down
1 change: 1 addition & 0 deletions src/hal/components/flipflop.comp
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ pin io bit out "output";
pin io bit out-not "inverted output";
option data flipflop_data;

option period no;
function _ nofp;
license "GPL";
author "John Kasunich";
Expand Down
1 change: 1 addition & 0 deletions src/hal/components/gantry.comp
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,7 @@ When a joint home switch trips, the commanded velocity will drop immediately fro
""";
license "GPL";
author "Charles Steinkuehler";
option period no;
variable float offset[7] = 0.0;
variable float prev_cmd = 0.0;
variable int fb_joint = 0;
Expand Down
1 change: 1 addition & 0 deletions src/hal/components/gearchange.comp
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ Since it is assumed that gear 2 is "high gear", \\fBscale2\\fR must be
greater than 1, and will be reset to 1 if set lower.""";
param rw bit reverse = 0 "Set to 1 to reverse the spindle in second gear.";

option period no;
function _;
license "GPL";
author "Stephen Wille Padnos";
Expand Down
1 change: 1 addition & 0 deletions src/hal/components/gray2bin.comp
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ pin out unsigned out "binary code out";
license "GPL";
author "Andy Pugh";
function _ nofp;
option period no;
;;
unsigned int mask;
out = in;
Expand Down
9 changes: 5 additions & 4 deletions src/hal/components/histobins.comp
Original file line number Diff line number Diff line change
Expand Up @@ -66,11 +66,12 @@ pin out float mean;
// user may interrogate availablebins to determine this compiled-in limit
pin out s32 availablebins = 200; //MAXBINNUMBER

option period no;
function _ fp;

variable int bin[200]; // MAXBINNUMBER
variable int first = 1;
variable int last_nbins = 0;
variable unsigned last_nbins = 0;

variable hal_float_t maxvalue;

Expand All @@ -86,10 +87,10 @@ author "Dewey Garrett";
;;

hal_float_t invalue;
int i;
unsigned i;
int idx;
check = index;
if ( (nbins > availablebins)
if ( (nbins > (unsigned)availablebins)
|| (nbins < 1)
) {
input_error = 1;
Expand Down Expand Up @@ -143,7 +144,7 @@ check = index; // user should verify check==index for reading values
// -1 value indicates illegal index
if (index < 0) {
binvalue = -1;
} else if (index < nbins) {
} else if (index < (int)nbins) {
binvalue = bin[index];
} else {
binvalue = -1;
Expand Down
Loading

0 comments on commit 5133dac

Please sign in to comment.