RS,Rv2: warn if carbs are not stored

This commit is contained in:
Milos Kozak 2022-01-06 17:34:04 +01:00
parent 3a30f73aa1
commit 54257ef6f0
5 changed files with 8 additions and 1 deletions

View file

@ -235,6 +235,7 @@ class CommandQueueImplementation @Inject constructor(
(detailedBolusInfo.carbsTimestamp ?: detailedBolusInfo.timestamp) > dateUtil.now())
) {
carbsRunnable = Runnable {
aapsLogger.debug(LTag.PUMPQUEUE, "Going to store carbs")
detailedBolusInfo.carbs = originalCarbs
disposable += repository.runTransactionForResult(detailedBolusInfo.insertCarbsTransaction())
.subscribeBy(

View file

@ -131,5 +131,6 @@
<string name="num1pin">1: (12 digits)</string>
<string name="num2pin">2: (8 digits)</string>
<string name="basal_bolus_step">Basal/bolus step</string>
<string name="carbs_store_error">Carbs were probably not stored correctly. Manually check and store again if needed.</string>
</resources>

View file

@ -348,6 +348,9 @@ public class DanaRv2ExecutionService extends AbstractDanaRExecutionService {
DanaPump.HistoryEntry.CARBS.getValue(), carbtime, carbs, 0);
mSerialIOThread.sendMessage(msgSetHistoryEntry_v2);
danaPump.lastHistoryFetched = Math.min(danaPump.lastHistoryFetched, carbtime - T.Companion.mins(1).msecs());
if (!msgSetHistoryEntry_v2.isReceived() || msgSetHistoryEntry_v2.failed)
ErrorHelperActivity.Companion.runAlarm(context, rh.gs(R.string.carbs_store_error)
, rh.gs(R.string.error), R.raw.boluserror);
}
final long bolusStart = System.currentTimeMillis();

View file

@ -21,7 +21,7 @@ class DanaRSPacketAPSSetEventHistory(
init {
opCode = BleEncryption.DANAR_PACKET__OPCODE__APS_SET_EVENT_HISTORY
if ((packetType == DanaPump.HistoryEntry.CARBS.value || packetType == DanaPump.HistoryEntry.BOLUS.value) && param1 <= 0) param1 = 0
aapsLogger.debug(LTag.PUMPCOMM, "Set history entry: " + dateUtil.dateAndTimeString(time) + " type: " + packetType + " param1: " + param1 + " param2: " + param2)
aapsLogger.debug(LTag.PUMPCOMM, "Set history entry: " + dateUtil.dateAndTimeAndSecondsString(time) + " type: " + packetType + " param1: " + param1 + " param2: " + param2)
}
override fun getRequestParams(): ByteArray {

View file

@ -271,6 +271,8 @@ class DanaRSService : DaggerService() {
val msgSetHistoryEntryV2 = DanaRSPacketAPSSetEventHistory(injector, DanaPump.HistoryEntry.CARBS.value, carbTime, carbs, 0)
sendMessage(msgSetHistoryEntryV2)
danaPump.lastHistoryFetched = min(danaPump.lastHistoryFetched, carbTime - T.mins(1).msecs())
if (!msgSetHistoryEntryV2.isReceived || msgSetHistoryEntryV2.failed)
ErrorHelperActivity.runAlarm(context, rh.gs(R.string.carbs_store_error), rh.gs(R.string.error), R.raw.boluserror)
}
val bolusStart = System.currentTimeMillis()
if (insulin > 0) {