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