- added fake method TBR Percent. If pecent is 0, it calls absolute methods with 0, if not, it calculates value, writes log and then starts absolute method

This commit is contained in:
Andy Rozman 2019-08-25 14:48:00 +01:00
parent d57d847bf7
commit d4d1110d68

View file

@ -1062,6 +1062,19 @@ public class MedtronicPumpPlugin extends PumpPluginAbstract implements PumpInter
}
@Override
public PumpEnactResult setTempBasalPercent(Integer percent, Integer durationInMinutes, Profile profile,
boolean enforceNew) {
if (percent==0) {
return setTempBasalAbsolute(0.0d, durationInMinutes, profile, enforceNew);
} else {
Double absoluteValue = profile.getBasal() * (percent /100.0d);
LOG.warn("setTempBasalPercent [MedtronicPumpPlugin] - You are trying to use setTempBasalPercent with percent other then 0% (%d). This will start setTempBasalAbsolute, with calculated value (%.2f). Result might not be 100% correct.", percent, absoluteValue);
return setTempBasalAbsolute(absoluteValue, durationInMinutes, profile, enforceNew);
}
}
private void finishAction(String overviewKey) {
if (overviewKey != null)