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
|
|
@ -62,6 +62,7 @@ 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