Removed debug serial output, fixed voltage reference divisor
This commit is contained in:
parent
19aa237fc1
commit
39a0181646
1 changed files with 2 additions and 23 deletions
|
|
@ -100,9 +100,6 @@ void adjustState() {
|
||||||
void adjustVoltage() {
|
void adjustVoltage() {
|
||||||
|
|
||||||
if (ADJ_STATE < 0) {
|
if (ADJ_STATE < 0) {
|
||||||
Serial.print("adjustVoltage:");
|
|
||||||
Serial.println(ADJ_STATE);
|
|
||||||
Serial.println("--------------------");
|
|
||||||
ERR_STATE = 1;
|
ERR_STATE = 1;
|
||||||
}
|
}
|
||||||
if (ADJ_STATE = 0) {
|
if (ADJ_STATE = 0) {
|
||||||
|
|
@ -110,9 +107,6 @@ void adjustVoltage() {
|
||||||
pinMode(VADJ_R2, INPUT);
|
pinMode(VADJ_R2, INPUT);
|
||||||
pinMode(VADJ_R1, INPUT);
|
pinMode(VADJ_R1, INPUT);
|
||||||
pinMode(VADJ_R0, INPUT);
|
pinMode(VADJ_R0, INPUT);
|
||||||
Serial.print("adjustVoltage:");
|
|
||||||
Serial.println(ADJ_STATE);
|
|
||||||
Serial.println("--------------------");
|
|
||||||
ERR_STATE = 0;
|
ERR_STATE = 0;
|
||||||
}
|
}
|
||||||
if (ADJ_STATE > 0) {
|
if (ADJ_STATE > 0) {
|
||||||
|
|
@ -121,9 +115,6 @@ void adjustVoltage() {
|
||||||
pinMode(VADJ_R2, INPUT);
|
pinMode(VADJ_R2, INPUT);
|
||||||
pinMode(VADJ_R1, INPUT);
|
pinMode(VADJ_R1, INPUT);
|
||||||
pinMode(VADJ_R0, INPUT);
|
pinMode(VADJ_R0, INPUT);
|
||||||
Serial.print("adjustVoltage:");
|
|
||||||
Serial.println(ADJ_STATE);
|
|
||||||
Serial.println("--------------------");
|
|
||||||
ERR_STATE = 0;
|
ERR_STATE = 0;
|
||||||
}
|
}
|
||||||
if (ADJ_STATE > 1) {
|
if (ADJ_STATE > 1) {
|
||||||
|
|
@ -131,32 +122,20 @@ void adjustVoltage() {
|
||||||
digitalWrite(VADJ_R2, LOW);
|
digitalWrite(VADJ_R2, LOW);
|
||||||
pinMode(VADJ_R1, INPUT);
|
pinMode(VADJ_R1, INPUT);
|
||||||
pinMode(VADJ_R0, INPUT);
|
pinMode(VADJ_R0, INPUT);
|
||||||
Serial.print("adjustVoltage:");
|
|
||||||
Serial.println(ADJ_STATE);
|
|
||||||
Serial.println("--------------------");
|
|
||||||
ERR_STATE = 0;
|
ERR_STATE = 0;
|
||||||
}
|
}
|
||||||
if (ADJ_STATE > 2) {
|
if (ADJ_STATE > 2) {
|
||||||
pinMode(VADJ_R1, OUTPUT);
|
pinMode(VADJ_R1, OUTPUT);
|
||||||
digitalWrite(VADJ_R1, LOW);
|
digitalWrite(VADJ_R1, LOW);
|
||||||
pinMode(VADJ_R0, INPUT);
|
pinMode(VADJ_R0, INPUT);
|
||||||
Serial.print("adjustVoltage:");
|
|
||||||
Serial.println(ADJ_STATE);
|
|
||||||
Serial.println("--------------------");
|
|
||||||
ERR_STATE = 0;
|
ERR_STATE = 0;
|
||||||
}
|
}
|
||||||
if (ADJ_STATE > 3) {
|
if (ADJ_STATE > 3) {
|
||||||
pinMode(VADJ_R0, OUTPUT);
|
pinMode(VADJ_R0, OUTPUT);
|
||||||
digitalWrite(VADJ_R0, LOW);
|
digitalWrite(VADJ_R0, LOW);
|
||||||
Serial.print("adjustVoltage:");
|
|
||||||
Serial.println(ADJ_STATE);
|
|
||||||
Serial.println("--------------------");
|
|
||||||
ERR_STATE = 0;
|
ERR_STATE = 0;
|
||||||
}
|
}
|
||||||
if (ADJ_STATE > 4) {
|
if (ADJ_STATE > 4) {
|
||||||
Serial.print("adjustVoltage:");
|
|
||||||
Serial.println(ADJ_STATE);
|
|
||||||
Serial.println("--------------------");
|
|
||||||
ERR_STATE = 1;
|
ERR_STATE = 1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -185,9 +164,9 @@ void loop() {
|
||||||
|
|
||||||
// Check voltage of first and second stages and compare against thresholds
|
// Check voltage of first and second stages and compare against thresholds
|
||||||
folRead = analogRead(V_FOLLOW_PIN);
|
folRead = analogRead(V_FOLLOW_PIN);
|
||||||
VRef = folRead * (5.0 / 1023.0);
|
VRef = (folRead * 5.0) / 1024.0;
|
||||||
vadjRead = analogRead(VADJ_SENSE_PIN);
|
vadjRead = analogRead(VADJ_SENSE_PIN);
|
||||||
VAdj = vadjRead * (5.0 / 1023.0);
|
VAdj = (vadjRead * 5.0) / 1024.0;
|
||||||
diffAdjL = VAdj - senseLowThrs;
|
diffAdjL = VAdj - senseLowThrs;
|
||||||
diffAdjH = senseHighThrs - VAdj;
|
diffAdjH = senseHighThrs - VAdj;
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue