From cfd3ffc6edf6f62e798817ad960452a715eb7c30 Mon Sep 17 00:00:00 2001 From: Philoul Date: Thu, 5 May 2022 23:23:38 +0200 Subject: [PATCH] Add dev and engineering mode --- .../general/autotune/AutotuneFragment.kt | 20 ++++++++++++------- core/src/main/res/values/strings.xml | 2 ++ 2 files changed, 15 insertions(+), 7 deletions(-) diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/general/autotune/AutotuneFragment.kt b/app/src/main/java/info/nightscout/androidaps/plugins/general/autotune/AutotuneFragment.kt index 8aa85e33ca..5cbce91b0a 100644 --- a/app/src/main/java/info/nightscout/androidaps/plugins/general/autotune/AutotuneFragment.kt +++ b/app/src/main/java/info/nightscout/androidaps/plugins/general/autotune/AutotuneFragment.kt @@ -36,6 +36,7 @@ import info.nightscout.androidaps.utils.FabricPrivacy import info.nightscout.androidaps.utils.MidnightTime import info.nightscout.androidaps.utils.Round import info.nightscout.androidaps.utils.alertDialogs.OKDialog.showConfirmation +import info.nightscout.androidaps.utils.buildHelper.BuildHelper import info.nightscout.shared.SafeParse import info.nightscout.shared.sharedPreferences.SP import io.reactivex.rxjava3.android.schedulers.AndroidSchedulers @@ -59,6 +60,7 @@ class AutotuneFragment : DaggerFragment() { @Inject lateinit var uel: UserEntryLogger @Inject lateinit var rh: ResourceHelper @Inject lateinit var rxBus: RxBus + @Inject lateinit var buildHelper: BuildHelper @Inject lateinit var injector: HasAndroidInjector private var disposable: CompositeDisposable = CompositeDisposable() @@ -301,16 +303,20 @@ class AutotuneFragment : DaggerFragment() { if (autotunePlugin.calculationRunning) { binding.tuneWarning.text = rh.gs(R.string.autotune_warning_during_run) } else if (autotunePlugin.lastRunSuccess) { - binding.autotuneCopylocal.visibility = View.VISIBLE - binding.autotuneUpdateProfile.visibility = autotunePlugin.updateButtonVisibility - binding.autotuneRevertProfile.visibility = if (autotunePlugin.updateButtonVisibility == View.VISIBLE) View.GONE else View.VISIBLE - binding.autotuneProfileswitch.visibility = View.VISIBLE + if (buildHelper.isEngineeringMode()) { + binding.autotuneCopylocal.visibility = View.VISIBLE + binding.autotuneUpdateProfile.visibility = autotunePlugin.updateButtonVisibility + binding.autotuneRevertProfile.visibility = if (autotunePlugin.updateButtonVisibility == View.VISIBLE) View.GONE else View.VISIBLE + binding.autotuneProfileswitch.visibility = View.VISIBLE + binding.tuneWarning.text = rh.gs(R.string.autotune_warning_after_run) + } else + binding.tuneWarning.text = rh.gs(R.string.autotune_engineering_mode_warning) binding.autotuneCompare.visibility = View.VISIBLE - binding.tuneWarning.text = rh.gs(R.string.autotune_warning_after_run) - } else { + } else if (buildHelper.isDev()) { binding.autotuneRun.visibility = View.VISIBLE binding.autotuneCheckInputProfile.visibility = View.VISIBLE - } + } else + binding.tuneWarning.text = rh.gs(R.string.autotune_dev_warning) binding.tuneLastrun.text = dateUtil.dateAndTimeString(autotunePlugin.lastRun) showResults() } diff --git a/core/src/main/res/values/strings.xml b/core/src/main/res/values/strings.xml index 9e7c537e62..eed67a2158 100644 --- a/core/src/main/res/values/strings.xml +++ b/core/src/main/res/values/strings.xml @@ -566,6 +566,8 @@ Last run : Warning : Select profile to tune + You can currently only run Autotune on dev builds of AAPS + Copy or Activate Tuned profile is only available in engineering mode Autotune works with only one IC value, your profile has %1$d values. Average value is %2$.2fg/U Autotune works with only one ISF value, your profile has %1$d values. Average value is %2$.1f%3$s/U Error in input data, try to run again autotune or reduce the number of days