diff --git a/firmware/AVR-Source/Pyr0_Piezo_Sensor_v2.x.x/Pyr0_Piezo_Sensor_v2.x.x.ino b/firmware/AVR-Source/Pyr0_Piezo_Sensor_v2.x.x/Pyr0_Piezo_Sensor_v2.x.x.ino index fb1ccaf..bd57771 100644 --- a/firmware/AVR-Source/Pyr0_Piezo_Sensor_v2.x.x/Pyr0_Piezo_Sensor_v2.x.x.ino +++ b/firmware/AVR-Source/Pyr0_Piezo_Sensor_v2.x.x/Pyr0_Piezo_Sensor_v2.x.x.ino @@ -55,13 +55,14 @@ The gain STATE is representative of these values: */ // Configurable settings: -int GAIN_FACTOR = 2; // Gain adjustment factor. 0=3x, 1=3.5x, 2=4.33x, 3=6x, 4=11x +int GAIN_FACTOR = 2; // Gain adjustment factor. 0=3x, 1=3.5x, 2=4.33x, 3=6x, 4=11x #define InitCount 6 // Number of times to blink the LED on start -int LOOP_DUR = 50; // duration of time between ADC checks and other loop functions -int TRG_DUR = 20; // duration of the Z-axis pulse sent, in ms +int LOOP_DUR = 50; // duration of time between ADC checks and other loop functions +int TRG_DUR = 20; // duration of the Z-axis pulse sent, in ms #define senseThrs 1450 #define compThrs 2850 -int Hyst = 20; // Hysteresis value for ADC measurements +int Hyst = 20; // Hysteresis value for ADC measurements +long voltMeterConstant = 1125300L; // For fine tuning input voltage sense /*------------------------------------------------------------*/ diff --git a/firmware/AVR-Source/Pyr0_Piezo_Sensor_v2.x.x/pP_function.h b/firmware/AVR-Source/Pyr0_Piezo_Sensor_v2.x.x/pP_function.h index a1de50a..80a9f80 100644 --- a/firmware/AVR-Source/Pyr0_Piezo_Sensor_v2.x.x/pP_function.h +++ b/firmware/AVR-Source/Pyr0_Piezo_Sensor_v2.x.x/pP_function.h @@ -45,7 +45,7 @@ long readVcc() { long result = (high<<8) | low; - result = 1125300L / result; // Calculate Vcc (in mV); 1125300 = 1.1*1023*1000 + result = voltMeterConstant / result; // Calculate Vcc (in mV); 1125300 = 1.1*1023*1000 return result; // Vcc in millivolts }