[chronojump/michrolab: 57/57] Added inertial mode




commit a32435030b7459c446ddb84602306803e5651471
Author: xpadulles <x padulles gmail com>
Date:   Tue May 24 17:06:03 2022 +0200

    Added inertial mode

 arduino/ForceSensorTFT/ForceSensorTFT.ino | 16 ++++++++++++----
 1 file changed, 12 insertions(+), 4 deletions(-)
---
diff --git a/arduino/ForceSensorTFT/ForceSensorTFT.ino b/arduino/ForceSensorTFT/ForceSensorTFT.ino
index 25aa24b41..c41d56d44 100644
--- a/arduino/ForceSensorTFT/ForceSensorTFT.ino
+++ b/arduino/ForceSensorTFT/ForceSensorTFT.ino
@@ -156,13 +156,13 @@ functionPointer FArray[3] = {&fakeFunction, &fakeFunction, &fakeFunction};
 menuEntry mainMenu[10] = {
   { "Raw Force", "Shows standard graph of\nthe force and the summary of the set.\n(Maximum Force, RFD 
and\nImpulse)", &startLoadCellCapture},
   { "Raw Velocity", "Show a standard graph of linear velocity", &startEncoderCapture },
+  { "Raw Inertial V.", "Show a standard graph of the velocity of the person", &startInertialEncoderCapture },
   { "RawPower", "Measure Force and Speed\nat the same time.\nOnly power is shown in thegraph", 
&startPowerCapture},
   { "Tared Force", "Offset the force before\nmeasuring it.\nUseful to substract body\nweight.", 
&startTareCapture},
   { "F. Steadiness", "RMSSD and cvRMSSD.\nMeasure the steadyness\nof the force signal.\nAfter achieving 
the\ndesired steady force press\nRedButton to get the\nsteadiness of the next 5s.", &startSteadiness},
   { "System", "Performs calibration or\ntare and shows some system\ninformation.", &showSystemMenu},
   { "", "", &backMenu},
   { "", "", &backMenu},
-  { "", "", &backMenu},
   { "", "", &backMenu}
 };
 
@@ -1374,6 +1374,8 @@ void getEncoderDynamics()
     lastSampleTime = totalTime;
     
     long position = encoder.read();
+
+    //TODO: Calculate positoion depending on the parameters of the encoder/machine
     if (inertialMode) position = - abs(position);
     measured = (float)(position - lastSamplePosition) * 1000 / (sampleDuration);
     float accel = (measured - lastVelocity) * 1000000 / sampleDuration;
@@ -1389,12 +1391,12 @@ void getEncoderDynamics()
       if (position >= minRom) {
         encoderPhase = 1;
         localMax = position;
-        Serial.println("Start in CONcentric");
+        //Serial.println("Start in CONcentric");
       }
       else if (position <= -minRom) {
         encoderPhase = 1;
         localMax = position;
-        Serial.println("Start in ECCentric");
+        //Serial.println("Start in ECCentric");
       }
     }
 
@@ -1430,7 +1432,7 @@ void startEncoderCapture(void)
   sensor = incEncoder;
   //Serial.println(sensor);
   maxString = "V";
-  plotPeriod = 5;
+  plotPeriod = 1;
   newGraphMin = -10;
   newGraphMax = 10;
   measuredMax = 0;
@@ -1879,5 +1881,11 @@ void backMenu(void)
   showMenu();
 }
 
+void startInertialEncoderCapture()
+{
+  inertialMode = true;
+  startEncoderCapture();
+}
+
 void fakeFunction(){  
 }


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