You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
@@ -401,16 +417,16 @@ function connect_ws(ws_port, url_path) {
401
417
if(ws_msg.type==="load-prop"){
402
418
// load the propeller
403
419
log('Received Propeller Application for '+ws_msg.action,mDbug,socket,1);
404
-
updatePreferredPort(ws_msg.portPath);
420
+
updatePreferredPort(ws_msg.portPath,socket);
405
421
setTimeout(function(){loadPropeller(socket,ws_msg.portPath,ws_msg.action,ws_msg.payload,ws_msg.debug)},10);// success is a JSON that the browser generates and expects back to know if the load was successful or not
406
422
}elseif(ws_msg.type==="serial-terminal"){
407
423
// open or close the serial port for terminal/debug
408
-
updatePreferredPort(ws_msg.portPath);
424
+
updatePreferredPort(ws_msg.portPath,socket);
409
425
serialTerminal(socket,ws_msg.action,ws_msg.portPath,ws_msg.baudrate,ws_msg.msg);// action is "open", "close" or "msg"
/* Send current list of communication ports to browser via socket.
581
-
(See "Launcher Communication Port Rules," above, for detailed rules and scenarios this function (and ports.js and index.js) implements.)
582
-
List is ordered as: blank (rarely) or preferred (if any) followed by sorted... new wired, old wired, new wireless, then old wireless ports.
583
-
New means newly-arrived (since last port selection changed); old means existing since before last port selection changed.*/
596
+
/* Send list of current communication ports to browser via socket.
597
+
(See "Launcher Communication Port Rules," above, for detailed rules and scenarios that this function (and ports.js and index.js) implements.)
598
+
List is ordered as: blank (rarely) or preferred (if any) followed by individually sorted groups of new wired, old wired, new wireless, then old wireless ports.
599
+
"New" means newly-arrived (since last port selection changed); "old" means existing since before last port selection changed.*/
584
600
letbp=[];// Either empty (common) or blank string (rarely)
585
601
letpp=[];// Peferred port name (qty 0 or 1)
586
602
letnwp=[];// New wired port name list (often qty 0 or 1)
@@ -589,34 +605,39 @@ function sendPortList(socket) {
589
605
letowlp=[];// Old Wireless port (=> 0)
590
606
letqty=0;// Quantity of ports found
591
607
592
-
// gather separated port lists (preferred port (if any), new wired/wireless ports (if any), old wired/wireless ports, then sort them)
593
-
ports.forEach(function(p){
594
-
if(p.name===preferredPort.name){
595
-
pp.push(p.name)
596
-
}else{
597
-
if(p.isWired){
598
-
if(p.new){nwp.push(p.name)}else{owp.push(p.name)}
608
+
//Find the portLister object that belongs to this socket
// Remember when the preferredPort exists; otherwise if preferredPort just disappeared, clear all "new" port statuses - we only care about new-arrivals since last preferred port selection
// report back to editor; blank (rarely), preferred port first (if any), new wired ports (if any), old wired ports, new wireless ports (if any), and finally old wireless ports
614
-
if(qty&&!pp.length&&!nwp.length){bp.push("")}// Send leading blank port only if > 0 ports found, none match the preferred port, and there are no new wired ports
// Remember when the preferred port exists; otherwise if preferred port just disappeared, clear all "new" port statuses - we only care about new-arrivals since last preferred port selection
// report back to editor; blank (rarely), preferred port first (if any), new wired ports (if any), old wired ports, new wireless ports (if any), and finally old wireless ports
634
+
if(qty&&!pp.length&&!nwp.length){bp.push("")}// Send leading blank port only if > 0 ports found, none match the preferred port, and there are no new wired ports
0 commit comments