Combo: retry twice to establish connection before giving up.

(cherry picked from commit a16560a)
This commit is contained in:
Johannes Mockenhaupt 2018-02-01 00:06:29 +01:00
parent 26e7834093
commit 1f06d801a2
No known key found for this signature in database
GPG key ID: 9E1EA6AF7BBBB0D1

View file

@ -824,6 +824,9 @@ public class ComboPlugin implements PluginBase, PumpInterface, ConstraintsInterf
private CommandResult runOnConnectChecks() {
// connect, get status and check if an alarm is active
CommandResult preCheckResult = ruffyScripter.readPumpState();
for (int retries = 2; !preCheckResult.success && retries > 0; retries--) {
preCheckResult = ruffyScripter.readPumpState();
}
if (!preCheckResult.success) {
return preCheckResult;
}
@ -1116,6 +1119,8 @@ public class ComboPlugin implements PluginBase, PumpInterface, ConstraintsInterf
return null;
}
// TODO still regularly continues even though no changes on pump exist ...
// OPTIMIZE this reads the entire history on start, so this could be optimized by persisting
// `timestampOfLastKnownPumpBolusRecord`, though this should be thought through, to make sure
// all scenarios are covered