RS,Rv2: warn if carbs are not stored
This commit is contained in:
parent
3a30f73aa1
commit
54257ef6f0
5 changed files with 8 additions and 1 deletions
|
@ -235,6 +235,7 @@ class CommandQueueImplementation @Inject constructor(
|
||||||
(detailedBolusInfo.carbsTimestamp ?: detailedBolusInfo.timestamp) > dateUtil.now())
|
(detailedBolusInfo.carbsTimestamp ?: detailedBolusInfo.timestamp) > dateUtil.now())
|
||||||
) {
|
) {
|
||||||
carbsRunnable = Runnable {
|
carbsRunnable = Runnable {
|
||||||
|
aapsLogger.debug(LTag.PUMPQUEUE, "Going to store carbs")
|
||||||
detailedBolusInfo.carbs = originalCarbs
|
detailedBolusInfo.carbs = originalCarbs
|
||||||
disposable += repository.runTransactionForResult(detailedBolusInfo.insertCarbsTransaction())
|
disposable += repository.runTransactionForResult(detailedBolusInfo.insertCarbsTransaction())
|
||||||
.subscribeBy(
|
.subscribeBy(
|
||||||
|
|
|
@ -131,5 +131,6 @@
|
||||||
<string name="num1pin">1: (12 digits)</string>
|
<string name="num1pin">1: (12 digits)</string>
|
||||||
<string name="num2pin">2: (8 digits)</string>
|
<string name="num2pin">2: (8 digits)</string>
|
||||||
<string name="basal_bolus_step">Basal/bolus step</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>
|
</resources>
|
||||||
|
|
|
@ -348,6 +348,9 @@ public class DanaRv2ExecutionService extends AbstractDanaRExecutionService {
|
||||||
DanaPump.HistoryEntry.CARBS.getValue(), carbtime, carbs, 0);
|
DanaPump.HistoryEntry.CARBS.getValue(), carbtime, carbs, 0);
|
||||||
mSerialIOThread.sendMessage(msgSetHistoryEntry_v2);
|
mSerialIOThread.sendMessage(msgSetHistoryEntry_v2);
|
||||||
danaPump.lastHistoryFetched = Math.min(danaPump.lastHistoryFetched, carbtime - T.Companion.mins(1).msecs());
|
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();
|
final long bolusStart = System.currentTimeMillis();
|
||||||
|
|
|
@ -21,7 +21,7 @@ class DanaRSPacketAPSSetEventHistory(
|
||||||
init {
|
init {
|
||||||
opCode = BleEncryption.DANAR_PACKET__OPCODE__APS_SET_EVENT_HISTORY
|
opCode = BleEncryption.DANAR_PACKET__OPCODE__APS_SET_EVENT_HISTORY
|
||||||
if ((packetType == DanaPump.HistoryEntry.CARBS.value || packetType == DanaPump.HistoryEntry.BOLUS.value) && param1 <= 0) param1 = 0
|
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 {
|
override fun getRequestParams(): ByteArray {
|
||||||
|
|
|
@ -271,6 +271,8 @@ class DanaRSService : DaggerService() {
|
||||||
val msgSetHistoryEntryV2 = DanaRSPacketAPSSetEventHistory(injector, DanaPump.HistoryEntry.CARBS.value, carbTime, carbs, 0)
|
val msgSetHistoryEntryV2 = DanaRSPacketAPSSetEventHistory(injector, DanaPump.HistoryEntry.CARBS.value, carbTime, carbs, 0)
|
||||||
sendMessage(msgSetHistoryEntryV2)
|
sendMessage(msgSetHistoryEntryV2)
|
||||||
danaPump.lastHistoryFetched = min(danaPump.lastHistoryFetched, carbTime - T.mins(1).msecs())
|
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()
|
val bolusStart = System.currentTimeMillis()
|
||||||
if (insulin > 0) {
|
if (insulin > 0) {
|
||||||
|
|
Loading…
Reference in a new issue