From 95574ccb32fa1527c1d8be45d1b3de834b592e53 Mon Sep 17 00:00:00 2001 From: Lucien Renaud Date: Wed, 25 May 2022 18:58:36 +0200 Subject: [PATCH] Format --- src/linearHallSensor.cpp | 10 ++++++---- src/main.cpp | 1 - 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/src/linearHallSensor.cpp b/src/linearHallSensor.cpp index 637e6ea..81135fc 100644 --- a/src/linearHallSensor.cpp +++ b/src/linearHallSensor.cpp @@ -23,8 +23,10 @@ void LinearHallSensor::init(BLDCMotor motor) uint32_t senseA = analogRead(_analogPin1); uint32_t senseB = analogRead(_analogPin2); - _minCh1 = senseA, _maxCh1 = senseA; - _minCh2 = senseB, _maxCh2 = senseB; + _minCh1 = senseA; + _maxCh1 = senseA; + _minCh2 = senseB; + _maxCh2 = senseB; // Swipe motor 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)); // 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); delay(1); @@ -124,5 +126,5 @@ float LinearHallSensor::readSensorCallback() _estimatePosition += dist_angle(_currentPosition, _prevPosition); _prevPosition = _currentPosition; - return (_estimatePosition + _offset)/4.0; + return (_estimatePosition + _offset) / 4.0; } diff --git a/src/main.cpp b/src/main.cpp index beddc85..293d561 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -76,7 +76,6 @@ void setup() motor.useMonitoring(Serial); - // Init sensor motor.init(); Serial.println("calibrating sensor in open loop...");