add range checks and messages to help signal what the DAC is doing better

This commit is contained in:
Peter McGoron 2021-06-01 12:10:25 -04:00
parent d487fdd81b
commit 3b7f6693a9
1 changed files with 14 additions and 0 deletions

View File

@ -158,6 +158,12 @@ void autoRamp1(std::vector<String> DB)
int nSteps = DB[4].toInt();
int dacChannel=DB[1].toInt();
if (v1 < -10 || v1 > 10 || v2 < -10 || v2 > 10) {
Serial.println("RAMP_OVERRANGE");
return;
}
Serial.println("RAMPING");
for (int j=0; j<nSteps;j++)
{
int timer = micros();
@ -178,6 +184,13 @@ void autoRamp2(std::vector<String> DB)
int dacChannel1=DB[1].toInt();
int dacChannel2=DB[2].toInt();
if (vi1 < -10 || vi1 > 10 || vi2 < -10 || vi2 > 10
|| vf1 < -10 || vf1 > 10 || vf2 < -10 || vf2 > 10) {
Serial.println("RAMP_OVERRANGE");
return;
}
Serial.println("RAMPING");
for (int j=0; j<nSteps;j++)
{
int timer = micros();
@ -356,6 +369,7 @@ void loop()
{
normalMode();
initialized = 1;
Serial.println("INITIALIZATION COMPLETE");
}