update load cell channel based on repaired board and 1T load cell bdale-ui
authorBdale Garbee <bdale@gag.com>
Fri, 6 Mar 2020 02:05:00 +0000 (19:05 -0700)
committerBdale Garbee <bdale@gag.com>
Sat, 28 Mar 2020 06:52:14 +0000 (00:52 -0600)
altoslib/AltosEepromRecordFireTwo.java

index 49a262bab0032893d126547496665428964f60f4..cced773c3af52c0f60ee058cc7aa02bcae0b90d2 100644 (file)
@@ -66,13 +66,22 @@ public class AltosEepromRecordFireTwo extends AltosEepromRecord {
 
        public static double adc_to_n(int adc) {
 
-               /* sensor looks linear once it "gets going" */
-               double ADC_MIN = 156;           /* first non-zero cal value */
-               double ADC_SLOPE = 3.343;       /* adc counts per lb */
-               double ADC_OFFSET = 26.5;       /* lbs at ADC_MIN */
+               /* load cell sensor looks linear once it "gets going" */
+
+               /* cal values using 1 metric ton "S" load cell 2020.03.05 */
+               /* lowest useful cal data point in linear region */
+               double ADC_MIN_LBS = 71.4;
+               double ADC_MIN_COUNTS = 153; 
+
+               /* highest useful cal data point in linear region */
+               double ADC_MAX_LBS = 211.4;
+               double ADC_MAX_COUNTS = 313; 
+
+               /* slope of sensor response in ADC counts per lb */
+               double ADC_SLOPE = (ADC_MAX_COUNTS - ADC_MIN_COUNTS) / (ADC_MAX_LBS - ADC_MIN_LBS);
 
                double raw = adc;
-               double lb = ((raw - ADC_MIN) / ADC_SLOPE) + ADC_OFFSET;
+               double lb = ((raw - ADC_MIN_COUNTS) / ADC_SLOPE) + ADC_MIN_LBS;
                return AltosConvert.lb_to_n(lb);
        }