Skip to content

Commit c742584

Browse files
committed
Fixed flight controller reboot.
1 parent 055d701 commit c742584

File tree

1 file changed

+14
-8
lines changed

1 file changed

+14
-8
lines changed

js/serial_backend.js

Lines changed: 14 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,13 @@ $(document).ready(function () {
3636
$('div.connect_controls a.connect').click(function () {
3737
if (GUI.connect_lock != true) { // GUI control overrides the user control
3838

39-
var clicks = $(this).data('clicks');
39+
var thisElement = $(this);
40+
var clicks = thisElement.data('clicks');
41+
42+
var toggleStatus = function() {
43+
thisElement.data("clicks", !clicks);
44+
};
45+
4046
var selected_baud = parseInt($('div#port-picker #baud').val());
4147
var selected_port = $('div#port-picker #port option:selected').data().isManual ?
4248
$('#port-override').val() :
@@ -55,6 +61,8 @@ $(document).ready(function () {
5561

5662

5763
serial.connect(selected_port, {bitrate: selected_baud}, onOpen);
64+
65+
toggleStatus();
5866
} else {
5967
GUI.timeout_kill_all();
6068
GUI.interval_kill_all();
@@ -67,14 +75,12 @@ $(document).ready(function () {
6775
MSP.send_message(MSPCodes.MSP_ARMING_DISABLE, false, false, function () {
6876
GUI.log(chrome.i18n.getMessage('armingEnabled'));
6977

70-
finishClose();
78+
finishClose(toggleStatus);
7179
});
7280
} else {
73-
finishClose();
81+
finishClose(toggleStatus);
7482
}
7583
}
76-
77-
$(this).data("clicks", !clicks);
7884
}
7985
}
8086
});
@@ -113,16 +119,14 @@ $(document).ready(function () {
113119
}
114120

115121
chrome.storage.local.set({'auto_connect': GUI.auto_connect});
116-
117-
118122
});
119123
});
120124

121125
PortHandler.initialize();
122126
PortUsage.initialize();
123127
});
124128

125-
function finishClose() {
129+
function finishClose(finishedCallback) {
126130
var wasConnected = CONFIGURATOR.connectionValid;
127131

128132
serial.disconnect(onClosed);
@@ -155,6 +159,8 @@ function finishClose() {
155159
}
156160

157161
$('#tabs .tab_landing a').click();
162+
163+
finishedCallback();
158164
}
159165

160166

0 commit comments

Comments
 (0)