[chronojump/FS-LCD-Menu] Calibration with 1, 2, 3 and 4 kg
- From: Xavier Padullés <xpadulles src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [chronojump/FS-LCD-Menu] Calibration with 1, 2, 3 and 4 kg
- Date: Tue, 18 Jan 2022 15:12:48 +0000 (UTC)
commit 9c55ed594eee8257f6ebe7e671ef23d6fdb5bdb2
Author: xpadulles <x padulles gmail com>
Date: Tue Jan 18 14:23:10 2022 +0100
Calibration with 1, 2, 3 and 4 kg
arduino/ForceSensorLCD/ForceSensorLCD.ino | 53 ++++++++++++++++++++-----------
1 file changed, 34 insertions(+), 19 deletions(-)
---
diff --git a/arduino/ForceSensorLCD/ForceSensorLCD.ino b/arduino/ForceSensorLCD/ForceSensorLCD.ino
index f9504fd51..30eaf406f 100644
--- a/arduino/ForceSensorLCD/ForceSensorLCD.ino
+++ b/arduino/ForceSensorLCD/ForceSensorLCD.ino
@@ -824,22 +824,52 @@ void checkTimeOverflow() {
void calibrateLCD(void) {
MsTimer2::stop();
+ short increment = 1;
lcd.clear();
lcd.setCursor(0, 0);
lcd.print((menu + 1) % 4 + 1);
lcd.print("-Calibrate >");
- int weight = 5;
+ int weight = 1;
submenu = 0;
bool exitFlag = false;
String calibrateCommand = calibrateCommand + String(weight, DEC) + ";";
- showCalibrateLoad(String(weight, DEC));
+// showCalibrateLoad(String(weight, DEC));
+ lcd.setCursor(15, 0);
+ lcd.print(">");
+ lcd.setCursor(2, 1);
+ lcd.print(" Current:" );
+ lcd.print(weight);
+ lcd.setCursor(14, 1);
+ lcd.print("+");
+ lcd.print(increment);
+ delay(200);
redButtonState = false;
while (!exitFlag) {
if (submenu == 0) {
if (redButtonState) {
- weight += 5;
- showCalibrateLoad(String(weight, DEC));
+ weight += increment;
+ if (weight == 101){
+ weight = 1;
+ lcd.setCursor(12,1);
+ lcd.print(" ");
+ }
+
+ lcd.setCursor(11,1);
+ lcd.print(weight);
+
+ if (weight == 5){
+ increment = 5;
+ lcd.setCursor(14, 1);
+ lcd.print("+");
+ lcd.print(increment);
+ } else if (weight == 100){
+ increment = 1;
+ lcd.setCursor(14, 1);
+ lcd.print("+");
+ lcd.print(increment);
+ }
+
calibrateCommand = calibrateCommand + String(weight, DEC) + ";";
delay(200);
}
@@ -882,21 +912,6 @@ void calibrateLCD(void) {
showMenu();
}
-//During load selection each time the load is changed it show the new load
-void showCalibrateLoad(String weight) {
- // lcd.clear();
- // lcd.setCursor(3, 0);
- // lcd.print("Set load");
- lcd.setCursor(15, 0);
- lcd.print(">");
- lcd.setCursor(2, 1);
- lcd.print(" Current:" );
- lcd.print(weight);
- lcd.setCursor(14, 1);
- lcd.print("+5");
- delay(200);
-}
-
void showBatteryLevel() {
float sensorValue = analogRead(A0);
if (sensorValue >= 788) {
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]