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,7 +399,10 @@ 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) {
|
||||||
|
if (force == true) {
|
||||||
|
cancelTempBasal(true);
|
||||||
|
} else {
|
||||||
result.success = true;
|
result.success = true;
|
||||||
result.percent = percentRate;
|
result.percent = percentRate;
|
||||||
result.absolute = MainApp.getConfigBuilder().getTempBasalAbsoluteRateHistory();
|
result.absolute = MainApp.getConfigBuilder().getTempBasalAbsoluteRateHistory();
|
||||||
|
@ -412,6 +415,7 @@ public class DanaRPlugin implements PluginBase, PumpInterface, DanaRInterface, C
|
||||||
return result;
|
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)");
|
||||||
|
|
|
@ -397,7 +397,10 @@ 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) {
|
||||||
|
if (force == true) {
|
||||||
|
cancelTempBasal(true);
|
||||||
|
} else {
|
||||||
result.success = true;
|
result.success = true;
|
||||||
result.percent = percentRate;
|
result.percent = percentRate;
|
||||||
result.absolute = MainApp.getConfigBuilder().getTempBasalAbsoluteRateHistory();
|
result.absolute = MainApp.getConfigBuilder().getTempBasalAbsoluteRateHistory();
|
||||||
|
@ -410,6 +413,7 @@ public class DanaRKoreanPlugin implements PluginBase, PumpInterface, DanaRInterf
|
||||||
return result;
|
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)");
|
||||||
|
|
|
@ -364,7 +364,10 @@ 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) {
|
||||||
|
if (force == true) {
|
||||||
|
cancelTempBasal(true);
|
||||||
|
} else {
|
||||||
result.success = true;
|
result.success = true;
|
||||||
result.percent = percentRate;
|
result.percent = percentRate;
|
||||||
result.absolute = MainApp.getConfigBuilder().getTempBasalAbsoluteRateHistory();
|
result.absolute = MainApp.getConfigBuilder().getTempBasalAbsoluteRateHistory();
|
||||||
|
@ -375,7 +378,9 @@ public class DanaRv2Plugin implements PluginBase, PumpInterface, DanaRInterface,
|
||||||
if (Config.logPumpActions)
|
if (Config.logPumpActions)
|
||||||
log.debug("setTempBasalAbsolute: Correct temp basal already set (doLowTemp || doHighTemp)");
|
log.debug("setTempBasalAbsolute: Correct temp basal already set (doLowTemp || doHighTemp)");
|
||||||
return result;
|
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