From f77c29487617a7efac45e9aa4958b52a98e8c0ac Mon Sep 17 00:00:00 2001
From: Thomas Lambert <t.lambert@uliege.be>
Date: Tue, 22 Nov 2022 13:14:06 +0100
Subject: [PATCH] fix(calib): print of values

---
 controller/calibration.ino | 8 ++++----
 controller/controller.ino  | 4 ++--
 controller/sensors.ino     | 2 +-
 controller/utils.ino       | 5 ++---
 4 files changed, 9 insertions(+), 10 deletions(-)

diff --git a/controller/calibration.ino b/controller/calibration.ino
index e704fae..a1ad945 100644
--- a/controller/calibration.ino
+++ b/controller/calibration.ino
@@ -4,10 +4,10 @@
   'Calibrate' the wing absolute rotary encoders.
   First we unwrap the measured position by shifting the bits in order to avoid
   wrapping if this is needed.
-  Then we determine the maximum position so we can make it match the maximum angle
-  attainable.
+  Then we determine the maximum position so we can make it match the maximum
+  angle attainable.
 
-  --------------------------------------------------------------------------------
+ -------------------------------------------------------------------------------
   (c) Copyright 2022 University of Liege
   Author: Thomas Lambert <t.lambert@uliege.be>
   ULiege - Aeroelasticity and Experimental Aerodynamics
@@ -31,7 +31,7 @@ void Calibrate() {
 
     Serial.print("[WARNING]: Setup will run for ");
     Serial.print(calibTime / 1000);
-    Serial.print("s to get the offset and maximum value.");
+    Serial.println("s to get the offset and maximum value.");
     Serial.println("[INPUT]: Type 'Y' to begin.");
 
     while (Serial.available() == 0) {}  // Wait for serial input
diff --git a/controller/controller.ino b/controller/controller.ino
index 7354fbc..d0757ba 100644
--- a/controller/controller.ino
+++ b/controller/controller.ino
@@ -64,7 +64,7 @@
 /*******************************************************************************
   Globals (for things that I can change manually)
  *******************************************************************************/
-const boolean gSKIP_CALIB = true;  // Skip calibration or not
+const boolean gSKIP_CALIB = false;  // Skip calibration or not
 
 // Constant values that can be tweaked here or in the ESC before run
 const uint16_t gMAX_SIG = 2000;  // Max signal to the ESC [ms]
@@ -267,7 +267,7 @@ void SerialPrint(String mode, int potent, int esc_val, unsigned int wing_angles[
     Serial.print(",");
     Serial.print(PosToDeg(wing_angles[i]) - gMaxWingPos[i] + TRUE_MAX_ANGLE);
   }
-  for (int i = 0; i < sizeof(psu_vol); i++) {
+  for (int i = 0; i < sizeof(psu_vol) / sizeof(psu_vol[0]); i++) {
     Serial.print(",");
     Serial.print(psu_vol[i]);
     Serial.print(",");
diff --git a/controller/sensors.ino b/controller/sensors.ino
index b3d3bb4..6fbab66 100644
--- a/controller/sensors.ino
+++ b/controller/sensors.ino
@@ -3,7 +3,7 @@
 
   Functions for sensors and acquisition.
 
-  --------------------------------------------------------------------------------
+  ------------------------------------------------------------------------------
   (c) Copyright 2022 University of Liege
   Author: Thomas Lambert <t.lambert@uliege.be>
   ULiege - Aeroelasticity and Experimental Aerodynamics
diff --git a/controller/utils.ino b/controller/utils.ino
index 344f6c6..6d3f3cb 100644
--- a/controller/utils.ino
+++ b/controller/utils.ino
@@ -2,8 +2,7 @@
   Utils
 
   Miscellaneous utilities.
-
-  --------------------------------------------------------------------------------
+  ------------------------------------------------------------------------------
   (c) Copyright 2022 University of Liege
   Author: Thomas Lambert <t.lambert@uliege.be>
   ULiege - Aeroelasticity and Experimental Aerodynamics
@@ -38,7 +37,7 @@ float PosToDeg(unsigned int pos) {
 }
 
 void PrintArray(int array[]) {
-  for (int i = 0; i < sizeof(array); i++) {
+  for (int i = 0; i < sizeof(array) / sizeof(array[0]); i++) {
     Serial.print(array[i]);
     if (i < sizeof(array) - 1) {
       Serial.print(", ");
-- 
GitLab