Skip to content

Commit

Permalink
Some cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
haslinghuis committed Jan 11, 2024
1 parent 9370702 commit e09d787
Showing 1 changed file with 6 additions and 7 deletions.
13 changes: 6 additions & 7 deletions src/js/tabs/firmware_flasher.js
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ const firmware_flasher = {
sponsor: new Sponsor(),
localFirmwareLoaded: false,
selectedBoard: undefined,
boardNeedsVerification: true,
boardNeedsVerification: false,
allowBoardDetection: true,
cloudBuildKey: null,
cloudBuildOptions: null,
Expand All @@ -51,7 +51,6 @@ firmware_flasher.initialize = function (callback) {

// reset on tab change
self.selectedBoard = undefined;
self.boardNeedsVerification = true;
self.allowBoardDetection = true;

self.cloudBuildKey = null;
Expand Down Expand Up @@ -481,8 +480,6 @@ firmware_flasher.initialize = function (callback) {
}

if (!GUI.connect_lock) {
// self.boardNeedsVerification = self.selectedBoard === undefined || target !== self.selectedBoard;
// self.updateDetectBoardButton();
self.selectedBoard = target;
console.log('board changed to', target);

Expand Down Expand Up @@ -969,7 +966,7 @@ firmware_flasher.initialize = function (callback) {
} else {
if (!self.isFlashing) {
// Porthandler resets board on port detect
if (self.boardNeedsVerification) {
if (self.allowBoardDetection && self.boardNeedsVerification) {
// reset to prevent multiple calls
self.boardNeedsVerification = false;
self.verifyBoard();
Expand Down Expand Up @@ -1001,8 +998,10 @@ firmware_flasher.initialize = function (callback) {

detectBoardElement.on('click', () => {
detectBoardElement.toggleClass('disabled', true);
// self.boardNeedsVerification = false;
self.boardNeedsVerification = false;

self.verifyBoard();
// prevent spamming the button
setTimeout(() => detectBoardElement.toggleClass('disabled', false), 1000);
});

Expand Down Expand Up @@ -1223,7 +1222,7 @@ firmware_flasher.isSerialPortAvailable = function() {
};

firmware_flasher.updateDetectBoardButton = function() {
$('a.detect-board').toggleClass('disabled', !this.isSerialPortAvailable() && this.boardNeedsVerification);
$('a.detect-board').toggleClass('disabled', !this.isSerialPortAvailable() && this.boardNeedsVerification && this.allowBoardDetection);
};

firmware_flasher.validateBuildKey = function() {
Expand Down

0 comments on commit e09d787

Please sign in to comment.