Add dev and engineeering mode in Automation
This commit is contained in:
parent
ee1d3cab4a
commit
6465995b26
1 changed files with 6 additions and 3 deletions
|
@ -40,18 +40,21 @@ class ActionRunAutotune(injector: HasAndroidInjector) : Action(injector) {
|
||||||
@DrawableRes override fun icon(): Int = R.drawable.ic_actions_profileswitch
|
@DrawableRes override fun icon(): Int = R.drawable.ic_actions_profileswitch
|
||||||
|
|
||||||
override fun doAction(callback: Callback) {
|
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
|
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
|
var message = if (autoSwitch) R.string.autotune_run_with_autoswitch else R.string.autotune_run_without_autoswitch
|
||||||
Thread {
|
Thread {
|
||||||
|
if (buildHelper.isDev()) {
|
||||||
autotunePlugin.atLog("[Automation] Run Autotune $profileName, ${daysBack.value} days, Autoswitch $autoSwitch")
|
autotunePlugin.atLog("[Automation] Run Autotune $profileName, ${daysBack.value} days, Autoswitch $autoSwitch")
|
||||||
autotunePlugin.aapsAutotune(daysBack.value, autoSwitch, profileName)
|
autotunePlugin.aapsAutotune(daysBack.value, autoSwitch, profileName)
|
||||||
if (!autotunePlugin.lastRunSuccess) {
|
if (!autotunePlugin.lastRunSuccess) {
|
||||||
message = R.string.autotune_run_with_error
|
message = R.string.autotune_run_with_error
|
||||||
aapsLogger.error(LTag.AUTOMATION, "Error during Autotune Run")
|
aapsLogger.error(LTag.AUTOMATION, "Error during Autotune Run")
|
||||||
}
|
}
|
||||||
callback.result(PumpEnactResult(injector).success(autotunePlugin.lastRunSuccess).comment(message))?.run()
|
} else
|
||||||
}.start()
|
message = R.string.autotune_dev_warning
|
||||||
|
callback.result(PumpEnactResult(injector).success(autotunePlugin.lastRunSuccess).comment(message))?.run()
|
||||||
|
}.start()
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue