fix warnings

This commit is contained in:
Andrei Vereha 2021-09-21 21:17:34 +02:00
parent 2dee60b4e0
commit 8184500467

View file

@ -100,22 +100,23 @@ class ProgramBasalCommand private constructor(
} }
override fun buildCommand(): ProgramBasalCommand { override fun buildCommand(): ProgramBasalCommand {
requireNotNull(basalProgram) { "basalProgram can not be null" } val program = requireNotNull(basalProgram) { "basalProgram can not be null" }
requireNotNull(programReminder) { "programReminder can not be null" } val reminder = requireNotNull(programReminder) { "programReminder can not be null" }
requireNotNull(currentTime) { "currentTime can not be null" } val time = requireNotNull(currentTime) { "currentTime can not be null" }
val pulsesPerSlot = ProgramBasalUtil.mapBasalProgramToPulsesPerSlot(basalProgram!!)
val currentSlot = ProgramBasalUtil.calculateCurrentSlot(pulsesPerSlot, currentTime) val pulsesPerSlot = ProgramBasalUtil.mapBasalProgramToPulsesPerSlot(program)
val currentSlot = ProgramBasalUtil.calculateCurrentSlot(pulsesPerSlot, time)
val checksum = ProgramBasalUtil.calculateChecksum(pulsesPerSlot, currentSlot) val checksum = ProgramBasalUtil.calculateChecksum(pulsesPerSlot, currentSlot)
val longInsulinProgramElements: List<BasalInsulinProgramElement> = val longInsulinProgramElements: List<BasalInsulinProgramElement> =
mapTenthPulsesPerSlotToLongInsulinProgramElements( mapTenthPulsesPerSlotToLongInsulinProgramElements(
ProgramBasalUtil.mapBasalProgramToTenthPulsesPerSlot(basalProgram!!) ProgramBasalUtil.mapBasalProgramToTenthPulsesPerSlot(program)
) )
val shortInsulinProgramElements = ProgramBasalUtil.mapPulsesPerSlotToShortInsulinProgramElements( val shortInsulinProgramElements = ProgramBasalUtil.mapPulsesPerSlotToShortInsulinProgramElements(
pulsesPerSlot pulsesPerSlot
) )
val currentBasalInsulinProgramElement = ProgramBasalUtil.calculateCurrentLongInsulinProgramElement( val currentBasalInsulinProgramElement = ProgramBasalUtil.calculateCurrentLongInsulinProgramElement(
longInsulinProgramElements, longInsulinProgramElements,
currentTime time
) )
val interlockCommand = ProgramInsulinCommand( val interlockCommand = ProgramInsulinCommand(
uniqueId!!, sequenceNumber!!, multiCommandFlag, nonce!!, uniqueId!!, sequenceNumber!!, multiCommandFlag, nonce!!,
@ -128,7 +129,7 @@ class ProgramBasalCommand private constructor(
sequenceNumber!!, sequenceNumber!!,
multiCommandFlag, multiCommandFlag,
longInsulinProgramElements, longInsulinProgramElements,
programReminder!!, reminder,
currentBasalInsulinProgramElement.index, currentBasalInsulinProgramElement.index,
currentBasalInsulinProgramElement.remainingTenthPulses, currentBasalInsulinProgramElement.remainingTenthPulses,
currentBasalInsulinProgramElement.delayUntilNextTenthPulseInUsec currentBasalInsulinProgramElement.delayUntilNextTenthPulseInUsec