add cancelTempBasal to setTempBasal if forced

This commit is contained in:
Timm Korte 2017-08-11 23:06:35 +02:00
parent 7839299530
commit 8db9cb8887
3 changed files with 47 additions and 34 deletions

View file

@ -399,7 +399,10 @@ 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) {
if (running.percentRate == percentRate) {
if (force == true) {
cancelTempBasal(true);
} else {
result.success = true;
result.percent = percentRate;
result.absolute = MainApp.getConfigBuilder().getTempBasalAbsoluteRateHistory();
@ -412,6 +415,7 @@ public class DanaRPlugin implements PluginBase, PumpInterface, DanaRInterface, C
return result;
}
}
}
// Convert duration from minutes to hours
if (Config.logPumpActions)
log.debug("setTempBasalAbsolute: Setting temp basal " + percentRate + "% for " + durationInMinutes + " mins (doLowTemp || doHighTemp)");

View file

@ -397,7 +397,10 @@ 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) {
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();
@ -410,6 +413,7 @@ public class DanaRKoreanPlugin implements PluginBase, PumpInterface, DanaRInterf
return result;
}
}
}
// Convert duration from minutes to hours
if (Config.logPumpActions)
log.debug("setTempBasalAbsolute: Setting temp basal " + percentRate + "% for " + durationInMinutes + " mins (doLowTemp || doHighTemp)");

View file

@ -364,7 +364,10 @@ 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) {
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();
@ -375,7 +378,9 @@ public class DanaRv2Plugin implements PluginBase, PumpInterface, DanaRInterface,
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)");