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
2 files
+ 22
2
Compare changes
  • Side-by-side
  • Inline
Files
2
+ 22
1
@@ -221,13 +221,34 @@ void setChannelStateAndWait(const IPAddress *ipAddr, const uint16_t channel, con
snmp.loop();
// Poll channel until it's settled
uint8_t loopCount = 0;
bool ramping = true;
bool settingChannelState = true;
do {
SNMP::Message *snmp_msg = mpod.read(channel);
snmp.send(snmp_msg, *ipAddr, SNMP::Port::SNMP);
delete snmp_msg;
delay(MPOD_UPDATE_LATENCY);
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,
Loading