Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 4 additions & 6 deletions src/blocklyc.js
Original file line number Diff line number Diff line change
Expand Up @@ -651,8 +651,6 @@ function loadInto(modal_message, compile_command, load_option, load_action) {

// Scoll automatically to the bottom after new data is added
document.getElementById("compile-console").scrollTop = document.getElementById("compile-console").scrollHeight;

//console.log(loaddata);
if (terminalNeeded === 'term' && loaddata.success) {
serial_console();
} else if (terminalNeeded === 'graph' && loaddata.success) {
Expand All @@ -670,10 +668,8 @@ function loadInto(modal_message, compile_command, load_option, load_action) {
}, function (loaddata) {
$("#compile-console").val($("#compile-console").val() + loaddata.message);

// Scoll automatically to the bottom after new data is added
// Scroll automatically to the bottom after new data is added
document.getElementById("compile-console").scrollTop = document.getElementById("compile-console").scrollHeight;

//console.log(loaddata);
if (terminalNeeded === 'term' && loaddata.success) {
serial_console();
} else if (terminalNeeded === 'graph' && loaddata.success) {
Expand Down Expand Up @@ -884,7 +880,9 @@ function graphing_console() {
graph_reset();
graph_temp_string = '';
graph = new Chartist.Line('#serial_graphing', graph_data, graph_options);
if (window.getURLParameter('debug')) console.log(graph_options);
if (window.getURLParameter('debug')) {
console.log(graph_options);
}
} else {
graph.update(graph_data, graph_options);
}
Expand Down
36 changes: 22 additions & 14 deletions src/blocklypropclient.js
Original file line number Diff line number Diff line change
Expand Up @@ -29,22 +29,26 @@
/**
* Not sure what this does
*
* @type {null}
* @type {WebSocket}
*/
var client_ws_connection = null;


// TODO: Uninitialized variable
// TODO: Document what the 'client_ws_heatbeat' variable represents
/**
*
* @type {number}
*/
var client_ws_heartbeat;



/**
*
* @type {number}
*/
var client_ws_heartbeat_interval = null;


var check_com_ports_interval = null;
var check_ws_socket_timeout = null;

Expand All @@ -57,12 +61,12 @@ var launcher_download = false;
* Client Service Object
*/
var clientService = {
available: false, // Available for ?
portsAvailable: false, // Are any serial ports enumerated?
path: 'localhost', // Is this always localhost?
port: 6009, // BlocklyProp Client/Launcher port number
type: null, // {string} Seems to be one of "", "ws", "http"

available: false,
portsAvailable: false,
path: 'localhost',
port: 6009,
type: null,
/*
rxBase64: true,
portListReceiveCountUp: 0, // This is set to 0 each time the port list is received, and incremented once each 4 second heartbeat
Expand All @@ -78,11 +82,12 @@ var clientService = {
CODED_MINIMUM: '0.7.5', // Minimum client/launcher version supporting coded/verbose responses (remove after MINIMUM_ALLOWED > this)

// Variables
current: '0.0.0',
current: '0.0.0', // Current version
currentAsNumber: 0,
isValid: false,
isRecommended: false,
isCoded: false,
isValid: false, // What determines this?
isRecommended: false, // What is this?
isCoded: false, // Also, what is this?

getNumeric: function (rawVersion) {
var tempVersion = rawVersion.toString().split(".");
tempVersion.push('0');
Expand Down Expand Up @@ -197,6 +202,7 @@ function checkClientVersionModal(rawVersion) {
* This is evaluating the BlocklyProp Client or BlocklyProp Launcher version??
*/
var check_client = function () {
// Load data from the server using a HTTP GET request.
$.get(clientService.url(), function (data) {
if (!clientService.available) {
let client_version_str = (typeof data.version_str !== "undefined") ? data.version_str : data.version;
Expand Down Expand Up @@ -231,11 +237,11 @@ var connection_heartbeat = function () {
if (clientService.type === 'ws') {
var d = new Date();
if (client_ws_heartbeat + 12000 < d.getTime()) {
console.log("Lost client websocket connection");
// Client is taking too long to check in - close the connection and clean up
console.log("Lost client websocket connection");
client_ws_connection.close();
lostWSConnection();
}
`` }
}
};

Expand Down Expand Up @@ -463,11 +469,13 @@ function establish_socket() {
function lostWSConnection() {
// Lost websocket connection, clean up and restart find_client processing
client_ws_connection = null;

clientService.type = 'none';
clientService.available = false;
clientService.portsAvailable = false;

setPropToolbarButtons('unavailable');

term = null;
newTerminal = false;

Expand Down