Enabled only in dev and Engineering mode
This commit is contained in:
parent
a12e1079b1
commit
4b2fda3278
5 changed files with 12 additions and 19 deletions
|
@ -36,7 +36,6 @@ 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
|
||||||
|
@ -60,7 +59,6 @@ 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()
|
||||||
|
@ -305,21 +303,17 @@ class AutotuneFragment : DaggerFragment() {
|
||||||
binding.tuneWarning.text = rh.gs(R.string.autotune_warning_during_run)
|
binding.tuneWarning.text = rh.gs(R.string.autotune_warning_during_run)
|
||||||
}
|
}
|
||||||
autotunePlugin.lastRunSuccess -> {
|
autotunePlugin.lastRunSuccess -> {
|
||||||
if (buildHelper.isEngineeringMode()) {
|
|
||||||
binding.autotuneCopylocal.visibility = View.VISIBLE
|
binding.autotuneCopylocal.visibility = View.VISIBLE
|
||||||
binding.autotuneUpdateProfile.visibility = autotunePlugin.updateButtonVisibility
|
binding.autotuneUpdateProfile.visibility = autotunePlugin.updateButtonVisibility
|
||||||
binding.autotuneRevertProfile.visibility = if (autotunePlugin.updateButtonVisibility == View.VISIBLE) View.GONE else View.VISIBLE
|
binding.autotuneRevertProfile.visibility = if (autotunePlugin.updateButtonVisibility == View.VISIBLE) View.GONE else View.VISIBLE
|
||||||
binding.autotuneProfileswitch.visibility = View.VISIBLE
|
binding.autotuneProfileswitch.visibility = View.VISIBLE
|
||||||
binding.tuneWarning.text = rh.gs(R.string.autotune_warning_after_run)
|
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
|
||||||
}
|
}
|
||||||
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()
|
||||||
|
|
|
@ -18,6 +18,7 @@ import info.nightscout.androidaps.plugins.profile.local.events.EventLocalProfile
|
||||||
import info.nightscout.androidaps.utils.DateUtil
|
import info.nightscout.androidaps.utils.DateUtil
|
||||||
import info.nightscout.androidaps.utils.MidnightTime
|
import info.nightscout.androidaps.utils.MidnightTime
|
||||||
import info.nightscout.androidaps.utils.T
|
import info.nightscout.androidaps.utils.T
|
||||||
|
import info.nightscout.androidaps.utils.buildHelper.BuildHelper
|
||||||
import info.nightscout.shared.logging.AAPSLogger
|
import info.nightscout.shared.logging.AAPSLogger
|
||||||
import info.nightscout.shared.sharedPreferences.SP
|
import info.nightscout.shared.sharedPreferences.SP
|
||||||
import org.json.JSONException
|
import org.json.JSONException
|
||||||
|
@ -48,6 +49,7 @@ class AutotunePlugin @Inject constructor(
|
||||||
private val autotuneIob: AutotuneIob,
|
private val autotuneIob: AutotuneIob,
|
||||||
private val autotunePrep: AutotunePrep,
|
private val autotunePrep: AutotunePrep,
|
||||||
private val autotuneCore: AutotuneCore,
|
private val autotuneCore: AutotuneCore,
|
||||||
|
private val buildHelper:BuildHelper,
|
||||||
private val uel: UserEntryLogger,
|
private val uel: UserEntryLogger,
|
||||||
aapsLogger: AAPSLogger
|
aapsLogger: AAPSLogger
|
||||||
) : PluginBase(PluginDescription()
|
) : PluginBase(PluginDescription()
|
||||||
|
@ -295,6 +297,8 @@ class AutotunePlugin @Inject constructor(
|
||||||
atLog("[Plugin] $message")
|
atLog("[Plugin] $message")
|
||||||
}
|
}
|
||||||
|
|
||||||
|
override fun specialEnableCondition(): Boolean = buildHelper.isEngineeringMode() && buildHelper.isDev()
|
||||||
|
|
||||||
override fun atLog(message: String) {
|
override fun atLog(message: String) {
|
||||||
autotuneFS.atLog(message)
|
autotuneFS.atLog(message)
|
||||||
}
|
}
|
||||||
|
|
|
@ -332,7 +332,7 @@ class AutomationPlugin @Inject constructor(
|
||||||
ActionCarePortalEvent(injector),
|
ActionCarePortalEvent(injector),
|
||||||
ActionProfileSwitchPercent(injector),
|
ActionProfileSwitchPercent(injector),
|
||||||
ActionProfileSwitch(injector),
|
ActionProfileSwitch(injector),
|
||||||
ActionRunAutotune(injector),
|
//ActionRunAutotune(injector),
|
||||||
ActionSendSMS(injector)
|
ActionSendSMS(injector)
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
|
@ -44,15 +44,12 @@ class ActionRunAutotune(injector: HasAndroidInjector) : Action(injector) {
|
||||||
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")
|
}
|
||||||
}
|
|
||||||
} else
|
|
||||||
message = R.string.autotune_dev_warning
|
|
||||||
callback.result(PumpEnactResult(injector).success(autotunePlugin.lastRunSuccess).comment(message))?.run()
|
callback.result(PumpEnactResult(injector).success(autotunePlugin.lastRunSuccess).comment(message))?.run()
|
||||||
}.start()
|
}.start()
|
||||||
return
|
return
|
||||||
|
|
|
@ -566,8 +566,6 @@
|
||||||
<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>
|
||||||
|
|
Loading…
Reference in a new issue