diff --git a/src/linearHallSensor.cpp b/src/linearHallSensor.cpp index fff700d..c574239 100644 --- a/src/linearHallSensor.cpp +++ b/src/linearHallSensor.cpp @@ -93,7 +93,7 @@ void LinearHallSensor::init(BLDCMotor motor) _maxCh1 = _minCh1; _maxCh2 = _minCh2; - Serial.println("\tFinding end stops"); + Serial.println("\t- Finding end stops"); while (!endFound) { senseA[ptr] = analogRead(_analogPin1); @@ -109,13 +109,6 @@ void LinearHallSensor::init(BLDCMotor motor) else if (senseB[ptr] < _minCh2) _minCh2 = senseB[ptr]; - // Serial.printf("senseA: "); - // print_arr(senseA, N); - // Serial.printf(" std_var: %lu\n", std_var(senseA, N)); - // Serial.printf("senseB: "); - // print_arr(senseB, N); - // Serial.printf(" std_var: %lu\n", std_var(senseB, N)); - if (std_var(senseA, N) < epsilon && std_var(senseB, N) < epsilon) endFound = true; @@ -131,7 +124,7 @@ void LinearHallSensor::init(BLDCMotor motor) currentPosition = _maxPositionEndValue - M_PI / 8; delay(100); motor.move(currentPosition); - Serial.println("Found first end stop : Max position = " + String(_maxPositionEndValue)); + Serial.println("\t- Found first end stop : Max position = " + String(_maxPositionEndValue)); delay(100); // Swipe motor to search other hard end, and find eventually new max analog values of sensors @@ -157,9 +150,6 @@ void LinearHallSensor::init(BLDCMotor motor) else if (senseB[ptr] < _minCh2) _minCh2 = senseB[ptr]; - // Serial.printf("senseA: "); print_arr(senseA, N); Serial.printf(" std_var: %lu\n", std_var(senseA, N)); - // Serial.printf("senseB: "); print_arr(senseB, N); Serial.printf(" std_var: %lu\n", std_var(senseB, N)); - if (std_var(senseA, N) < epsilon && std_var(senseB, N) < epsilon) endFound = true; @@ -171,7 +161,7 @@ void LinearHallSensor::init(BLDCMotor motor) delay(2); } _minPositionEndValue = currentPosition + (step * (ptr > N ? N : ptr)); - Serial.println("Found second end stop : Min position = " + String(_minPositionEndValue)); + Serial.println("\t- Found second end stop : Min position = " + String(_minPositionEndValue)); delay(100); // Set min offset with 50 values average @@ -181,8 +171,8 @@ void LinearHallSensor::init(BLDCMotor motor) sum += readSensorCallback(); _offset = -sum / 50.0; - Serial.println("\n\rmaxA: " + String(_maxCh1) + "\tminA: " + String(_minCh1) + "\tmaxB: " + String(_maxCh2) + "\tminB: " + String(_minCh2)); - Serial.println("Offset: " + String(_offset)); + Serial.println("\t- maxA: " + String(_maxCh1) + "\tminA: " + String(_minCh1) + "\tmaxB: " + String(_maxCh2) + "\tminB: " + String(_minCh2)); + Serial.println("\t- Offset: " + String(_offset)); // Read max angle for (float i = _minPositionEndValue; i <= _maxPositionEndValue; i = i + 0.005) @@ -199,7 +189,7 @@ void LinearHallSensor::init(BLDCMotor motor) sum += readSensorCallback(); _maxSensor = sum / 50.0; - Serial.println("Max sensor: " + String(_maxSensor)); + Serial.println("\t- Max sensor: " + String(_maxSensor)); // Recovering previous controller type and go in the middle for (float i = _maxPositionEndValue; i >= (_maxPositionEndValue + _minPositionEndValue) / 2.0; i = i - 0.01)