Merge branch 'dev' of https://github.com/nightscout/AndroidAPS into dev
This commit is contained in:
commit
2b6e51cbfd
|
@ -574,7 +574,7 @@ class OverviewFragment : DaggerFragment(), View.OnClickListener, OnLongClickList
|
|||
OKDialog.showConfirmation(
|
||||
context,
|
||||
rh.gs(R.string.run_question, event.title),
|
||||
{ handler.post { automationPlugin.processEvent(event, true) } }
|
||||
{ handler.post { automationPlugin.processEvent(event) } }
|
||||
)
|
||||
}
|
||||
binding.buttonsLayout.userButtonsLayout.addView(it)
|
||||
|
|
|
@ -28,11 +28,6 @@
|
|||
android:key="@string/key_enable_pump_unreachable_alert"
|
||||
android:title="@string/enable_pump_unreachable_alert" />
|
||||
|
||||
<SwitchPreference
|
||||
android:defaultValue="true"
|
||||
android:key="@string/key_enable_carbs_required_alert_local"
|
||||
android:title="@string/enable_carbs_req_alert" />
|
||||
|
||||
<info.nightscout.androidaps.utils.textValidator.ValidatingEditTextPreference
|
||||
android:defaultValue="30"
|
||||
android:dependency="@string/key_enable_pump_unreachable_alert"
|
||||
|
@ -43,6 +38,11 @@
|
|||
validate:minNumber="30"
|
||||
validate:testType="numericRange" />
|
||||
|
||||
<SwitchPreference
|
||||
android:defaultValue="true"
|
||||
android:key="@string/key_enable_carbs_required_alert_local"
|
||||
android:title="@string/enable_carbs_req_alert" />
|
||||
|
||||
<SwitchPreference
|
||||
android:defaultValue="true"
|
||||
android:key="@string/key_raise_notifications_as_android_notifications"
|
||||
|
|
|
@ -186,18 +186,18 @@ class AutomationPlugin @Inject constructor(
|
|||
|
||||
@Synchronized
|
||||
private fun processActions() {
|
||||
var userEventsEnabled = config.APS
|
||||
if (config.APS) {
|
||||
if (loopPlugin.isSuspended || !(loopPlugin as PluginBase).isEnabled()) {
|
||||
aapsLogger.debug(LTag.AUTOMATION, "Loop deactivated")
|
||||
executionLog.add(rh.gs(R.string.loopisdisabled))
|
||||
userEventsEnabled = false
|
||||
}
|
||||
val enabled = constraintChecker.isAutomationEnabled()
|
||||
if (!enabled.value()) {
|
||||
executionLog.add(enabled.getMostLimitedReasons(aapsLogger))
|
||||
userEventsEnabled = false
|
||||
}
|
||||
var commonEventsEnabled = true
|
||||
if (loopPlugin.isSuspended || !(loopPlugin as PluginBase).isEnabled()) {
|
||||
aapsLogger.debug(LTag.AUTOMATION, "Loop deactivated")
|
||||
executionLog.add(rh.gs(R.string.loopisdisabled))
|
||||
rxBus.send(EventAutomationUpdateGui())
|
||||
commonEventsEnabled = false
|
||||
}
|
||||
val enabled = constraintChecker.isAutomationEnabled()
|
||||
if (!enabled.value()) {
|
||||
executionLog.add(enabled.getMostLimitedReasons(aapsLogger))
|
||||
rxBus.send(EventAutomationUpdateGui())
|
||||
commonEventsEnabled = false
|
||||
}
|
||||
|
||||
aapsLogger.debug(LTag.AUTOMATION, "processActions")
|
||||
|
@ -205,7 +205,7 @@ class AutomationPlugin @Inject constructor(
|
|||
while (iterator.hasNext()) {
|
||||
val event = iterator.next()
|
||||
if (event.isEnabled && !event.userAction && event.shouldRun())
|
||||
processEvent(event, userEventsEnabled)
|
||||
if (event.systemAction || commonEventsEnabled) processEvent(event)
|
||||
}
|
||||
// we cannot detect connected BT devices
|
||||
// so let's collect all connection/disconnections between 2 runs of processActions()
|
||||
|
@ -216,40 +216,38 @@ class AutomationPlugin @Inject constructor(
|
|||
storeToSP() // save last run time
|
||||
}
|
||||
|
||||
fun processEvent(event: AutomationEvent, userEventsEnabled: Boolean) {
|
||||
fun processEvent(event: AutomationEvent) {
|
||||
if (event.trigger.shouldRun() && event.getPreconditions().shouldRun()) {
|
||||
if (event.systemAction || userEventsEnabled) {
|
||||
val actions = event.actions
|
||||
for (action in actions) {
|
||||
action.title = event.title
|
||||
if (action.isValid())
|
||||
action.doAction(object : Callback() {
|
||||
override fun run() {
|
||||
val sb = StringBuilder()
|
||||
sb.append(dateUtil.timeString(dateUtil.now()))
|
||||
sb.append(" ")
|
||||
sb.append(if (result.success) "☺" else "▼")
|
||||
sb.append(" <b>")
|
||||
sb.append(event.title)
|
||||
sb.append(":</b> ")
|
||||
sb.append(action.shortDescription())
|
||||
sb.append(": ")
|
||||
sb.append(result.comment)
|
||||
executionLog.add(sb.toString())
|
||||
aapsLogger.debug(LTag.AUTOMATION, "Executed: $sb")
|
||||
rxBus.send(EventAutomationUpdateGui())
|
||||
}
|
||||
})
|
||||
else {
|
||||
executionLog.add("Invalid action: ${action.shortDescription()}")
|
||||
aapsLogger.debug(LTag.AUTOMATION, "Invalid action: ${action.shortDescription()}")
|
||||
rxBus.send(EventAutomationUpdateGui())
|
||||
}
|
||||
val actions = event.actions
|
||||
for (action in actions) {
|
||||
action.title = event.title
|
||||
if (action.isValid())
|
||||
action.doAction(object : Callback() {
|
||||
override fun run() {
|
||||
val sb = StringBuilder()
|
||||
.append(dateUtil.timeString(dateUtil.now()))
|
||||
.append(" ")
|
||||
.append(if (result.success) "☺" else "▼")
|
||||
.append(" <b>")
|
||||
.append(event.title)
|
||||
.append(":</b> ")
|
||||
.append(action.shortDescription())
|
||||
.append(": ")
|
||||
.append(result.comment)
|
||||
executionLog.add(sb.toString())
|
||||
aapsLogger.debug(LTag.AUTOMATION, "Executed: $sb")
|
||||
rxBus.send(EventAutomationUpdateGui())
|
||||
}
|
||||
})
|
||||
else {
|
||||
executionLog.add("Invalid action: ${action.shortDescription()}")
|
||||
aapsLogger.debug(LTag.AUTOMATION, "Invalid action: ${action.shortDescription()}")
|
||||
rxBus.send(EventAutomationUpdateGui())
|
||||
}
|
||||
SystemClock.sleep(1100)
|
||||
event.lastRun = dateUtil.now()
|
||||
if (event.autoRemove) automationEvents.remove(event)
|
||||
}
|
||||
SystemClock.sleep(1100)
|
||||
event.lastRun = dateUtil.now()
|
||||
if (event.autoRemove) automationEvents.remove(event)
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -306,7 +304,7 @@ class AutomationPlugin @Inject constructor(
|
|||
val iterator: MutableIterator<AutomationEvent> = automationEvents.iterator()
|
||||
while (iterator.hasNext()) {
|
||||
val event = iterator.next()
|
||||
if (event.userAction) list.add(event)
|
||||
if (event.userAction && event.isEnabled) list.add(event)
|
||||
}
|
||||
return list
|
||||
}
|
||||
|
|
|
@ -164,7 +164,7 @@ class ProfileViewerDialog : DaggerDialogFragment() {
|
|||
binding.date.text = date
|
||||
binding.ic.text = it.getIcList(rh, dateUtil)
|
||||
binding.isf.text = it.getIsfList(rh, dateUtil)
|
||||
binding.basal.text = it.getBasalList(rh, dateUtil)
|
||||
binding.basal.text = "∑ " + rh.gs(R.string.formatinsulinunits, it.baseBasalSum()) + "\n" + it.getBasalList(rh, dateUtil)
|
||||
binding.target.text = it.getTargetList(rh, dateUtil)
|
||||
binding.basalGraph.show(it)
|
||||
|
||||
|
|
|
@ -409,6 +409,23 @@
|
|||
<string name="value_out_of_hard_limits">»%1$s« %2$.2f sınırların dışında</string>
|
||||
<string name="basal_value">Bazal değer</string>
|
||||
<string name="nsclient_version_does_not_match">NSClient sürümü AndroidAPS ile eşleşmiyor. Lütfen güncelle.</string>
|
||||
<!-- readStatus reasons -->
|
||||
<string name="keepalive_status_outdated" comment="26 characters max for translation">KA.. Durum güncel değil.</string>
|
||||
<string name="keepalive_basal_outdated" comment="26 characters max for translation">KA.. Bazal güncel değil.</string>
|
||||
<string name="sms" comment="26 characters max for translation">SMS</string>
|
||||
<string name="clicked_connect_to_pump" comment="26 characters max for translation">Pompaya bağlan tıklandı</string>
|
||||
<string name="pump_driver_changed" comment="26 characters max for translation">Pompa sürücüsü değişti.</string>
|
||||
<string name="pump_driver_change" comment="26 characters max for translation">Pompa sürücüsü değişimi.</string>
|
||||
<string name="device_changed" comment="26 characters max for translation">Cihaz değişti</string>
|
||||
<string name="clicked_refresh" comment="26 characters max for translation">Yenileme tıklandı</string>
|
||||
<string name="scheduled_status_refresh" comment="26 characters max for translation">Zamanlanmış Durum Yenileme</string>
|
||||
<string name="unconfirmed_command" comment="26 characters max for translation">Onaylanmamış komut</string>
|
||||
<string name="requested_by_user" comment="26 characters max for translation">Kullanıcı talebi</string>
|
||||
<string name="user_request" comment="26 characters max for translation">Kullanıcı talebi</string>
|
||||
<string name="bolus_ok" comment="26 characters max for translation">Bolus OK</string>
|
||||
<string name="pump_paired" comment="26 characters max for translation">Pompa eşleştirildi</string>
|
||||
<string name="insight_refresh_button" comment="26 characters max for translation">Insight Yenileme Düğmesi</string>
|
||||
<string name="read_status" comment="10 characters max for READSTATUS translation">OKUMADURUMU %1$s</string>
|
||||
<plurals name="days">
|
||||
<item quantity="one">%1$d gün</item>
|
||||
<item quantity="other">%1$d gün</item>
|
||||
|
|
|
@ -12,8 +12,10 @@ import info.nightscout.androidaps.plugins.pump.omnipod.dash.driver.pod.definitio
|
|||
import info.nightscout.androidaps.plugins.pump.omnipod.dash.driver.pod.definition.PodConstants.Companion.POD_EXPIRATION_ALERT_HOURS
|
||||
import info.nightscout.androidaps.plugins.pump.omnipod.dash.driver.pod.definition.PodConstants.Companion.POD_EXPIRATION_ALERT_HOURS_DURATION
|
||||
import info.nightscout.androidaps.plugins.pump.omnipod.dash.driver.pod.definition.PodConstants.Companion.POD_EXPIRATION_IMMINENT_ALERT_HOURS
|
||||
import info.nightscout.androidaps.plugins.pump.omnipod.dash.driver.pod.definition.PodConstants.Companion.POD_PULSE_BOLUS_UNITS
|
||||
import info.nightscout.androidaps.plugins.pump.omnipod.dash.driver.pod.response.*
|
||||
import info.nightscout.androidaps.plugins.pump.omnipod.dash.driver.pod.state.OmnipodDashPodStateManager
|
||||
import info.nightscout.androidaps.utils.Round
|
||||
import info.nightscout.androidaps.utils.rx.AapsSchedulers
|
||||
import io.reactivex.Observable
|
||||
import io.reactivex.functions.Action
|
||||
|
@ -281,7 +283,7 @@ class OmnipodDashManagerImpl @Inject constructor(
|
|||
.setUniqueId(podStateManager.uniqueId!!.toInt())
|
||||
.setSequenceNumber(podStateManager.messageSequenceNumber)
|
||||
.setNonce(NONCE)
|
||||
.setNumberOfUnits(podStateManager.firstPrimeBolusVolume!! * PodConstants.POD_PULSE_BOLUS_UNITS)
|
||||
.setNumberOfUnits(Round.roundTo(podStateManager.firstPrimeBolusVolume!! * PodConstants.POD_PULSE_BOLUS_UNITS, POD_PULSE_BOLUS_UNITS))
|
||||
.setDelayBetweenPulsesInEighthSeconds(podStateManager.primePulseRate!!.toByte())
|
||||
.setProgramReminder(ProgramReminder(atStart = false, atEnd = false, atInterval = 0))
|
||||
.build(),
|
||||
|
@ -383,7 +385,7 @@ class OmnipodDashManagerImpl @Inject constructor(
|
|||
)
|
||||
observables.add(
|
||||
observeSendProgramBolusCommand(
|
||||
podStateManager.secondPrimeBolusVolume!! * PodConstants.POD_PULSE_BOLUS_UNITS,
|
||||
Round.roundTo(podStateManager.secondPrimeBolusVolume!! * PodConstants.POD_PULSE_BOLUS_UNITS, PodConstants.POD_PULSE_BOLUS_UNITS),
|
||||
podStateManager.primePulseRate!!.toByte(),
|
||||
confirmationBeeps = false,
|
||||
completionBeeps = false
|
||||
|
|
|
@ -16,6 +16,7 @@ import info.nightscout.androidaps.plugins.pump.omnipod.dash.driver.pod.response.
|
|||
import info.nightscout.androidaps.plugins.pump.omnipod.dash.driver.pod.response.DefaultStatusResponse
|
||||
import info.nightscout.androidaps.plugins.pump.omnipod.dash.driver.pod.response.SetUniqueIdResponse
|
||||
import info.nightscout.androidaps.plugins.pump.omnipod.dash.driver.pod.response.VersionResponse
|
||||
import info.nightscout.androidaps.utils.Round
|
||||
import info.nightscout.androidaps.utils.sharedPreferences.SP
|
||||
import io.reactivex.Completable
|
||||
import io.reactivex.Maybe
|
||||
|
@ -340,7 +341,7 @@ class OmnipodDashPodStateManagerImpl @Inject constructor(
|
|||
|
||||
private fun updateLastBolusFromResponse(bolusPulsesRemaining: Short) {
|
||||
podState.lastBolus?.run {
|
||||
val remainingUnits = bolusPulsesRemaining.toDouble() * PodConstants.POD_PULSE_BOLUS_UNITS
|
||||
val remainingUnits = Round.roundTo(bolusPulsesRemaining * PodConstants.POD_PULSE_BOLUS_UNITS, PodConstants.POD_PULSE_BOLUS_UNITS)
|
||||
this.bolusUnitsRemaining = remainingUnits
|
||||
if (remainingUnits == 0.0) {
|
||||
this.deliveryComplete = true
|
||||
|
|
|
@ -85,10 +85,11 @@ public class RileyLinkBLE {
|
|||
aapsLogger.debug(LTag.PUMPBTCOMM, "Response Count is " + ByteUtil.shortHexString(characteristic.getValue()));
|
||||
}
|
||||
}
|
||||
if (radioResponseCountNotified != null) {
|
||||
radioResponseCountNotified.run();
|
||||
if (characteristic.getUuid().equals(UUID.fromString(GattAttributes.CHARA_RADIO_RESPONSE_COUNT))) {
|
||||
if (radioResponseCountNotified != null) {
|
||||
radioResponseCountNotified.run();
|
||||
}
|
||||
}
|
||||
|
||||
orangeLink.onCharacteristicChanged(characteristic);
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue