Skip to content
Snippets Groups Projects
Commit 86bd6a47 authored by Cyril Danilevski's avatar Cyril Danilevski :scooter:
Browse files

Resend commands on power sequence when no feedback after N polls

parent 4e1ffb0f
No related branches found
No related tags found
1 merge request!4Add channels for all 4 modules in DEPFET quadrant
Pipeline #165258 passed
......@@ -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);
delete snmp_msg;
delay(MPOD_UPDATE_LATENCY);
snmp.loop();
loopCount = 0;
}
}
} while (settingChannelState);
}
void setChannelVoltageAndWait(const IPAddress *ipAddr, const uint16_t channel,
......
......@@ -59,7 +59,6 @@ class MPOD {
}
};
// Create an SNMP SETREQUEST message to setup MPOD
MPOD();
SNMP::Message* read(const uint16_t);
SNMP::Message* setChannelState(const uint16_t, const bool);
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment