Skip to content

Commit b3bdfd3

Browse files
authored
Merge pull request #324 from parallaxinc/patch-develop
Inline documentation update
2 parents d10f778 + 3029b39 commit b3bdfd3

File tree

2 files changed

+26
-20
lines changed

2 files changed

+26
-20
lines changed

src/blocklyc.js

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -651,8 +651,6 @@ function loadInto(modal_message, compile_command, load_option, load_action) {
651651

652652
// Scoll automatically to the bottom after new data is added
653653
document.getElementById("compile-console").scrollTop = document.getElementById("compile-console").scrollHeight;
654-
655-
//console.log(loaddata);
656654
if (terminalNeeded === 'term' && loaddata.success) {
657655
serial_console();
658656
} else if (terminalNeeded === 'graph' && loaddata.success) {
@@ -670,10 +668,8 @@ function loadInto(modal_message, compile_command, load_option, load_action) {
670668
}, function (loaddata) {
671669
$("#compile-console").val($("#compile-console").val() + loaddata.message);
672670

673-
// Scoll automatically to the bottom after new data is added
671+
// Scroll automatically to the bottom after new data is added
674672
document.getElementById("compile-console").scrollTop = document.getElementById("compile-console").scrollHeight;
675-
676-
//console.log(loaddata);
677673
if (terminalNeeded === 'term' && loaddata.success) {
678674
serial_console();
679675
} else if (terminalNeeded === 'graph' && loaddata.success) {
@@ -884,7 +880,9 @@ function graphing_console() {
884880
graph_reset();
885881
graph_temp_string = '';
886882
graph = new Chartist.Line('#serial_graphing', graph_data, graph_options);
887-
if (window.getURLParameter('debug')) console.log(graph_options);
883+
if (window.getURLParameter('debug')) {
884+
console.log(graph_options);
885+
}
888886
} else {
889887
graph.update(graph_data, graph_options);
890888
}

src/blocklypropclient.js

Lines changed: 22 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -29,22 +29,26 @@
2929
/**
3030
* Not sure what this does
3131
*
32-
* @type {null}
32+
* @type {WebSocket}
3333
*/
3434
var client_ws_connection = null;
3535

3636

3737
// TODO: Uninitialized variable
3838
// TODO: Document what the 'client_ws_heatbeat' variable represents
3939
/**
40-
*
40+
* @type {number}
4141
*/
4242
var client_ws_heartbeat;
4343

4444

45-
45+
/**
46+
*
47+
* @type {number}
48+
*/
4649
var client_ws_heartbeat_interval = null;
4750

51+
4852
var check_com_ports_interval = null;
4953
var check_ws_socket_timeout = null;
5054

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

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

8084
// Variables
81-
current: '0.0.0',
85+
current: '0.0.0', // Current version
8286
currentAsNumber: 0,
83-
isValid: false,
84-
isRecommended: false,
85-
isCoded: false,
87+
isValid: false, // What determines this?
88+
isRecommended: false, // What is this?
89+
isCoded: false, // Also, what is this?
90+
8691
getNumeric: function (rawVersion) {
8792
var tempVersion = rawVersion.toString().split(".");
8893
tempVersion.push('0');
@@ -197,6 +202,7 @@ function checkClientVersionModal(rawVersion) {
197202
* This is evaluating the BlocklyProp Client or BlocklyProp Launcher version??
198203
*/
199204
var check_client = function () {
205+
// Load data from the server using a HTTP GET request.
200206
$.get(clientService.url(), function (data) {
201207
if (!clientService.available) {
202208
let client_version_str = (typeof data.version_str !== "undefined") ? data.version_str : data.version;
@@ -231,11 +237,11 @@ var connection_heartbeat = function () {
231237
if (clientService.type === 'ws') {
232238
var d = new Date();
233239
if (client_ws_heartbeat + 12000 < d.getTime()) {
234-
console.log("Lost client websocket connection");
235240
// Client is taking too long to check in - close the connection and clean up
241+
console.log("Lost client websocket connection");
236242
client_ws_connection.close();
237243
lostWSConnection();
238-
}
244+
`` }
239245
}
240246
};
241247

@@ -463,11 +469,13 @@ function establish_socket() {
463469
function lostWSConnection() {
464470
// Lost websocket connection, clean up and restart find_client processing
465471
client_ws_connection = null;
472+
466473
clientService.type = 'none';
467474
clientService.available = false;
468475
clientService.portsAvailable = false;
469476

470477
setPropToolbarButtons('unavailable');
478+
471479
term = null;
472480
newTerminal = false;
473481

0 commit comments

Comments
 (0)