Unverified Commit 26f22db1 authored by Don Gagne's avatar Don Gagne Committed by GitHub

Merge pull request #8371 from Williangalvani/fixBinding

APMSubMotorComponent.qml: fix broken timer binding
parents 58b88b67 c7534df6
...@@ -28,7 +28,8 @@ SetupPage { ...@@ -28,7 +28,8 @@ SetupPage {
property int neutralValue: 50; property int neutralValue: 50;
property int _lastIndex: 0; property int _lastIndex: 0;
property bool canDoManualTest: controller.vehicle.flightMode !== 'Motor Detection' && controller.vehicle.armed && motorPage.visible property bool canRunManualTest: controller.vehicle.flightMode !== 'Motor Detection' && controller.vehicle.armed && motorPage.visible && setupView.visible
property var shouldRunManualTest: false // Does the operator intend to run the motor test?
APMSubMotorComponentController { APMSubMotorComponentController {
id: controller id: controller
...@@ -49,7 +50,7 @@ SetupPage { ...@@ -49,7 +50,7 @@ SetupPage {
Row { Row {
id: motorSliders id: motorSliders
enabled: canDoManualTest enabled: canRunManualTest && shouldRunManualTest
spacing: ScreenTools.defaultFontPixelWidth * 4 spacing: ScreenTools.defaultFontPixelWidth * 4
Column { Column {
...@@ -169,7 +170,7 @@ SetupPage { ...@@ -169,7 +170,7 @@ SetupPage {
id: safetySwitch id: safetySwitch
onToggled: { onToggled: {
if (controller.vehicle.armed) { if (controller.vehicle.armed) {
timer.stop() shouldRunManualTest = false
enabled = false enabled = false
coolDownTimer.start() coolDownTimer.start()
} }
...@@ -186,11 +187,11 @@ SetupPage { ...@@ -186,11 +187,11 @@ SetupPage {
{ {
safetySwitch.checked = armed safetySwitch.checked = armed
if (!armed) { if (!armed) {
timer.stop() shouldRunManualTest = false
safetySwitch.enabled = false safetySwitch.enabled = false
coolDownTimer.start() coolDownTimer.start()
} else { } else {
timer.start() shouldRunManualTest = true
} }
for (var sliderIndex=0; sliderIndex<sliderRepeater.count; sliderIndex++) { for (var sliderIndex=0; sliderIndex<sliderRepeater.count; sliderIndex++) {
sliderRepeater.itemAt(sliderIndex).motorSlider.value = neutralValue sliderRepeater.itemAt(sliderIndex).motorSlider.value = neutralValue
...@@ -278,7 +279,7 @@ SetupPage { ...@@ -278,7 +279,7 @@ SetupPage {
id: timer id: timer
interval: 50 interval: 50
repeat: true repeat: true
running: canDoManualTest running: canRunManualTest
onTriggered: { onTriggered: {
if (controller.vehicle.armed) { if (controller.vehicle.armed) {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment