22void GenericCurrentSense::calibrateOffsets(){
23 const int calibration_rounds = 1000;
30 for (
int i = 0; i < calibration_rounds; i++) {
32 offset_ia += current.
a;
33 offset_ib += current.
b;
34 offset_ic += current.
c;
38 offset_ia = offset_ia / calibration_rounds;
39 offset_ib = offset_ib / calibration_rounds;
40 offset_ic = offset_ic / calibration_rounds;
46 current.
a = (current.
a - offset_ia);
47 current.
b = (current.
b - offset_ib);
48 current.
c = (current.
c - offset_ic);
@ voltage
Torque control using voltage.
bool skip_align
variable signaling that the phase current direction should be verified during initFOC()
void * params
pointer to hardware specific parameters of current sensing
GenericCurrentSense(PhaseCurrent_s(*readCallback)()=nullptr, void(*initCallback)()=nullptr)
PhaseCurrent_s(* readCallback)()
function pointer to sensor reading
void(* initCallback)()
function pointer to sensor initialisation
PhaseCurrent_s getPhaseCurrents() override
int driverAlign(float align_voltage, bool modulation_centered) override
#define SIMPLEFOC_CURRENT_SENSE_INIT_FAILED
void _delay(unsigned long ms)