Skip to content
Snippets Groups Projects
Verified Commit 9f5a079e authored by Thomas Lambert's avatar Thomas Lambert :helicopter:
Browse files

feat(runtime): reset timer before entering loop

parent 8eb6647a
No related merge requests found
......@@ -91,7 +91,7 @@ uint8_t gEsc_val = 0; // ESC angle (to use with the Servo l
String gMode; // Mode of operation
uint16_t gAngleOffset[] = { 0, 0, 1, 0 }; // Encoder offset (prevent wrap-around)
uint16_t gMaxWingPos[] = MAX_WING_POS; // Encoder maximum recorder position
int gStartTime; // Loop start time
/*******************************************************************************
ARDUINO SETUP
......@@ -142,6 +142,8 @@ void setup() {
delay(1000); // Ensure proper initialization
Serial.println("[INFO]: Setup OK, starting now...");
delay(500);
gStartTime = millis();
}
......@@ -260,7 +262,7 @@ void SerialPrint(String mode, int potent, int esc_val, unsigned int wing_angles[
Serial.print("/*"); // Beginning of data stream
Serial.print(mode);
Serial.print(",");
Serial.print(millis() / 1000.0);
Serial.print((millis() - gStartTime) / 1000.0);
Serial.print(",");
Serial.print(potent * 5.0 / 1023.0); // Converts pot val into proper tension
Serial.print(",");
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment