Add dev and engineering mode

This commit is contained in:
Philoul 2022-05-05 23:23:38 +02:00
parent 3d02c7f57c
commit cfd3ffc6ed
2 changed files with 15 additions and 7 deletions

View file

@ -36,6 +36,7 @@ import info.nightscout.androidaps.utils.FabricPrivacy
import info.nightscout.androidaps.utils.MidnightTime import info.nightscout.androidaps.utils.MidnightTime
import info.nightscout.androidaps.utils.Round import info.nightscout.androidaps.utils.Round
import info.nightscout.androidaps.utils.alertDialogs.OKDialog.showConfirmation import info.nightscout.androidaps.utils.alertDialogs.OKDialog.showConfirmation
import info.nightscout.androidaps.utils.buildHelper.BuildHelper
import info.nightscout.shared.SafeParse import info.nightscout.shared.SafeParse
import info.nightscout.shared.sharedPreferences.SP import info.nightscout.shared.sharedPreferences.SP
import io.reactivex.rxjava3.android.schedulers.AndroidSchedulers import io.reactivex.rxjava3.android.schedulers.AndroidSchedulers
@ -59,6 +60,7 @@ class AutotuneFragment : DaggerFragment() {
@Inject lateinit var uel: UserEntryLogger @Inject lateinit var uel: UserEntryLogger
@Inject lateinit var rh: ResourceHelper @Inject lateinit var rh: ResourceHelper
@Inject lateinit var rxBus: RxBus @Inject lateinit var rxBus: RxBus
@Inject lateinit var buildHelper: BuildHelper
@Inject lateinit var injector: HasAndroidInjector @Inject lateinit var injector: HasAndroidInjector
private var disposable: CompositeDisposable = CompositeDisposable() private var disposable: CompositeDisposable = CompositeDisposable()
@ -301,16 +303,20 @@ class AutotuneFragment : DaggerFragment() {
if (autotunePlugin.calculationRunning) { if (autotunePlugin.calculationRunning) {
binding.tuneWarning.text = rh.gs(R.string.autotune_warning_during_run) binding.tuneWarning.text = rh.gs(R.string.autotune_warning_during_run)
} else if (autotunePlugin.lastRunSuccess) { } else if (autotunePlugin.lastRunSuccess) {
binding.autotuneCopylocal.visibility = View.VISIBLE if (buildHelper.isEngineeringMode()) {
binding.autotuneUpdateProfile.visibility = autotunePlugin.updateButtonVisibility binding.autotuneCopylocal.visibility = View.VISIBLE
binding.autotuneRevertProfile.visibility = if (autotunePlugin.updateButtonVisibility == View.VISIBLE) View.GONE else View.VISIBLE binding.autotuneUpdateProfile.visibility = autotunePlugin.updateButtonVisibility
binding.autotuneProfileswitch.visibility = View.VISIBLE 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.autotuneCompare.visibility = View.VISIBLE
binding.tuneWarning.text = rh.gs(R.string.autotune_warning_after_run) } else if (buildHelper.isDev()) {
} else {
binding.autotuneRun.visibility = View.VISIBLE binding.autotuneRun.visibility = View.VISIBLE
binding.autotuneCheckInputProfile.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) binding.tuneLastrun.text = dateUtil.dateAndTimeString(autotunePlugin.lastRun)
showResults() showResults()
} }

View file

@ -566,6 +566,8 @@
<string name="autotune_last_run">Last run :</string> <string name="autotune_last_run">Last run :</string>
<string name="autotune_warning">Warning :</string> <string name="autotune_warning">Warning :</string>
<string name="autotune_select_profile">Select profile to tune</string> <string name="autotune_select_profile">Select profile to tune</string>
<string name="autotune_dev_warning">You can currently only run Autotune on dev builds of AAPS</string>
<string name="autotune_engineering_mode_warning">Copy or Activate Tuned profile is only available in engineering mode</string>
<string name="autotune_ic_warning">Autotune works with only one IC value, your profile has %1$d values. Average value is %2$.2fg/U</string> <string name="autotune_ic_warning">Autotune works with only one IC value, your profile has %1$d values. Average value is %2$.2fg/U</string>
<string name="autotune_isf_warning">Autotune works with only one ISF value, your profile has %1$d values. Average value is %2$.1f%3$s/U</string> <string name="autotune_isf_warning">Autotune works with only one ISF value, your profile has %1$d values. Average value is %2$.1f%3$s/U</string>
<string name="autotune_error">Error in input data, try to run again autotune or reduce the number of days</string> <string name="autotune_error">Error in input data, try to run again autotune or reduce the number of days</string>