changed adc calculations to use Vin reference
This commit is contained in:
parent
7f1985d0cd
commit
4b2186aaf7
2 changed files with 4 additions and 4 deletions
|
|
@ -220,7 +220,7 @@ void updateGainFactor() {
|
|||
|
||||
void updateVComp() {
|
||||
if (serialInt >= 0) {
|
||||
compInt = (serialFloat / 5) * 1024;
|
||||
compInt = (serialFloat * 1024) / Vin;
|
||||
//senseInt = compInt; // syncing these params til #24 is fixed
|
||||
}
|
||||
}
|
||||
|
|
@ -228,7 +228,7 @@ void updateVComp() {
|
|||
|
||||
void updateVAdj() {
|
||||
if (serialInt >= 0) {
|
||||
senseInt = (serialFloat / 5) * 1024;
|
||||
senseInt = (serialFloat * 1024) / Vin;
|
||||
//compInt = senseInt; // syncing these params til #24 is fixed
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -5,8 +5,8 @@ volatile int ADJ_COMP = 0; // Variable for Comparator adjustment
|
|||
volatile int ERR_STATE = 0;
|
||||
|
||||
// Convert float to integer for adjustment functions
|
||||
int senseInt = (senseThrs / 5) * 1024; // Voltage Follower upper converted to adg interger
|
||||
int compInt = (compThrs / 5) * 1024; // Upper threshold of Comparator before adjustment
|
||||
int senseInt = (senseThrs * 1024) / Vin; // Voltage Follower upper converted to adg interger
|
||||
int compInt = (compThrs * 1024) / Vin; // Upper threshold of Comparator before adjustment
|
||||
|
||||
// Voltage Comparator Adjustment parameters
|
||||
//float VCompRef = 0.00; // variable to store the float value read from the comparator reference
|
||||
|
|
|
|||
Loading…
Reference in a new issue