From 64dbef2c5834062c0561e480d0e36524fb29218d Mon Sep 17 00:00:00 2001 From: cTn Date: Tue, 10 Dec 2013 08:19:18 +0100 Subject: [PATCH] simplify hex referencing --- js/stm32.js | 5 +++-- tabs/firmware_flasher.js | 6 ++---- 2 files changed, 5 insertions(+), 6 deletions(-) diff --git a/js/stm32.js b/js/stm32.js index c66197b850..4d8a488609 100644 --- a/js/stm32.js +++ b/js/stm32.js @@ -1,5 +1,5 @@ var STM32_protocol = function() { - this.hex; // hex object + this.hex; // ref this.receive_buffer; @@ -52,8 +52,9 @@ STM32_protocol.prototype.GUI_status = function(string) { }; // no input parameters -STM32_protocol.prototype.connect = function() { +STM32_protocol.prototype.connect = function(hex) { var self = this; + self.hex = hex; var selected_port = String($('div#port-picker .port select').val()); var baud = parseInt($('div#port-picker #baud').val()); diff --git a/tabs/firmware_flasher.js b/tabs/firmware_flasher.js index 9636677215..338402f244 100644 --- a/tabs/firmware_flasher.js +++ b/tabs/firmware_flasher.js @@ -83,10 +83,8 @@ function tab_initialize_firmware_flasher() { $('a.flash_firmware').click(function() { if (!$(this).hasClass('locked')) { if (!GUI.connect_lock) { // button disabled while flashing is in progress - if (parsed_hex != false) { - STM32.hex = parsed_hex; - - STM32.connect(); + if (parsed_hex != false) { + STM32.connect(parsed_hex); } else { STM32.GUI_status('Firmware not loaded'); }