[chronojump/michrolab] Changed the R and r state. R means RCA shorted



commit ee44853ce80f4c80d67749da851ce77a2ecb2e04
Author: xpadulles <x padulles gmail com>
Date:   Thu Jul 14 18:13:55 2022 +0200

    Changed the R and r state. R means RCA shorted

 arduino/michrolab/michrolab.ino     | 22 ++++++++++++----------
 arduino/michrolab/personsManage.ino |  4 ++--
 2 files changed, 14 insertions(+), 12 deletions(-)
---
diff --git a/arduino/michrolab/michrolab.ino b/arduino/michrolab/michrolab.ino
index e62263b11..296df21b6 100644
--- a/arduino/michrolab/michrolab.ino
+++ b/arduino/michrolab/michrolab.ino
@@ -743,7 +743,7 @@ void changingRCA() {
 void rcaDebounce()
 {
   rcaTimer.end();
-  rcaState = digitalRead(rcaPin);
+  rcaState = !digitalRead(rcaPin);
   if (rcaState != lastRcaState)
   {
     rcaFlag = true;
@@ -1337,6 +1337,7 @@ void showPowerResults()
 
 void startJumpsCapture()
 {
+  int totalJumps = 0;
   rcaState = digitalRead(rcaPin);
   lastRcaState = rcaState;
   rcaFlag = false;
@@ -1351,12 +1352,12 @@ void startJumpsCapture()
   redButton.update();
   int index = 0;
   currentPerson = 0;
-  updatePersonJump();
+  updatePersonJump(totalJumps);
   while ( !redButton.fell() )
   {
     if( blueButton.fell() ){
       currentPerson = (currentPerson + 1)%totalPersons;
-      updatePersonJump();
+      updatePersonJump(totalJumps);
     }
     if (rcaFlag)
     {
@@ -1366,11 +1367,6 @@ void startJumpsCapture()
       if (!firstContact) {
         if (rcaState)
         {
-          Serial.println("r;");
-          if (firstContact) firstContact = false;
-        } else if (!rcaState)
-        {
-          Serial.println("R;");
           //barPlot(30, 200, 290, 200, 100, 10, (index -1)%10, 0.5, BLACK);
           tft.fillRect(30, 0, 290, 200, BLACK);
           flightTime = (float)(rcaTime - lastRcaTime) / 1E6;
@@ -1378,15 +1374,21 @@ void startJumpsCapture()
           redrawAxes(tft, 30, 200, 290, 200, 290, 200, 0, 100, 10, "", "", "", WHITE, GREY, WHITE, WHITE, 
BLACK, RED, true);
           barPlot(30, 200, 290, 200, 100, 10, index, 0.5, RED);
           index = (index + 1) % 10;
+          Serial.println("R;");
+          totalJumps++;
+          updatePersonJump(totalJumps);
+        } else if (!rcaState)
+        {
+          Serial.println("r;");
         }
       } else if (firstContact) {
         firstContact = false;
         if (rcaState)
         {
-          Serial.println("r;");
+          Serial.println("R;");
         }
         else if (!rcaState) {
-          Serial.println("R;");
+          Serial.println("r;");
         }
       }
       lastRcaState = rcaState;
diff --git a/arduino/michrolab/personsManage.ino b/arduino/michrolab/personsManage.ino
index 28eac7d35..1f0e54b6f 100644
--- a/arduino/michrolab/personsManage.ino
+++ b/arduino/michrolab/personsManage.ino
@@ -140,7 +140,7 @@ void updatePersonSet()
   tft.setTextSize(2);
 }
 
-void updatePersonJump()
+void updatePersonJump(int totalJumps)
 {
   //Deleting last string
   tft.fillRect(141, 207, 127, 24, BLACK);
@@ -149,7 +149,7 @@ void updatePersonJump()
   tft.setTextSize(1);
   tft.setTextColor(WHITE);
   tft.setCursor(141, 207);
-  tft.print("Jump: " + addLeadingZeros(setNumber, 2) +  "   Person: " + addLeadingZeros(currentPerson, 2));
+  tft.print("Jump: " + addLeadingZeros(totalJumps, 2) +  "   Person: " + addLeadingZeros(currentPerson, 2));
   tft.setCursor(141, 223);
   tft.print(persons[currentPerson].name + " " + persons[currentPerson].surname);
   tft.setTextSize(2);


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]