Skip to content
Merged
Show file tree
Hide file tree
Changes from 16 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 11 additions & 8 deletions src/js/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,6 @@ import "./jqueryPlugins";
import $ from "jquery";
import "../components/init.js";
import { gui_log } from "./gui_log.js";
// same, msp seems to be everywhere used from global scope
import "./msp/MSPHelper.js";
import { i18n } from "./localization.js";
import GUI, { TABS } from "./gui.js";
import { get as getConfig, set as setConfig } from "./ConfigStorage.js";
Expand Down Expand Up @@ -184,13 +182,18 @@ function startProcess() {
return;
}

if (GUI.allowedTabs.indexOf(tab) < 0 && tab === "firmware_flasher") {
if (GUI.connected_to || GUI.connecting_to) {
$("a.connection_button__link").click();
if (!GUI.allowedTabs.includes(tab)) {
if (tab === "firmware_flasher") {
// Special handling for firmware flasher tab
if (GUI.connected_to || GUI.connecting_to) {
$("a.connection_button__link").trigger("click");
}
// This line is required but it triggers opening the firmware flasher tab again
$("a.firmware_flasher_button__link").trigger("click");
} else {
gui_log(i18n.getMessage("tabSwitchUpgradeRequired", [tabName]));
return;
}
} else if (GUI.allowedTabs.indexOf(tab) < 0) {
gui_log(i18n.getMessage("tabSwitchUpgradeRequired", [tabName]));
return;
}

GUI.tab_switch_in_progress = true;
Expand Down
2 changes: 1 addition & 1 deletion src/js/msp.js
Original file line number Diff line number Diff line change
Expand Up @@ -263,7 +263,7 @@ const MSP = {
if (this.message_checksum === expectedChecksum) {
// message received, store dataview
this.dataView = new DataView(this.message_buffer, 0, this.message_length_expected);
} else if (serial._webBluetooth.shouldBypassCrc(expectedChecksum)) {
} else if (serial.protocol === "bluetooth" && serial._protocol?.shouldBypassCrc?.(expectedChecksum)) {
this.dataView = new DataView(this.message_buffer, 0, this.message_length_expected);
this.crcError = false; // Override the CRC error for this specific case
} else {
Expand Down
9 changes: 0 additions & 9 deletions src/js/protocols/WebSerial.js
Original file line number Diff line number Diff line change
Expand Up @@ -378,15 +378,6 @@ class WebSerial extends EventTarget {
return { bytesSent: 0 };
}
}

/**
* Clean up resources when the protocol is no longer needed
*/
cleanup() {
if (this.connected) {
this.disconnect();
}
}
}

// Export the class itself, not an instance
Expand Down
Loading