1
0
Fork 0
mirror of https://github.com/betaflight/betaflight-configurator.git synced 2025-07-15 04:15:32 +03:00

feat: move firmware to modules

this fixes the disconnect issue
This commit is contained in:
Tomas Chmelevskij 2021-06-03 21:04:46 +01:00
parent ceea7ef60b
commit d71a5f7ef3
3 changed files with 18 additions and 13 deletions

View file

@ -1,6 +1,6 @@
'use strict';
import { i18n } from '../localization';
TABS.firmware_flasher = {
const firmware_flasher = {
releases: null,
releaseChecker: new ReleaseChecker('firmware', 'https://api.github.com/repos/betaflight/betaflight/releases'),
jenkinsLoader: new JenkinsLoader('https://ci.betaflight.tech'),
@ -14,7 +14,7 @@ TABS.firmware_flasher = {
developmentFirmwareLoaded: false, // Is the firmware to be flashed from the development branch?
};
TABS.firmware_flasher.initialize = function (callback) {
firmware_flasher.initialize = function (callback) {
var self = this;
if (GUI.active_tab != 'firmware_flasher') {
@ -1224,7 +1224,7 @@ TABS.firmware_flasher.initialize = function (callback) {
});
};
TABS.firmware_flasher.cleanup = function (callback) {
firmware_flasher.cleanup = function (callback) {
PortHandler.flush_callbacks();
FirmwareCache.unload();
@ -1241,9 +1241,7 @@ TABS.firmware_flasher.cleanup = function (callback) {
if (callback) callback();
};
TABS.firmware_flasher.enableFlashing = function (enabled) {
var self = this;
firmware_flasher.enableFlashing = function (enabled) {
if (enabled) {
$('a.flash_firmware').removeClass('disabled');
} else {
@ -1251,12 +1249,12 @@ TABS.firmware_flasher.enableFlashing = function (enabled) {
}
};
TABS.firmware_flasher.FLASH_MESSAGE_TYPES = {NEUTRAL : 'NEUTRAL',
firmware_flasher.FLASH_MESSAGE_TYPES = {NEUTRAL : 'NEUTRAL',
VALID : 'VALID',
INVALID : 'INVALID',
ACTION : 'ACTION'};
TABS.firmware_flasher.flashingMessage = function(message, type) {
firmware_flasher.flashingMessage = function(message, type) {
let self = this;
let progressLabel_e = $('span.progressLabel');
@ -1285,13 +1283,13 @@ TABS.firmware_flasher.flashingMessage = function(message, type) {
return self;
};
TABS.firmware_flasher.flashProgress = function(value) {
firmware_flasher.flashProgress = function(value) {
$('.progress').val(value);
return this;
};
TABS.firmware_flasher.injectTargetInfo = function (targetConfig, targetName, manufacturerId, commitInfo) {
firmware_flasher.injectTargetInfo = function (targetConfig, targetName, manufacturerId, commitInfo) {
const targetInfoLineRegex = /^# config: manufacturer_id: .*, board_name: .*, version: .*$, date: .*\n/gm;
const config = targetConfig.replace(targetInfoLineRegex, '');
@ -1302,3 +1300,9 @@ TABS.firmware_flasher.injectTargetInfo = function (targetConfig, targetName, man
lines.splice(1, 0, targetInfo);
return lines.join('\n');
};
TABS.firmware_flasher = firmware_flasher;
export {
firmware_flasher,
};