[chronojump/michrolab] Vertical range in jumps autoadjusted
- From: Xavier Padullés <xpadulles src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [chronojump/michrolab] Vertical range in jumps autoadjusted
- Date: Fri, 15 Jul 2022 07:53:09 +0000 (UTC)
commit d578f48c6e16c03c4cbca616a301b0cf3e89e7de
Author: Xavier Padullés <testing chronojump org>
Date: Fri Jul 15 09:40:22 2022 +0200
Vertical range in jumps autoadjusted
arduino/michrolab/michrolab.ino | 13 ++++++++++---
1 file changed, 10 insertions(+), 3 deletions(-)
---
diff --git a/arduino/michrolab/michrolab.ino b/arduino/michrolab/michrolab.ino
index 6a409df3e..9ab4b7c36 100644
--- a/arduino/michrolab/michrolab.ino
+++ b/arduino/michrolab/michrolab.ino
@@ -1339,6 +1339,7 @@ void startJumpsCapture()
{
float maxJump = 0;
int totalJumps = 0;
+ float graphRange = 100;
rcaState = digitalRead(rcaPin);
lastRcaState = rcaState;
rcaFlag = false;
@@ -1349,7 +1350,7 @@ void startJumpsCapture()
bars[i] = 0;
}
tft.fillScreen(BLACK);
- redrawAxes(tft, 30, 200, 290, 200, 290, 200, 0, 100, 10, "", "", "", WHITE, GREY, WHITE, WHITE, BLACK,
RED, true);
+ redrawAxes(tft, 30, 200, 290, 200, 290, 200, 0, graphRange, graphRange/10, "", "", "", WHITE, GREY, WHITE,
WHITE, BLACK, RED, true);
redButton.update();
int index = 0;
currentPerson = 0;
@@ -1387,8 +1388,14 @@ void startJumpsCapture()
{
maxJump = bars[index];
}
- 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);
+
+ if (bars[index] > graphRange)
+ {
+ redrawAxes(tft, 30, 200, 290, 200, 290, 200, 0, graphRange, graphRange/10, "", "", "", WHITE,
BLACK, WHITE, BLACK, BLACK, RED, true);
+ graphRange = bars[index]*1.25;
+ }
+ redrawAxes(tft, 30, 200, 290, 200, 290, 200, 0, graphRange, graphRange/10, "", "", "", WHITE,
GREY, WHITE, WHITE, BLACK, RED, true);
+ barPlot(30, 200, 290, 200, graphRange, 10, index, 0.5, RED);
index = (index + 1) % 10;
Serial.println("R;");
totalJumps++;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]