[chronojump/michrolab] Jumps results shown
- From: Xavier Padullés <xpadulles src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [chronojump/michrolab] Jumps results shown
- Date: Fri, 15 Jul 2022 14:43:40 +0000 (UTC)
commit 73f390e56a6888c24964174d3a1a3f3bea9a88cd
Author: Xavier Padullés <testing chronojump org>
Date: Fri Jul 15 16:43:21 2022 +0200
Jumps results shown
arduino/michrolab/michrolab.ino | 76 ++++++++++++++++++++++++++++++++---------
1 file changed, 60 insertions(+), 16 deletions(-)
---
diff --git a/arduino/michrolab/michrolab.ino b/arduino/michrolab/michrolab.ino
index 5cf485dcb..1f8b684a5 100644
--- a/arduino/michrolab/michrolab.ino
+++ b/arduino/michrolab/michrolab.ino
@@ -1212,15 +1212,8 @@ void endEncoderCapture()
void showEncoderResults()
{
+ resultsBackground();
int textSize = 2;
- tft.fillScreen(BLACK);
- tft.setTextSize(3);
- tft.setCursor(100, 0);
- tft.print("Results");
-
- tft.drawLine(0, 20, 320, 20, GREY);
- tft.drawLine(160, 240, 160, 20, GREY);
- tft.setTextSize(textSize);
tft.setCursor(0, 40);
tft.print("v");
@@ -1311,15 +1304,8 @@ void endPowerCapture()
void showPowerResults()
{
+ resultsBackground();
int textSize = 2;
- tft.fillScreen(BLACK);
- tft.setTextSize(3);
- tft.setCursor(100, 0);
- tft.print("Results");
-
- tft.drawLine(0, 20, 320, 20, GREY);
- tft.drawLine(160, 240, 160, 20, GREY);
- tft.setTextSize(textSize);
tft.setCursor(0, 40);
tft.print("P");
@@ -1340,6 +1326,7 @@ void startJumpsCapture()
{
float maxJump = 0;
int totalJumps = 0;
+ int bestJumper = 0;
float graphRange = 100;
fileName = String("J") + "-S" + String(setNumber);
//fileName = "P" + String(currentPerson) + "-S" + String(setNumber);
@@ -1390,6 +1377,7 @@ void startJumpsCapture()
if (bars[index] > maxJump)
{
maxJump = bars[index];
+ bestJumper = currentPerson;
}
if (bars[index] > graphRange)
@@ -1426,10 +1414,53 @@ void startJumpsCapture()
blueButton.update();
}
setNumber++;
+ showJumpsResults(maxJump, bestJumper, totalJumps);
drawMenuBackground();
showMenuEntry(currentMenuIndex);
}
+void showJumpsResults(float maxJump, unsigned int bestJumper, int totalJumps)
+{
+ resultsBackground();
+ int textSize = 2;
+
+ tft.setCursor(0, 40);
+ tft.print("J");
+ tft.setCursor(12, 48);
+ tft.setTextSize(1);
+ tft.print("max");
+ printTftFormat(maxJump, 100, 40, textSize, 1);
+
+ tft.setTextSize(2);
+ tft.setCursor(170, 40);
+ tft.print("Best Jumper:");
+
+ tft.setCursor(170, 80);
+ tft.println(persons[bestJumper].name);
+ tft.setCursor(170, 120);
+ tft.println(persons[bestJumper].surname);
+// tft.setTextSize(1);
+// tft.setCursor(218, 48);
+// tft.print("max");
+// printTftFormat(maxAvgVelocity, 268, 40, textSize, 2);
+
+ tft.setTextSize(2);
+ tft.setCursor(0, 80);
+ tft.print("N");
+ tft.setCursor(12, 88);
+ tft.setTextSize(1);
+ tft.print("Jumps");
+ printTftFormat(totalJumps, 100, 80, textSize, 0);
+ tft.setTextSize(2);
+
+ redButton.update();
+ while (!redButton.fell()) {
+ redButton.update();
+ }
+ tft.fillRect(0, 20, 320, 240, BLACK);
+ drawMenuBackground();
+}
+
void setForceGoal()
{
forceGoal = selectValueDialog("Select the force goal in Newtons.\nAn horizontal red line will be drawn",
"10,50,1000,10000", "10,100,500", 0);
@@ -1599,3 +1630,16 @@ void saveJumps()
void fakeFunction()
{
}
+
+void resultsBackground()
+{
+ int textSize = 2;
+ tft.fillScreen(BLACK);
+ tft.setTextSize(3);
+ tft.setCursor(100, 0);
+ tft.print("Results");
+
+ tft.drawLine(0, 20, 320, 20, GREY);
+ tft.drawLine(160, 240, 160, 20, GREY);
+ tft.setTextSize(textSize);
+}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]