Created variable for voltmeter constant, fixed whitespace a bit
This commit is contained in:
parent
0b1dbeb237
commit
dc9ef32e5b
2 changed files with 6 additions and 5 deletions
|
|
@ -55,13 +55,14 @@ The gain STATE is representative of these values:
|
||||||
*/
|
*/
|
||||||
|
|
||||||
// Configurable settings:
|
// 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
|
#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 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 TRG_DUR = 20; // duration of the Z-axis pulse sent, in ms
|
||||||
#define senseThrs 1450
|
#define senseThrs 1450
|
||||||
#define compThrs 2850
|
#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
|
||||||
|
|
||||||
/*------------------------------------------------------------*/
|
/*------------------------------------------------------------*/
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -45,7 +45,7 @@ long readVcc() {
|
||||||
|
|
||||||
long result = (high<<8) | low;
|
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
|
return result; // Vcc in millivolts
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue