From 59cf4a3934bd8251784e7a05a3ac45cc50939a80 Mon Sep 17 00:00:00 2001 From: Thomas Lambert <t.lambert@uliege.be> Date: Tue, 8 Nov 2022 19:42:58 +0100 Subject: [PATCH] perf: use uint16_t for wing_angles --- controller/controller.ino | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/controller/controller.ino b/controller/controller.ino index cff462a..8554f94 100644 --- a/controller/controller.ino +++ b/controller/controller.ino @@ -134,7 +134,7 @@ void setup() { void loop() { int potent = analogRead(POT_PIN); // Potentiometer value - unsigned int wing_angles[sizeof(gCSN_PINS)]; // Wing angles (1L, 1R, 2L, 2R) + uint16_t wing_angles[sizeof(gCSN_PINS)]; // Wing angles (1L, 1R, 2L, 2R) if (gMode == "SERIAL" and Serial.available()) { @@ -251,8 +251,8 @@ void StopMotor(int old_esc_val) { //Read 12-bit rotary encoder (RobinL modified by linarism on forum.arduino.cc) -unsigned int ReadSensor(uint8_t csn) { - unsigned int ret = 0; +uint16_t ReadSensor(uint8_t csn) { + uint16_t ret = 0; digitalWrite(csn, LOW); delayMicroseconds(1); //Waiting for Tclkfe @@ -272,7 +272,7 @@ unsigned int ReadSensor(uint8_t csn) { // Output data to use with serial-studio -void SerialPrint(String mode, int potent, int esc_val, unsigned int wing_angles[], float psu_vol[], float psu_cur[]) { +void SerialPrint(String mode, int potent, int esc_val, uint16_t wing_angles[], float psu_vol[], float psu_cur[]) { float freq = esc_val * (RpmToFreq(gMAX_RPM) / 180.0); -- GitLab