Insight fix issues

This commit is contained in:
Tebbe Ubben 2020-03-01 09:28:57 +01:00
parent ca000a5f33
commit 35096288e2

View file

@ -507,7 +507,7 @@ public class LocalInsightPlugin extends PluginBase implements PumpInterface, Con
nextValue = profile.getBasalValues()[i + 1];
if (profileBlock.getDuration() * 60 != (nextValue != null ? nextValue.timeAsSeconds : 24 * 60 * 60) - basalValue.timeAsSeconds)
return false;
if (Math.abs(profileBlock.getBasalAmount() - basalValue.value) > (basalValue.value > 5 ? 0.05 : 0.005))
if (Math.abs(profileBlock.getBasalAmount() - basalValue.value) > (basalValue.value > 5 ? 0.051 : 0.0051))
return false;
}
return true;
@ -571,6 +571,15 @@ public class LocalInsightPlugin extends PluginBase implements PumpInterface, Con
detailedBolusInfo.date = insightBolusID.timestamp;
detailedBolusInfo.source = Source.PUMP;
detailedBolusInfo.pumpId = insightBolusID.id;
if (detailedBolusInfo.carbs > 0 && detailedBolusInfo.carbTime != 0) {
DetailedBolusInfo carbInfo = new DetailedBolusInfo();
carbInfo.carbs = detailedBolusInfo.carbs;
carbInfo.date = detailedBolusInfo.date + detailedBolusInfo.carbTime * 60L * 1000L;
carbInfo.source = Source.USER;
TreatmentsPlugin.getPlugin().addToHistoryTreatment(carbInfo, false);
detailedBolusInfo.carbTime = 0;
detailedBolusInfo.carbs = 0;
}
TreatmentsPlugin.getPlugin().addToHistoryTreatment(detailedBolusInfo, true);
while (true) {
synchronized ($bolusLock) {