From a254792b552738a4c99d52d5ea580897df4a8630 Mon Sep 17 00:00:00 2001 From: Asizon <43983086+Asizon@users.noreply.github.com> Date: Sun, 9 Aug 2020 12:20:10 +0200 Subject: [PATCH] fixing default after flash --- jsx/blheli_configurator.jsx | 34 ++-------------------------------- 1 file changed, 2 insertions(+), 32 deletions(-) diff --git a/jsx/blheli_configurator.jsx b/jsx/blheli_configurator.jsx index e3dd24f..1dccaca 100644 --- a/jsx/blheli_configurator.jsx +++ b/jsx/blheli_configurator.jsx @@ -164,11 +164,6 @@ var Configurator = React.createClass({ await this.writeSetupImpl(esc); } }, - writeSetupOne: async function() { - for (var esc = 0; esc < this.state.escSettings.length; ++esc) { - await this.writeSetupImpl(esc); - } - }, writeSetupImpl: async function(esc) { try { if (!this.state.escMetainfo[esc].available) { @@ -272,29 +267,6 @@ var Configurator = React.createClass({ $('a.connect').removeClass('disabled'); }, - writeSetupToOne: async function() { - GUI.log(chrome.i18n.getMessage('writeSetupStarted')); - $('a.connect').addClass('disabled'); - - // disallow further requests until we're finished - // @todo also disable settings alteration - this.setState({ - canRead: false, - canWrite: false, - canFlash: false - }); - - try { - await this.writeSetupOne(); - GUI.log(chrome.i18n.getMessage('writeSetupFinished')); - } catch (error) { - GUI.log(chrome.i18n.getMessage('writeSetupFailed', [ error.stack ])); - } - - await this.readSetup(); - - $('a.connect').removeClass('disabled'); - }, resetDefaults: function() { var newSettings = []; @@ -347,9 +319,6 @@ var Configurator = React.createClass({ this.setState({ escSettings: newSettings }); - - this.writeSetupToOne() - .catch(error => console.log("Unexpected error while writing default setup", error)) }, flashOne: async function(escIndex) { this.setState({ @@ -393,16 +362,17 @@ var Configurator = React.createClass({ var allSettings = self.state.escSettings.slice(); allSettings[escIndex] = newSettings; self.onUserInput(allSettings); + this.resetPWMFrecuency(escIndex); GUI.log(chrome.i18n.getMessage('writeSetupStarted')); try { await self.writeSetupImpl(escIndex); GUI.log(chrome.i18n.getMessage('writeSetupFinished')); - this.resetPWMFrecuency(); } catch (error) { GUI.log(chrome.i18n.getMessage('writeSetupFailed', [ error.message ])); } + await self.readSetup(); } else { GUI.log('Will not write settings back due to different MODE\n');