fontainejp / blocklino

A mini development environment for free and open source graphic language
http://fontainejp.github.io
Creative Commons Zero v1.0 Universal
14 stars 9 forks source link

SerialPort 7.1.4 old version #15

Open adalborgo opened 3 years ago

adalborgo commented 3 years ago

Hi, I tried to compile Blocklino with Windows 10, but the version of SerialPort 7.1.4 is too old and I couldn't complete the installation. I therefore used the latest version 9.0.6 which however does not see the serial ports.

In the documentation of "https://serialport.io/docs/api-stream" I found these notes:

This is probably due to the use of port.comName in the index.js file. Is it possible to modify the index.js file to make it compatible with the new version of SerialPort? Thank you.

fontainejp commented 3 years ago

Hi, Yes you can modify everything in index.js it's free ! all is here : sp.list(function(err,ports){ var opt = document.createElement('option') opt.value = "com" opt.text = Blockly.Msg.com1 portserie.appendChild(opt) ports.forEach(function(port) { if (port.vendorId){ var opt = document.createElement('option') opt.value = port.comName opt.text = port.comName portserie.appendChild(opt) } }) localStorage.setItem("nb_com",ports.length) if (portserie.options.length > 1) { portserie.selectedIndex = 1 localStorage.setItem("com",portserie.options[1].value) } else { localStorage.setItem("com","com") } }) sp.list(function(err,ports){ var messageUSB = document.getElementById('usb') if (ports.length === 0) { messageUSB.innerHTML = "Aucun port n'est disponible" // port not available } else { tableHTML = tableify(ports) messageUSB.innerHTML = tableHTML } }) $('#portserie').mouseover(function(){ sp.list(function(err,ports) { var nb_com = localStorage.getItem("nb_com"), menu_opt = portserie.getElementsByTagName('option') if(ports.length > nb_com){ ports.forEach(function(port){ if (port.vendorId){ var opt = document.createElement('option') opt.value = port.comName opt.text = port.comName portserie.appendChild(opt) localStorage.setItem("com",port.comName) } }) localStorage.setItem("nb_com",ports.length) localStorage.setItem("com",portserie.options[1].value) } if(ports.length < nb_com){ while(menu_opt[1]) { portserie.removeChild(menu_opt[1]) } localStorage.setItem("com","com") localStorage.setItem("nb_com",ports.length) } }) }) But i think it's possible to install a specific version with : npm installserialport@7.1.4` Presently i have no time to update all modules, this summer will be probably the good time. Bye