[chronojump] RaceAnalyzer. Implemented offset EEPROM read/store



commit 38a8c28e5cad98699c509223d0cdf3a8f3b88a08
Author: Xavier Padullés <x padulles gmail com>
Date:   Fri Mar 29 12:07:06 2019 +0100

    RaceAnalyzer. Implemented offset EEPROM read/store

 arduino/raceAnalyzer/raceAnalyzer.ino | 9 ++++++---
 1 file changed, 6 insertions(+), 3 deletions(-)
---
diff --git a/arduino/raceAnalyzer/raceAnalyzer.ino b/arduino/raceAnalyzer/raceAnalyzer.ino
index f57a5095..b0fa49dc 100644
--- a/arduino/raceAnalyzer/raceAnalyzer.ino
+++ b/arduino/raceAnalyzer/raceAnalyzer.ino
@@ -20,7 +20,8 @@ String version = "Race_Analyzer-0.1";
 int pps = 40; //Pulses Per Sample. How many pulses are needed to get a sample
 int ppsAddress = 0; //Where is stored the pps value in the EEPROM
 
-int offset = 14230;
+int offset = 0;
+
 int offsetAddress = 2;
 float calibrationFactor = 0.140142;
 int calibrationAddress = 4;
@@ -44,7 +45,7 @@ void setup() {
   loadCell.begin();
   loadCell.setGain(GAIN_ONE);
   //tare();
-
+  EEPROM.get(offsetAddress, offset);;
   //EEPROM.get(ppsAddress, pps);
   //Using the rising flank of the A photocell we have a 200 PPR.
   attachInterrupt(digitalPinToInterrupt(encoderPinA), changingA, RISING);
@@ -334,7 +335,9 @@ void set_offset(String inputString)
 
 void get_offset(void)
 {
-  Serial.println(offset);
+  int stored_offset = 0;
+  EEPROM.get(offsetAddress, stored_offset);
+  Serial.println(stored_offset);
 }
 
 void get_calibration_factor(void)


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