Skip to content
Snippets Groups Projects

Add channels for all 4 modules in DEPFET quadrant

Merged Cyril Danilevski requested to merge q2m1-4 into main
Files
4
+ 22
1
@@ -221,13 +221,34 @@ void setChannelStateAndWait(const IPAddress *ipAddr, const uint16_t channel, con
@@ -221,13 +221,34 @@ void setChannelStateAndWait(const IPAddress *ipAddr, const uint16_t channel, con
snmp.loop();
snmp.loop();
// Poll channel until it's settled
// Poll channel until it's settled
 
uint8_t loopCount = 0;
 
bool ramping = true;
 
bool settingChannelState = true;
do {
do {
SNMP::Message *snmp_msg = mpod.read(channel);
SNMP::Message *snmp_msg = mpod.read(channel);
snmp.send(snmp_msg, *ipAddr, SNMP::Port::SNMP);
snmp.send(snmp_msg, *ipAddr, SNMP::Port::SNMP);
delete snmp_msg;
delete snmp_msg;
 
delay(MPOD_UPDATE_LATENCY);
delay(MPOD_UPDATE_LATENCY);
snmp.loop();
snmp.loop();
} while (mpod.isOn() != (bool)output || mpod.isRampingDown() || mpod.isRampingUp());
loopCount += 1;
 
ramping = (mpod.isRampingUp() || mpod.isRampingDown());
 
if (!ramping) {
 
if (mpod.isOn() == (bool)output) {
 
settingChannelState = false;
 
} else if (loopCount >= 5) {
 
// Resend set command
 
Serial.print("!Resend command to ");
 
Serial.println(channel);
 
SNMP::Message *snmp_msg = mpod.setChannelState(channel, output);
 
snmp.send(snmp_msg, *ipAddr, SNMP::Port::SNMP);
 
delay(MPOD_UPDATE_LATENCY);
 
snmp.loop();
 
delete snmp_msg;
 
loopCount = 0;
 
}
 
}
 
} while (settingChannelState);
}
}
void setChannelVoltageAndWait(const IPAddress *ipAddr, const uint16_t channel,
void setChannelVoltageAndWait(const IPAddress *ipAddr, const uint16_t channel,
Loading