cancel temp basal in the same connection
This commit is contained in:
parent
3a95325039
commit
2c2b6c21a1
|
@ -404,15 +404,6 @@ public class DanaRPlugin implements PluginBase, PumpInterface, DanaRInterface, C
|
|||
if (Config.logPumpActions)
|
||||
log.debug("setTempBasalAbsolute: Correct temp basal already set (doLowTemp || doHighTemp)");
|
||||
return result;
|
||||
} else {
|
||||
if (Config.logPumpActions)
|
||||
log.debug("setTempBasalAbsolute: Stopping temp basal (doLowTemp || doHighTemp)");
|
||||
result = cancelRealTempBasal();
|
||||
// Check for proper result
|
||||
if (!result.success) {
|
||||
log.error("setTempBasalAbsolute: Failed to stop previous temp basal (doLowTemp || doHighTemp)");
|
||||
return result;
|
||||
}
|
||||
}
|
||||
}
|
||||
// Convert duration from minutes to hours
|
||||
|
|
|
@ -353,6 +353,11 @@ public class DanaRExecutionService extends Service {
|
|||
public boolean tempBasal(int percent, int durationInHours) {
|
||||
connect("tempBasal");
|
||||
if (!isConnected()) return false;
|
||||
if (danaRPump.isTempBasalInProgress) {
|
||||
MainApp.bus().post(new EventPumpStatusChanged(MainApp.sResources.getString(R.string.stoppingtempbasal)));
|
||||
mSerialIOThread.sendMessage(new MsgSetTempBasalStop());
|
||||
waitMsec(500);
|
||||
}
|
||||
MainApp.bus().post(new EventPumpStatusChanged(MainApp.sResources.getString(R.string.settingtempbasal)));
|
||||
mSerialIOThread.sendMessage(new MsgSetTempBasalStart(percent, durationInHours));
|
||||
mSerialIOThread.sendMessage(new MsgStatusTempBasal());
|
||||
|
|
|
@ -408,15 +408,6 @@ public class DanaRKoreanPlugin implements PluginBase, PumpInterface, DanaRInterf
|
|||
if (Config.logPumpActions)
|
||||
log.debug("setTempBasalAbsolute: Correct temp basal already set (doLowTemp || doHighTemp)");
|
||||
return result;
|
||||
} else {
|
||||
if (Config.logPumpActions)
|
||||
log.debug("setTempBasalAbsolute: Stopping temp basal (doLowTemp || doHighTemp)");
|
||||
result = cancelRealTempBasal();
|
||||
// Check for proper result
|
||||
if (!result.success) {
|
||||
log.error("setTempBasalAbsolute: Failed to stop previous temp basal (doLowTemp || doHighTemp)");
|
||||
return result;
|
||||
}
|
||||
}
|
||||
}
|
||||
// Convert duration from minutes to hours
|
||||
|
|
|
@ -347,6 +347,11 @@ public class DanaRKoreanExecutionService extends Service {
|
|||
public boolean tempBasal(int percent, int durationInHours) {
|
||||
connect("tempBasal");
|
||||
if (!isConnected()) return false;
|
||||
if (danaRPump.isTempBasalInProgress) {
|
||||
MainApp.bus().post(new EventPumpStatusChanged(MainApp.sResources.getString(R.string.stoppingtempbasal)));
|
||||
mSerialIOThread.sendMessage(new MsgSetTempBasalStop());
|
||||
waitMsec(500);
|
||||
}
|
||||
MainApp.bus().post(new EventPumpStatusChanged(MainApp.sResources.getString(R.string.settingtempbasal)));
|
||||
mSerialIOThread.sendMessage(new MsgSetTempBasalStart(percent, durationInHours));
|
||||
mSerialIOThread.sendMessage(new MsgStatusTempBasal());
|
||||
|
|
Loading…
Reference in a new issue