From e3ec48452c01a186437939d8d6be23fc39a94f15 Mon Sep 17 00:00:00 2001 From: cTn Date: Mon, 3 Feb 2014 10:07:54 +0100 Subject: [PATCH] utilize latest changes in serial lib --- js/serial_backend.js | 2 +- js/stm32.js | 12 +++++++++--- 2 files changed, 10 insertions(+), 4 deletions(-) diff --git a/js/serial_backend.js b/js/serial_backend.js index ef81b3f073..d6b7fcd435 100644 --- a/js/serial_backend.js +++ b/js/serial_backend.js @@ -106,7 +106,7 @@ $(document).ready(function() { }); function onOpen(openInfo) { - if (openInfo.connectionId > 0) { + if (openInfo) { // update connected_to GUI.connected_to = GUI.connecting_to; diff --git a/js/stm32.js b/js/stm32.js index 096b0729d0..213b1d2919 100644 --- a/js/stm32.js +++ b/js/stm32.js @@ -84,7 +84,7 @@ STM32_protocol.prototype.connect = function(hex) { if (!$('input.updating').is(':checked')) { serial.connect(selected_port, {bitrate: baud}, function(openInfo) { - if (openInfo.connectionId > 0) { + if (openInfo) { console.log('Sending ascii "R" to reboot'); // we are connected, disabling connect button in the UI @@ -99,8 +99,10 @@ STM32_protocol.prototype.connect = function(hex) { serial.disconnect(function(result) { if (result) { serial.connect(selected_port, {bitrate: flashing_bitrate, parityBit: 'even', stopBits: 'one'}, function(openInfo) { - if (openInfo.connectionId > 0) { + if (openInfo) { self.initialize(); + } else { + GUI.log('Failed to open serial port'); } }); } else { @@ -108,15 +110,19 @@ STM32_protocol.prototype.connect = function(hex) { } }); }); + } else { + GUI.log('Failed to open serial port'); } }); } else { serial.connect(selected_port, {bitrate: flashing_bitrate, parityBit: 'even', stopBits: 'one'}, function(openInfo) { - if (openInfo.connectionId > 0) { + if (openInfo) { // we are connected, disabling connect button in the UI GUI.connect_lock = true; self.initialize(); + } else { + GUI.log('Failed to open serial port'); } }); }