From 6465995b264e7386bb48b94ccf4d524f9406b94b Mon Sep 17 00:00:00 2001 From: Philoul Date: Fri, 6 May 2022 00:10:10 +0200 Subject: [PATCH] Add dev and engineeering mode in Automation --- .../general/automation/actions/ActionRunAutotune.kt | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/automation/src/main/java/info/nightscout/androidaps/plugins/general/automation/actions/ActionRunAutotune.kt b/automation/src/main/java/info/nightscout/androidaps/plugins/general/automation/actions/ActionRunAutotune.kt index f68767189a..0b2ddf4354 100644 --- a/automation/src/main/java/info/nightscout/androidaps/plugins/general/automation/actions/ActionRunAutotune.kt +++ b/automation/src/main/java/info/nightscout/androidaps/plugins/general/automation/actions/ActionRunAutotune.kt @@ -40,18 +40,21 @@ class ActionRunAutotune(injector: HasAndroidInjector) : Action(injector) { @DrawableRes override fun icon(): Int = R.drawable.ic_actions_profileswitch override fun doAction(callback: Callback) { - val autoSwitch = sp.getBoolean(R.string.key_autotune_auto, false) + val autoSwitch = sp.getBoolean(R.string.key_autotune_auto, false) && buildHelper.isEngineeringMode() val profileName = if (inputProfileName.value == rh.gs(R.string.active)) "" else inputProfileName.value var message = if (autoSwitch) R.string.autotune_run_with_autoswitch else R.string.autotune_run_without_autoswitch Thread { + if (buildHelper.isDev()) { autotunePlugin.atLog("[Automation] Run Autotune $profileName, ${daysBack.value} days, Autoswitch $autoSwitch") autotunePlugin.aapsAutotune(daysBack.value, autoSwitch, profileName) if (!autotunePlugin.lastRunSuccess) { message = R.string.autotune_run_with_error aapsLogger.error(LTag.AUTOMATION, "Error during Autotune Run") } - callback.result(PumpEnactResult(injector).success(autotunePlugin.lastRunSuccess).comment(message))?.run() - }.start() + } else + message = R.string.autotune_dev_warning + callback.result(PumpEnactResult(injector).success(autotunePlugin.lastRunSuccess).comment(message))?.run() + }.start() return }