Merge pull request #8 from nightscout/dev

nightscrout:dev to dev
This commit is contained in:
rICTx-T1D 2021-01-04 20:45:34 +01:00 committed by GitHub
commit 022df5e70d
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
18 changed files with 85 additions and 81 deletions

View file

@ -151,7 +151,7 @@ var determine_basal = function determine_basal(glucose_status, currenttemp, iob_
}
}
//cherry pick from oref upstream dev cb8e94990301277fb1016c778b4e9efa55a6edbc
if (bg <= 10 || bg === 38 || noise >= 3 || minAgo > 12 || minAgo < -5 || ( bg > 60 && glucose_status.delta == 0 && glucose_status.short_avgdelta > -1 && glucose_status.short_avgdelta < 1 && glucose_status.long_avgdelta > -1 && glucose_status.long_avgdelta < 1 ) ) {
if (bg <= 10 || bg === 38 || noise >= 3 || minAgo > 12 || minAgo < -5 || ( bg > 60 && glucose_status.delta == 0 && glucose_status.short_avgdelta > -1 && glucose_status.short_avgdelta < 1 && glucose_status.long_avgdelta > -1 && glucose_status.long_avgdelta < 1 ) && !isSaveCgmSource ) {
if (currenttemp.rate > basal) { // high temp is running
rT.reason += ". Replacing high temp basal of "+currenttemp.rate+" with neutral temp of "+basal;
rT.deliverAt = deliverAt;

View file

@ -237,18 +237,21 @@ class LoopDialog : DaggerDialogFragment() {
val profile = profileFunction.getProfile() ?: return true
when (v.id) {
R.id.overview_closeloop -> {
aapsLogger.debug("USER ENTRY: CLOSED LOOP MODE")
sp.putString(R.string.key_aps_mode, "closed")
rxBus.send(EventPreferenceChange(resourceHelper.gs(R.string.closedloop)))
return true
}
R.id.overview_lgsloop -> {
aapsLogger.debug("USER ENTRY: LGS LOOP MODE")
sp.putString(R.string.key_aps_mode, "lgs")
rxBus.send(EventPreferenceChange(resourceHelper.gs(R.string.lowglucosesuspend)))
return true
}
R.id.overview_openloop -> {
aapsLogger.debug("USER ENTRY: OPEN LOOP MODE")
sp.putString(R.string.key_aps_mode, "open")
rxBus.send(EventPreferenceChange(resourceHelper.gs(R.string.lowglucosesuspend)))
return true

View file

@ -19,7 +19,6 @@ import java.nio.charset.StandardCharsets;
import javax.annotation.Nullable;
import javax.inject.Inject;
import info.nightscout.androidaps.plugins.general.openhumans.OpenHumansUploader;
import dagger.android.HasAndroidInjector;
import info.nightscout.androidaps.Constants;
import info.nightscout.androidaps.R;
@ -28,13 +27,14 @@ import info.nightscout.androidaps.data.MealData;
import info.nightscout.androidaps.data.Profile;
import info.nightscout.androidaps.db.TemporaryBasal;
import info.nightscout.androidaps.interfaces.ActivePluginProvider;
import info.nightscout.androidaps.interfaces.ProfileFunction;
import info.nightscout.androidaps.interfaces.PumpInterface;
import info.nightscout.androidaps.logging.AAPSLogger;
import info.nightscout.androidaps.logging.LTag;
import info.nightscout.androidaps.plugins.aps.logger.LoggerCallback;
import info.nightscout.androidaps.plugins.aps.loop.ScriptReader;
import info.nightscout.androidaps.plugins.configBuilder.ConstraintChecker;
import info.nightscout.androidaps.interfaces.ProfileFunction;
import info.nightscout.androidaps.plugins.general.openhumans.OpenHumansUploader;
import info.nightscout.androidaps.plugins.iob.iobCobCalculator.GlucoseStatus;
import info.nightscout.androidaps.plugins.iob.iobCobCalculator.IobCobCalculatorPlugin;
import info.nightscout.androidaps.plugins.treatments.TreatmentsPlugin;
@ -73,10 +73,6 @@ public class DetermineBasalAdapterSMBJS {
private String storedGlucoseStatus = null;
private String storedProfile = null;
private String storedMeal_data = null;
private String storedAutosens_data = null;
private String storedMicroBolusAllowed = null;
private String storedSMBAlwaysAllowed = null;
private String storedCurrentTime = null;
private String scriptDebug = "";
@ -102,13 +98,13 @@ public class DetermineBasalAdapterSMBJS {
aapsLogger.debug(LTag.APS, "Profile: " + (storedProfile = mProfile.toString()));
aapsLogger.debug(LTag.APS, "Meal data: " + (storedMeal_data = mMealData.toString()));
if (mAutosensData != null)
aapsLogger.debug(LTag.APS, "Autosens data: " + (storedAutosens_data = mAutosensData.toString()));
aapsLogger.debug(LTag.APS, "Autosens data: " + mAutosensData.toString());
else
aapsLogger.debug(LTag.APS, "Autosens data: " + (storedAutosens_data = "undefined"));
aapsLogger.debug(LTag.APS, "Autosens data: " + "undefined");
aapsLogger.debug(LTag.APS, "Reservoir data: " + "undefined");
aapsLogger.debug(LTag.APS, "MicroBolusAllowed: " + (storedMicroBolusAllowed = "" + mMicrobolusAllowed));
aapsLogger.debug(LTag.APS, "SMBAlwaysAllowed: " + (storedSMBAlwaysAllowed = "" + mSMBAlwaysAllowed));
aapsLogger.debug(LTag.APS, "CurrentTime: " + (storedCurrentTime = "" + mCurrentTime));
aapsLogger.debug(LTag.APS, "MicroBolusAllowed: " + mMicrobolusAllowed);
aapsLogger.debug(LTag.APS, "SMBAlwaysAllowed: " + mSMBAlwaysAllowed);
aapsLogger.debug(LTag.APS, "CurrentTime: " + mCurrentTime);
aapsLogger.debug(LTag.APS, "isSaveCgmSource: " + mIsSaveCgmSource);
@ -151,9 +147,10 @@ public class DetermineBasalAdapterSMBJS {
makeParam(mAutosensData, rhino, scope),
makeParam(mMealData, rhino, scope),
setTempBasalFunctionsObj,
new Boolean(mMicrobolusAllowed),
Boolean.valueOf(mMicrobolusAllowed),
makeParam(null, rhino, scope), // reservoir data as undefined
new Long(mCurrentTime)
Long.valueOf(mCurrentTime),
Boolean.valueOf(mIsSaveCgmSource)
};
@ -213,14 +210,6 @@ public class DetermineBasalAdapterSMBJS {
return storedMeal_data;
}
String getAutosensDataParam() {
return storedAutosens_data;
}
String getMicroBolusAllowedParam() {
return storedMicroBolusAllowed;
}
String getScriptDebug() {
return scriptDebug;
}
@ -243,7 +232,6 @@ public class DetermineBasalAdapterSMBJS {
boolean isSaveCgmSource
) throws JSONException {
String units = profile.getUnits();
PumpInterface pump = activePluginProvider.getActivePump();
Double pumpbolusstep = pump.getPumpDescription().bolusStep;
mProfile = new JSONObject();
@ -364,14 +352,12 @@ public class DetermineBasalAdapterSMBJS {
if (jsonObject == null) return Undefined.instance;
Object param = NativeJSON.parse(rhino, scope, jsonObject.toString(), (context, scriptable, scriptable1, objects) -> objects[1]);
return param;
return NativeJSON.parse(rhino, scope, jsonObject.toString(), (context, scriptable, scriptable1, objects) -> objects[1]);
}
private Object makeParamArray(JSONArray jsonArray, Context rhino, Scriptable scope) {
//Object param = NativeJSON.parse(rhino, scope, "{myarray: " + jsonArray.toString() + " }", new Callable() {
Object param = NativeJSON.parse(rhino, scope, jsonArray.toString(), (context, scriptable, scriptable1, objects) -> objects[1]);
return param;
return NativeJSON.parse(rhino, scope, jsonArray.toString(), (context, scriptable, scriptable1, objects) -> objects[1]);
}
private String readFile(String filename) throws IOException {

View file

@ -70,7 +70,7 @@ class EditEventDialog : DialogFragmentWithDate() {
binding.okcancel.ok.visibility = (!event.readOnly).toVisibility()
binding.inputEventTitle.setText(event.title)
binding.inputEventTitle.isFocusable = false
binding.inputEventTitle.isFocusable = !event.readOnly
binding.triggerDescription.text = event.trigger.friendlyDescription()
binding.editTrigger.visibility = (!event.readOnly).toVisibility()

View file

@ -289,12 +289,12 @@ class OverviewFragment : DaggerFragment(), View.OnClickListener, OnLongClickList
R.id.overview_temptarget -> protectionCheck.queryProtection(activity, ProtectionCheck.Protection.BOLUS, UIRunnable { TempTargetDialog().show(childFragmentManager, "Overview") })
R.id.overview_activeprofile -> {
val args = Bundle()
args.putLong("time", DateUtil.now())
args.putInt("mode", ProfileViewerDialog.Mode.RUNNING_PROFILE.ordinal)
val pvd = ProfileViewerDialog()
pvd.arguments = args
pvd.show(childFragmentManager, "ProfileViewDialog")
ProfileViewerDialog().also { pvd ->
pvd.arguments = Bundle().also {
it.putLong("time", DateUtil.now())
it.putInt("mode", ProfileViewerDialog.Mode.RUNNING_PROFILE.ordinal)
}
}.show(childFragmentManager, "ProfileViewDialog")
}
R.id.overview_cgmbutton -> {
@ -329,6 +329,7 @@ class OverviewFragment : DaggerFragment(), View.OnClickListener, OnLongClickList
val lastRun = loopPlugin.lastRun
loopPlugin.invoke("Accept temp button", false)
if (lastRun?.lastAPSRun != null && lastRun.constraintsProcessed?.isChangeRequested == true) {
protectionCheck.queryProtection(activity, ProtectionCheck.Protection.BOLUS, UIRunnable {
OKDialog.showConfirmation(activity, resourceHelper.gs(R.string.tempbasal_label), lastRun.constraintsProcessed?.toSpanned()
?: "".toSpanned(), {
aapsLogger.debug("USER ENTRY: ACCEPT TEMP BASAL")
@ -337,16 +338,17 @@ class OverviewFragment : DaggerFragment(), View.OnClickListener, OnLongClickList
actionStringHandler.handleInitiate("cancelChangeRequest")
loopPlugin.acceptChangeRequest()
})
})
}
}
}
R.id.overview_apsmode -> {
val args = Bundle()
args.putInt("showOkCancel", 1) // 1-> true
val pvd = LoopDialog()
pvd.arguments = args
pvd.show(childFragmentManager, "Overview")
protectionCheck.queryProtection(activity, ProtectionCheck.Protection.BOLUS, UIRunnable {
LoopDialog().also { dialog ->
dialog.arguments = Bundle().also { it.putInt("showOkCancel", 1) }
}.show(childFragmentManager, "Overview")
})
}
}
}
@ -374,11 +376,13 @@ class OverviewFragment : DaggerFragment(), View.OnClickListener, OnLongClickList
}
R.id.overview_apsmode -> {
val args = Bundle()
args.putInt("showOkCancel", 0) // 0-> false
val pvd = LoopDialog()
pvd.arguments = args
pvd.show(childFragmentManager, "Overview")
activity?.let { activity ->
protectionCheck.queryProtection(activity, ProtectionCheck.Protection.BOLUS, UIRunnable {
LoopDialog().also { dialog ->
dialog.arguments = Bundle().also { it.putInt("showOkCancel", 0) }
}.show(childFragmentManager, "Overview")
})
}
}
R.id.overview_temptarget -> v.performClick()

View file

@ -162,18 +162,20 @@
android:layout_height="wrap_content"
android:layout_gravity="center_horizontal"
android:layout_marginBottom="-4dp"
android:visibility="gone"
app:srcCompat="@drawable/ic_loop_closed" />
<TextView
android:id="@+id/overview_apsmode_text"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:gravity="center_horizontal"
android:paddingTop="3dp"
android:paddingBottom="3dp"
android:text="Open Loop"
android:textAppearance="@style/TextAppearance.AppCompat.Medium"
android:textStyle="bold" />
android:textStyle="bold"
android:visibility="gone" />
</LinearLayout>
<LinearLayout
@ -183,6 +185,7 @@
android:layout_marginTop="5dp"
android:gravity="center_horizontal"
android:orientation="vertical"
android:visibility="gone"
app:layout_constraintBottom_toBottomOf="@+id/overview_bg"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toEndOf="@id/overview_apsmode_llayout"

View file

@ -1,14 +1,12 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<string name="alert_r7_description"><![CDATA[Amount: <b>%1$d%%</b>\nDuration: <b>%2$s h</b>]]></string>
<string name="alert_w31_description"><![CDATA[Cartridge content: <b>%1$s U</b>]]></string>
<string name="alert_w32_description">Change battery.</string>
<string name="alert_w33_description">Set time/date.</string>
<string name="alert_w34_description">Contact Accu-Chek support.</string>
<string name="alert_w36_description"><![CDATA[Amount: <b>%1$d%%</b><br/>Duration: <b>%2$s h</b>]]></string>
<string name="alert_w38_description"><![CDATA[Programmed: <b>%1$s U</b><br/>Delivered: <b>%2$s U</b>]]></string>
<string name="alert_m20_description">Insert cartridge.</string>
<string name="alert_m21_description">Change cartridge.</string>
<string name="alert_m22_description">Change battery.</string>
@ -20,7 +18,6 @@
<string name="alert_m28_description">Check pump status.</string>
<string name="alert_m29_description">Set battery type.</string>
<string name="alert_m30_description">Set cartridge type.</string>
<string name="alert_e6_description">Change battery and cartridge.</string>
<string name="alert_e10_description">Change cartridge.</string>
<string name="alert_e13_description">Change language.</string>

View file

@ -1425,7 +1425,7 @@
<string name="bolusadvisormessage">You have high glycemia. Instead of eating now it\'s recommended to wait for better glycemia. Do you want to do a correction bolus now and remind you when it\'s time to eat? In this case no carbs will be recorded and you must use wizard again when we remind you.</string>
<string name="key_usebolusadvisor" translatable="false">use_bolus_advisor</string>
<string name="enablebolusadvisor">Enable bolus advisor</string>
<string name="enablebolusadvisor_summary">Use reminder to start eating instead of wizard during high glycemia</string>
<string name="enablebolusadvisor_summary">Use reminder to start eating later instead of wizard result during high glycemia ("pre-bolus")</string>
<string name="time_to_eat">Time to eat!\nRun Bolus wizard and do calculation again.</string>
<string name="timetoeat">Time to eat</string>

View file

@ -4,8 +4,8 @@
xmlns:validate="http://schemas.android.com/apk/res-auto">
<PreferenceCategory
app:initialExpandedChildrenCount="0"
android:title="@string/openapssmb">
android:title="@string/openapssmb"
app:initialExpandedChildrenCount="0">
<info.nightscout.androidaps.utils.textValidator.ValidatingEditTextPreference
android:defaultValue="1"
@ -88,10 +88,15 @@
<info.nightscout.androidaps.utils.textValidator.ValidatingEditTextPreference
android:defaultValue="30"
android:digits="0123456789"
android:entries="@array/smbMaxMinutes"
android:entryValues="@array/smbMaxMinutes"
android:inputType="number"
android:key="@string/key_smbmaxminutes"
android:title="@string/smbmaxminutes_summary" />
android:title="@string/smbmaxminutes_summary"
validate:maxNumber="120"
validate:minNumber="15"
validate:testType="numericRange" />
<info.nightscout.androidaps.utils.textValidator.ValidatingEditTextPreference
android:defaultValue="30"
@ -119,14 +124,12 @@
android:defaultValue="true"
android:key="@string/key_sensitivity_raises_target"
android:summary="@string/sensitivity_raises_target_summary"
android:title="@string/sensitivity_raises_target_title"
/>
android:title="@string/sensitivity_raises_target_title" />
<SwitchPreference
android:defaultValue="false"
android:key="@string/key_resistance_lowers_target"
android:summary="@string/resistance_lowers_target_summary"
android:title="@string/resistance_lowers_target_title"
/>
android:title="@string/resistance_lowers_target_title" />
<!-- TODO AS-FIX -->
<SwitchPreference
android:defaultValue="false"
@ -144,16 +147,16 @@
android:title="@string/low_temptarget_lowers_sensitivity_title" />
<info.nightscout.androidaps.utils.textValidator.ValidatingEditTextPreference
android:key="@string/key_carbsReqThreshold"
android:title="@string/carbsReqThreshold"
android:summary="@string/carbsReqThreshold_summary"
android:defaultValue="1"
android:dialogMessage="@string/carbsReqThreshold_summary"
android:digits="0123456789"
android:inputType="number"
android:key="@string/key_carbsReqThreshold"
android:maxLines="20"
android:selectAllOnFocus="true"
android:singleLine="true"
android:summary="@string/carbsReqThreshold_summary"
android:title="@string/carbsReqThreshold"
validate:maxNumber="10"
validate:minNumber="1"
validate:testType="numericRange" />

View file

@ -277,6 +277,7 @@ class DanaRSService : DaggerService() {
danaPump.bolusStopped = true
danaPump.bolusStopForced = true
aapsLogger.debug(LTag.PUMPCOMM, "Communication stopped")
bleComm.disconnect("Communication stopped")
}
}
}

View file

@ -102,11 +102,13 @@ class OmnipodOverviewFragment : DaggerFragment() {
omnipod_overview_button_pod_management.setOnClickListener {
if (omnipodPumpPlugin.rileyLinkService?.verifyConfiguration() == true) {
activity?.let { activity ->
context?.let { context ->
protectionCheck.queryProtection(
activity, ProtectionCheck.Protection.PREFERENCES,
UIRunnable(Runnable { startActivity(Intent(context, PodManagementActivity::class.java)) })
UIRunnable { startActivity(Intent(context, PodManagementActivity::class.java)) }
)
}
}
} else {
displayNotConfiguredDialog()
}
@ -514,10 +516,10 @@ class OmnipodOverviewFragment : DaggerFragment() {
private fun displayNotConfiguredDialog() {
context?.let {
UIRunnable(Runnable {
UIRunnable {
OKDialog.show(it, resourceHelper.gs(R.string.omnipod_warning),
resourceHelper.gs(R.string.omnipod_error_operation_not_possible_no_configuration), null)
}).run()
}.run()
}
}
@ -534,9 +536,9 @@ class OmnipodOverviewFragment : DaggerFragment() {
private fun displayOkDialog(title: String, message: String) {
context?.let {
UIRunnable(Runnable {
UIRunnable {
OKDialog.show(it, title, message, null)
}).run()
}.run()
}
}

View file

@ -65,6 +65,11 @@ public class InitializePumpManagerTask extends ServiceTask {
lastGoodFrequency = rileyLinkServiceData.lastGoodFrequency;
}
/* FIXME this can apparently crash:
Fatal Exception: java.lang.ClassCastException
info.nightscout.androidaps.plugins.pump.virtual.VirtualPumpPlugin
cannot be cast to info.nightscout.androidaps.plugins.pump.common.hw.rileylink.defs.RileyLinkPumpDevice
*/
RileyLinkCommunicationManager<?> rileyLinkCommunicationManager = ((RileyLinkPumpDevice) activePlugin.getActivePump()).getRileyLinkService().getDeviceCommunicationManager();
if (activePlugin.getActivePump().manufacturer() == ManufacturerType.Medtronic) {

Binary file not shown.

After

Width:  |  Height:  |  Size: 354 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 354 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 137 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 137 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 42 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 69 KiB