Compile error Arduino Mega 2560 with Encoder example


I get a compile error when I compile the Encoder example with an Arduino Mega 2560 board Arduino-FOC/examples/utils/sensor_test/encoder/encoder_example/ I’m on version Simple Foc version 2.2.2.
It says:

/...../Arduino/libraries/Simple_FOC/src/drivers/hardware_specific/atmega2560_mcu.cpp: In function 'void* _configure6PWM(long int, float, int, int, int, int, int, int)':
/...../Arduino/libraries/Simple_FOC/src/drivers/hardware_specific/atmega2560_mcu.cpp:149:22: error: expected primary-expression before ',' token
     .pins = { pinA_h,, pinA_l, pinB_h, pinB_l, pinC_h, pinC_l },
/..../Arduino/libraries/Simple_FOC/src/drivers/hardware_specific/atmega2560_mcu.cpp:151:6: error: request for member 'dead_zone' in 'pwm_frequency', which is of non-class type 'long int'
     .dead_zone = dead_zone
/..../Arduino/libraries/Simple_FOC/src/drivers/hardware_specific/atmega2560_mcu.cpp:152:3: error: could not convert '{{pinA_h, <expression error>, pinA_l, pinB_h, pinB_l, pinC_h, pinC_l}, <expression error>}' from '<brace-enclosed initializer list>' to 'GenericDriverParams'

Compilation error: exit status 1

What is wrong? Compiled with an Arduino Uno gives no problems.


this is our fault unfortunately.
It is a bug that we’ve introduced recently and we’ll fix it asap.

The fix is to add comma behind the

.dead_zone = dead_zone

And remove one the double commas in the line above.
Line 149 and 151 in the file


If you’re using windows it will be in /Documents/Arudino/libraries/Simple_FOC/sec/drivers/…

Thx, that did the tric. In row150 a comma is also missing:
.pwm_frequency = pwm_frequency,