[chronojump/michrolab] Added management of the previos tare depending on the exercise
- From: Xavier Padullés <xpadulles src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [chronojump/michrolab] Added management of the previos tare depending on the exercise
- Date: Fri, 16 Sep 2022 18:10:48 +0000 (UTC)
commit 70294c8e7208957014f1b85a639a377d993752af
Author: Xavier Padullés <testing chronojump org>
Date: Fri Sep 16 20:09:51 2022 +0200
Added management of the previos tare depending on the exercise
arduino/michrolab/exercsiseManage.ino | 15 +++++++++++----
arduino/michrolab/michrolab.ino | 24 +++++++++++++++++++++---
2 files changed, 32 insertions(+), 7 deletions(-)
---
diff --git a/arduino/michrolab/exercsiseManage.ino b/arduino/michrolab/exercsiseManage.ino
index 29a83035b..85c8f023c 100644
--- a/arduino/michrolab/exercsiseManage.ino
+++ b/arduino/michrolab/exercsiseManage.ino
@@ -151,7 +151,6 @@ void saveInertialList()
void addForce(String row)
{
- //Serial.println(row);
int prevComaIndex = row.indexOf(":");
int nextComaIndex = row.indexOf(",");
forceTypes[totalForceTypes].id = row.substring(prevComaIndex + 1, nextComaIndex).toInt();
@@ -173,8 +172,7 @@ void addForce(String row)
forceTypes[totalForceTypes].angle = row.substring(prevComaIndex + 1 , nextComaIndex).toFloat();
prevComaIndex = nextComaIndex;
- nextComaIndex = row.indexOf(",", prevComaIndex + 1 );
- forceTypes[totalForceTypes].percentBodyWeight = ( row.substring(prevComaIndex + 1 , nextComaIndex) == 1 );
+ forceTypes[totalForceTypes].tare = ( row.substring(prevComaIndex + 1 , prevComaIndex + 2) == "1" );
totalForceTypes++;
}
@@ -344,9 +342,13 @@ void selectExerciseType(exerciseType mode)
printTftText(gravTypes[currentExerciseType].name, 50, 100);
}
else if (mode == inertial) {
- printTftText("Inertt. type", 40, 20, WHITE, 3);
+ printTftText("Inert. type", 40, 20, WHITE, 3);
printTftText(inertTypes[currentExerciseType].name, 50, 100);
}
+ else if (mode == force) {
+ printTftText("Force type", 40, 20, WHITE, 3);
+ printTftText(forceTypes[currentExerciseType].name, 50, 100);
+ }
drawLeftButton("Next", WHITE, BLUE);
drawRightButton("Accept", WHITE, RED);
@@ -373,6 +375,11 @@ void selectExerciseType(exerciseType mode)
currentExerciseType = (currentExerciseType + 1) % totalInertTypes;
printTftText(inertTypes[currentExerciseType].name, 50, 100);
}
+ else if (mode == force) {
+ printTftText(forceTypes[currentExerciseType].name, 50, 100, BLACK);
+ currentExerciseType = (currentExerciseType + 1) % totalForceTypes;
+ printTftText(forceTypes[currentExerciseType].name, 50, 100);
+ }
}
blueButton.update();
redButton.update();
diff --git a/arduino/michrolab/michrolab.ino b/arduino/michrolab/michrolab.ino
index 926a9fb2e..63d2a2df4 100644
--- a/arduino/michrolab/michrolab.ino
+++ b/arduino/michrolab/michrolab.ino
@@ -191,12 +191,12 @@ menuEntry mainMenu[10] = {
{ "Inert. Velocity", "Show a bars of the velocity of the person in inertial machines",
&startInertEncoderCapture },
{ "RaceAnalyzer", "Measure speed with a raceAnalyzer", &startRaceAnalyzerCapture},
{ "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},
+ //{ "Tared Force", "Offset the force before\nmeasuring it.\nUseful to substract body\nweight.",
&startTareCapture},
{ "F. Steadiness", "RMSSD and cvRMSSD.\nSteadynessof the force.\nWhen ready, press the Red Button to get
the\nsteadiness of the next 5s.", &startSteadiness},
{ "System", "Performs calibration or\ntare and shows some system\ninformation.", &showSystemMenu}
};
-int mainMenuItems = 9;
+int mainMenuItems = 8;
menuEntry systemMenu[10] {
{ "Group", "Select the group you are going to use.\nUp to 9 groups can be\nselected", &selectGroup},
@@ -483,8 +483,9 @@ void setup() {
//TODO: Read exercises only if necessary
currentExerciseType = 0;
-
tft.fillScreen(BLACK);
+
+ Serial.println("Microlab-" + version);
drawMenuBackground();
backMenu();
@@ -771,6 +772,21 @@ void startLoadCellCapture(void)
newGraphMin = -100;
newGraphMax = max(100, measuredMax * 1.5);
}
+
+ selectPersonDialog();
+ if (totalForceTypes == 0) readExercisesFile(force);
+ selectExerciseType(force);
+ if(forceTypes[currentExerciseType].tare)
+ {
+ tft.fillScreen(BLACK);
+ printTftText(currentMenu[currentMenuIndex].description, 12, 100, 2);
+ printTftText("Taring...", 100, 100);
+ scale.tare(50); //Reset the scale to 0 using the mean of 255 raw values
+ printTftText("Taring...", 100, 100, BLACK);
+ printTftText(" Tared ", 100, 100);
+ delay(300);
+ }
+
}
void endLoadCellCapture()
@@ -853,6 +869,7 @@ void tare()
showMenuEntry(currentMenuIndex);
}
+/*
void startTareCapture(void)
{
@@ -864,6 +881,7 @@ void startTareCapture(void)
delay(300);
startLoadCellCapture();
}
+*/
void get_tare()
{
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]