diff --git a/background.js b/background.js index b57ef3d..284bf8d 100644 --- a/background.js +++ b/background.js @@ -4,8 +4,8 @@ chrome.app.runtime.onLaunched.addListener(function() { id: 'main-window', minWidth: 960, maxWidth: 960, - minHeight: 550, - maxHeight: 550 + minHeight: 570, + maxHeight: 570 }, function(main_window) { main_window.onClosed.addListener(function() { // connectionId is passed from the script side through the chrome.runtime.getBackgroundPage refference diff --git a/css/style.css b/css/style.css index d3439d7..d33b31c 100644 --- a/css/style.css +++ b/css/style.css @@ -44,7 +44,7 @@ body { .controls { padding-top: 10px; - height: 109px; + height: 129px; overflow: hidden; diff --git a/js/serial_backend.js b/js/serial_backend.js index bbfbb1b..5f3f472 100644 --- a/js/serial_backend.js +++ b/js/serial_backend.js @@ -1,6 +1,7 @@ $(document).ready(function() { port_picker = $('div#port-picker .port select'); baud_picker = $('div#port-picker #baud'); + delay_picker = $('div#port-picker #delay'); $('div#port-picker a.refresh').click(function() { console.log("Available port list requested."); @@ -45,11 +46,14 @@ $(document).ready(function() { if (clicks) { // odd number of clicks chrome.serial.close(connectionId, onClosed); + clearTimeout(connection_delay); + $(this).text('Connect'); $(this).removeClass('active'); } else { // even number of clicks selected_port = String($(port_picker).val()); selected_baud = parseInt(baud_picker.val()); + connection_delay = parseInt(delay_picker.val()); console.log('Connecting to: ' + selected_port); @@ -94,13 +98,15 @@ function onOpen(openInfo) { } }); - // start polling - serial_poll = setInterval(readPoll, 10); - plot_poll = setInterval(redraw_plot, 40); - port_usage_poll = setInterval(port_usage, 1000); - - // Send over the configuration - send_current_configuration(); + connection_delay = setTimeout(function() { + // start polling + serial_poll = setInterval(readPoll, 10); + plot_poll = setInterval(redraw_plot, 40); + port_usage_poll = setInterval(port_usage, 1000); + + // Send over the configuration + send_current_configuration(); + }, connection_delay * 1000); console.log('Connection established.'); } else { diff --git a/main.html b/main.html index e4d2d77..d592174 100644 --- a/main.html +++ b/main.html @@ -39,6 +39,22 @@ +
Delay:
+
+ +
Connect
Refresh