This commit is contained in:
Milos Kozak 2021-04-11 22:03:22 +02:00
parent 5a4733dbdc
commit aadeeeebbf
3 changed files with 25 additions and 9 deletions

View file

@ -2,19 +2,24 @@
<dictionary name="project-dictionary"> <dictionary name="project-dictionary">
<words> <words>
<w>aaps</w> <w>aaps</w>
<w>acked</w>
<w>actionstring</w> <w>actionstring</w>
<w>allowednumbers</w> <w>allowednumbers</w>
<w>androidaps</w> <w>androidaps</w>
<w>autosens</w> <w>autosens</w>
<w>autosensdata</w> <w>autosensdata</w>
<w>autosense</w>
<w>bage</w> <w>bage</w>
<w>basaliob</w>
<w>basals</w> <w>basals</w>
<w>bgcheck</w> <w>bgcheck</w>
<w>bgsource</w>
<w>bolusing</w> <w>bolusing</w>
<w>carb</w> <w>carb</w>
<w>carbs</w> <w>carbs</w>
<w>carbsreq</w> <w>carbsreq</w>
<w>careportal</w> <w>careportal</w>
<w>cellnovo</w>
<w>crashlytics</w> <w>crashlytics</w>
<w>danar</w> <w>danar</w>
<w>danars</w> <w>danars</w>
@ -23,6 +28,7 @@
<w>dexcom</w> <w>dexcom</w>
<w>dexdrip</w> <w>dexdrip</w>
<w>enteredby</w> <w>enteredby</w>
<w>enteredinsulin</w>
<w>eveningoutpost</w> <w>eveningoutpost</w>
<w>eversense</w> <w>eversense</w>
<w>extendedbolus</w> <w>extendedbolus</w>
@ -32,12 +38,15 @@
<w>gson</w> <w>gson</w>
<w>hmac</w> <w>hmac</w>
<w>iage</w> <w>iage</w>
<w>insulet</w>
<w>iobtotal</w> <w>iobtotal</w>
<w>libre</w>
<w>listdelimiter</w> <w>listdelimiter</w>
<w>localprofile</w> <w>localprofile</w>
<w>medtronic</w> <w>medtronic</w>
<w>mgdl</w> <w>mgdl</w>
<w>mmol</w> <w>mmol</w>
<w>multiwave</w>
<w>netinsulin</w> <w>netinsulin</w>
<w>netratio</w> <w>netratio</w>
<w>nightscout</w> <w>nightscout</w>
@ -45,6 +54,7 @@
<w>nsclient</w> <w>nsclient</w>
<w>okcancel</w> <w>okcancel</w>
<w>omnipod</w> <w>omnipod</w>
<w>openaps</w>
<w>oref</w> <w>oref</w>
<w>passcode</w> <w>passcode</w>
<w>poctech</w> <w>poctech</w>
@ -56,7 +66,9 @@
<w>refresheventsfromnightscout</w> <w>refresheventsfromnightscout</w>
<w>rileylink</w> <w>rileylink</w>
<w>roboelectric</w> <w>roboelectric</w>
<w>sitechange</w>
<w>smscommunicator</w> <w>smscommunicator</w>
<w>sooil</w>
<w>soundid</w> <w>soundid</w>
<w>splitted</w> <w>splitted</w>
<w>superbolus</w> <w>superbolus</w>
@ -73,6 +85,9 @@
<w>uart</w> <w>uart</w>
<w>wizzardpage</w> <w>wizzardpage</w>
<w>xdrip</w> <w>xdrip</w>
<w>ypso</w>
<w>ypsomed</w>
<w>ypsopump</w>
</words> </words>
</dictionary> </dictionary>
</component> </component>

View file

@ -44,6 +44,7 @@ import javax.inject.Singleton
import kotlin.math.abs import kotlin.math.abs
import kotlin.math.floor import kotlin.math.floor
import kotlin.math.max import kotlin.math.max
import kotlin.math.min
import kotlin.math.roundToLong import kotlin.math.roundToLong
@Singleton @Singleton
@ -380,16 +381,16 @@ open class IobCobCalculatorPlugin @Inject constructor(
bucketedData = bData bucketedData = bData
} }
fun oldestDataAvailable(): Long { private fun oldestDataAvailable(): Long {
var oldestTime = System.currentTimeMillis() var oldestTime = System.currentTimeMillis()
val oldestTempBasal = repository.getOldestTemporaryBasalRecord() val oldestTempBasal = repository.getOldestTemporaryBasalRecord()
if (oldestTempBasal != null) oldestTime = Math.min(oldestTime, oldestTempBasal.timestamp) if (oldestTempBasal != null) oldestTime = min(oldestTime, oldestTempBasal.timestamp)
val oldestExtendedBolus = repository.getOldestExtendedBolusRecord() val oldestExtendedBolus = repository.getOldestExtendedBolusRecord()
if (oldestExtendedBolus != null) oldestTime = Math.min(oldestTime, oldestExtendedBolus.timestamp) if (oldestExtendedBolus != null) oldestTime = min(oldestTime, oldestExtendedBolus.timestamp)
val oldestBolus = repository.getOldestBolusRecord() val oldestBolus = repository.getOldestBolusRecord()
if (oldestBolus != null) oldestTime = Math.min(oldestTime, oldestBolus.timestamp) if (oldestBolus != null) oldestTime = min(oldestTime, oldestBolus.timestamp)
val oldestCarbs = repository.getOldestCarbsRecord() val oldestCarbs = repository.getOldestCarbsRecord()
if (oldestCarbs != null) oldestTime = Math.min(oldestTime, oldestCarbs.timestamp) if (oldestCarbs != null) oldestTime = min(oldestTime, oldestCarbs.timestamp)
oldestTime -= 15 * 60 * 1000L // allow 15 min before oldestTime -= 15 * 60 * 1000L // allow 15 min before
return oldestTime return oldestTime
} }

View file

@ -137,12 +137,12 @@ class DanaRKoreanPlugin @Inject constructor(
if (!result.success) result.comment(resourceHelper.gs(R.string.boluserrorcode, detailedBolusInfo.insulin, t.insulin, danaPump.bolusStartErrorCode)) else result.comment(R.string.ok) if (!result.success) result.comment(resourceHelper.gs(R.string.boluserrorcode, detailedBolusInfo.insulin, t.insulin, danaPump.bolusStartErrorCode)) else result.comment(R.string.ok)
aapsLogger.debug(LTag.PUMP, "deliverTreatment: OK. Asked: " + detailedBolusInfo.insulin + " Delivered: " + result.bolusDelivered) aapsLogger.debug(LTag.PUMP, "deliverTreatment: OK. Asked: " + detailedBolusInfo.insulin + " Delivered: " + result.bolusDelivered)
detailedBolusInfo.insulin = t.insulin detailedBolusInfo.insulin = t.insulin
detailedBolusInfo.timestamp = dateUtil._now() detailedBolusInfo.timestamp = dateUtil.now()
if (detailedBolusInfo.insulin > 0) pumpSync.syncBolusWithPumpId( if (detailedBolusInfo.insulin > 0) pumpSync.syncBolusWithPumpId(
detailedBolusInfo.timestamp, detailedBolusInfo.timestamp,
detailedBolusInfo.insulin, detailedBolusInfo.insulin,
detailedBolusInfo.bolusType, detailedBolusInfo.bolusType,
dateUtil._now(), dateUtil.now(),
PumpType.DANA_R_KOREAN, PumpType.DANA_R_KOREAN,
serialNumber() serialNumber()
) )
@ -285,8 +285,8 @@ class DanaRKoreanPlugin @Inject constructor(
sExecutionService.tempBasalStop() sExecutionService.tempBasalStop()
if (!danaPump.isTempBasalInProgress) { if (!danaPump.isTempBasalInProgress) {
pumpSync.syncStopTemporaryBasalWithPumpId( pumpSync.syncStopTemporaryBasalWithPumpId(
dateUtil._now(), dateUtil.now(),
dateUtil._now(), dateUtil.now(),
pumpDescription.pumpType, pumpDescription.pumpType,
serialNumber() serialNumber()
) )