Format
This commit is contained in:
parent
ac654025e4
commit
95574ccb32
@ -23,8 +23,10 @@ void LinearHallSensor::init(BLDCMotor motor)
|
|||||||
uint32_t senseA = analogRead(_analogPin1);
|
uint32_t senseA = analogRead(_analogPin1);
|
||||||
uint32_t senseB = analogRead(_analogPin2);
|
uint32_t senseB = analogRead(_analogPin2);
|
||||||
|
|
||||||
_minCh1 = senseA, _maxCh1 = senseA;
|
_minCh1 = senseA;
|
||||||
_minCh2 = senseB, _maxCh2 = senseB;
|
_maxCh1 = senseA;
|
||||||
|
_minCh2 = senseB;
|
||||||
|
_maxCh2 = senseB;
|
||||||
|
|
||||||
// Swipe motor
|
// Swipe motor
|
||||||
for (float i = _minPositionEndValue; i <= _maxPositionEndValue; i = i + 0.005)
|
for (float i = _minPositionEndValue; i <= _maxPositionEndValue; i = i + 0.005)
|
||||||
@ -90,7 +92,7 @@ void LinearHallSensor::init(BLDCMotor motor)
|
|||||||
Serial.println("Max sensor: " + String(_maxSensor));
|
Serial.println("Max sensor: " + String(_maxSensor));
|
||||||
|
|
||||||
// Recovering previous controller type and go in the middle
|
// Recovering previous controller type and go in the middle
|
||||||
for (float i = _maxPositionEndValue; i >= _minPositionEndValue/2.0; i = i - 0.01)
|
for (float i = _maxPositionEndValue; i >= _minPositionEndValue / 2.0; i = i - 0.01)
|
||||||
{
|
{
|
||||||
motor.move(i);
|
motor.move(i);
|
||||||
delay(1);
|
delay(1);
|
||||||
@ -124,5 +126,5 @@ float LinearHallSensor::readSensorCallback()
|
|||||||
_estimatePosition += dist_angle(_currentPosition, _prevPosition);
|
_estimatePosition += dist_angle(_currentPosition, _prevPosition);
|
||||||
|
|
||||||
_prevPosition = _currentPosition;
|
_prevPosition = _currentPosition;
|
||||||
return (_estimatePosition + _offset)/4.0;
|
return (_estimatePosition + _offset) / 4.0;
|
||||||
}
|
}
|
||||||
|
@ -76,7 +76,6 @@ void setup()
|
|||||||
|
|
||||||
motor.useMonitoring(Serial);
|
motor.useMonitoring(Serial);
|
||||||
|
|
||||||
|
|
||||||
// Init sensor
|
// Init sensor
|
||||||
motor.init();
|
motor.init();
|
||||||
Serial.println("calibrating sensor in open loop...");
|
Serial.println("calibrating sensor in open loop...");
|
||||||
|
Loading…
Reference in New Issue
Block a user