add cancelTempBasal to setTempBasal if forced
This commit is contained in:
parent
7839299530
commit
8db9cb8887
|
@ -399,17 +399,21 @@ public class DanaRPlugin implements PluginBase, PumpInterface, DanaRInterface, C
|
|||
TemporaryBasal running = MainApp.getConfigBuilder().getRealTempBasalFromHistory(System.currentTimeMillis());
|
||||
if (Config.logPumpActions)
|
||||
log.debug("setTempBasalAbsolute: currently running: " + running.toString());
|
||||
if (running.percentRate == percentRate && force == false) {
|
||||
result.success = true;
|
||||
result.percent = percentRate;
|
||||
result.absolute = MainApp.getConfigBuilder().getTempBasalAbsoluteRateHistory();
|
||||
result.enacted = false;
|
||||
result.duration = ((Double) MainApp.getConfigBuilder().getTempBasalRemainingMinutesFromHistory()).intValue();
|
||||
result.isPercent = true;
|
||||
result.isTempCancel = false;
|
||||
if (Config.logPumpActions)
|
||||
log.debug("setTempBasalAbsolute: Correct temp basal already set (doLowTemp || doHighTemp)");
|
||||
return result;
|
||||
if (running.percentRate == percentRate) {
|
||||
if (force == true) {
|
||||
cancelTempBasal(true);
|
||||
} else {
|
||||
result.success = true;
|
||||
result.percent = percentRate;
|
||||
result.absolute = MainApp.getConfigBuilder().getTempBasalAbsoluteRateHistory();
|
||||
result.enacted = false;
|
||||
result.duration = ((Double) MainApp.getConfigBuilder().getTempBasalRemainingMinutesFromHistory()).intValue();
|
||||
result.isPercent = true;
|
||||
result.isTempCancel = false;
|
||||
if (Config.logPumpActions)
|
||||
log.debug("setTempBasalAbsolute: Correct temp basal already set (doLowTemp || doHighTemp)");
|
||||
return result;
|
||||
}
|
||||
}
|
||||
}
|
||||
// Convert duration from minutes to hours
|
||||
|
|
|
@ -397,17 +397,21 @@ public class DanaRKoreanPlugin implements PluginBase, PumpInterface, DanaRInterf
|
|||
// Check if some temp is already in progress
|
||||
if (MainApp.getConfigBuilder().isInHistoryRealTempBasalInProgress()) {
|
||||
// Correct basal already set ?
|
||||
if (MainApp.getConfigBuilder().getRealTempBasalFromHistory(System.currentTimeMillis()).percentRate == percentRate && force == false) {
|
||||
result.success = true;
|
||||
result.percent = percentRate;
|
||||
result.absolute = MainApp.getConfigBuilder().getTempBasalAbsoluteRateHistory();
|
||||
result.enacted = false;
|
||||
result.duration = ((Double) MainApp.getConfigBuilder().getTempBasalRemainingMinutesFromHistory()).intValue();
|
||||
result.isPercent = true;
|
||||
result.isTempCancel = false;
|
||||
if (Config.logPumpActions)
|
||||
log.debug("setTempBasalAbsolute: Correct temp basal already set (doLowTemp || doHighTemp)");
|
||||
return result;
|
||||
if (MainApp.getConfigBuilder().getRealTempBasalFromHistory(System.currentTimeMillis()).percentRate == percentRate) {
|
||||
if (force == true) {
|
||||
cancelTempBasal(true);
|
||||
} else {
|
||||
result.success = true;
|
||||
result.percent = percentRate;
|
||||
result.absolute = MainApp.getConfigBuilder().getTempBasalAbsoluteRateHistory();
|
||||
result.enacted = false;
|
||||
result.duration = ((Double) MainApp.getConfigBuilder().getTempBasalRemainingMinutesFromHistory()).intValue();
|
||||
result.isPercent = true;
|
||||
result.isTempCancel = false;
|
||||
if (Config.logPumpActions)
|
||||
log.debug("setTempBasalAbsolute: Correct temp basal already set (doLowTemp || doHighTemp)");
|
||||
return result;
|
||||
}
|
||||
}
|
||||
}
|
||||
// Convert duration from minutes to hours
|
||||
|
|
|
@ -364,18 +364,23 @@ public class DanaRv2Plugin implements PluginBase, PumpInterface, DanaRInterface,
|
|||
// Check if some temp is already in progress
|
||||
if (MainApp.getConfigBuilder().isTempBasalInProgress()) {
|
||||
// Correct basal already set ?
|
||||
if (MainApp.getConfigBuilder().getTempBasalFromHistory(System.currentTimeMillis()).percentRate == percentRate && force == false) {
|
||||
result.success = true;
|
||||
result.percent = percentRate;
|
||||
result.absolute = MainApp.getConfigBuilder().getTempBasalAbsoluteRateHistory();
|
||||
result.enacted = false;
|
||||
result.duration = ((Double) MainApp.getConfigBuilder().getTempBasalRemainingMinutesFromHistory()).intValue();
|
||||
result.isPercent = true;
|
||||
result.isTempCancel = false;
|
||||
if (Config.logPumpActions)
|
||||
log.debug("setTempBasalAbsolute: Correct temp basal already set (doLowTemp || doHighTemp)");
|
||||
return result;
|
||||
} }
|
||||
if (MainApp.getConfigBuilder().getTempBasalFromHistory(System.currentTimeMillis()).percentRate == percentRate) {
|
||||
if (force == true) {
|
||||
cancelTempBasal(true);
|
||||
} else {
|
||||
result.success = true;
|
||||
result.percent = percentRate;
|
||||
result.absolute = MainApp.getConfigBuilder().getTempBasalAbsoluteRateHistory();
|
||||
result.enacted = false;
|
||||
result.duration = ((Double) MainApp.getConfigBuilder().getTempBasalRemainingMinutesFromHistory()).intValue();
|
||||
result.isPercent = true;
|
||||
result.isTempCancel = false;
|
||||
if (Config.logPumpActions)
|
||||
log.debug("setTempBasalAbsolute: Correct temp basal already set (doLowTemp || doHighTemp)");
|
||||
return result;
|
||||
}
|
||||
}
|
||||
}
|
||||
// Convert duration from minutes to hours
|
||||
if (Config.logPumpActions)
|
||||
log.debug("setTempBasalAbsolute: Setting temp basal " + percentRate + "% for " + durationInMinutes + " mins (doLowTemp || doHighTemp)");
|
||||
|
|
Loading…
Reference in a new issue