Skip to content

Commit 4f42deb

Browse files
authored
Update MXLEMMINGObserverSensor.cpp
Fix for overflow
1 parent 031a4dd commit 4f42deb

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

src/encoders/MXLEMMING_observer/MXLEMMINGObserverSensor.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ void MXLEMMINGObserverSensor::update() {
4646
// to David Molony as the original author must be noted.
4747

4848
// Flux linkage observer
49-
float now = _micros();
49+
int32_t now = _micros();
5050
float Ts = ( now - angle_prev_ts) * 1e-6f;
5151
flux_alpha = _constrain( flux_alpha + (_motor.Ualpha - _motor.phase_resistance * ABcurrent.alpha) * Ts -
5252
_motor.phase_inductance * (ABcurrent.alpha - i_alpha_prev),-flux_linkage, flux_linkage);
@@ -103,4 +103,4 @@ void MXLEMMINGObserverSensor::init(){
103103
*/
104104
float MXLEMMINGObserverSensor::getSensorAngle(){
105105
return 0;
106-
}
106+
}

0 commit comments

Comments
 (0)