Closed adalborgo closed 3 years ago
Hi Antonio
Can you review the index.html file in www folder. Maybe in the installation process the web file was copied. Can you share with us a screenshot because if the USB port have disappeared the index file used is not ok
Let us know
El mié, 27 ene 2021 a las 17:17, Antonio Dal Borgo (< notifications@github.com>) escribió:
I tried to build OttoBlockly for Windows from source but without the expected result. Especially the buttons maximize, minimize, restore and USB port selection doesn't work. The installation build processes report no errors. Any suggestions? Thanks.
— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/OttoDIY/blockly/issues/95, or unsubscribe https://github.com/notifications/unsubscribe-auth/AGZ4AUE2IRB4TQEVXMA3X2DS4A4CDANCNFSM4WVQ7MUA .
-- Óscar Ferruz Romero Socio fundador. Tel. 620.402.168
C/ Artajona, 17. 28039 - Madrid. www.logix5.com blog.logix5.com
www.twitter.com/Logix5_SS http://www.twitter.com/logix5_SS
www.facebook.com/logix5
Instagram: logix5_
"En la vida hay tres cosas que no dan marcha atrás: la palabra pronunciada, la flecha lanzada y la oportunidad perdida, ¿vamos a dejarla escapar?"
I think it is a version problem. In order not to have errors with serialport, I compiled it with the "--build-from-source" option, but probably the new version 9.0.6 is not compatible with the OttoBlockly code. I also edited the package.json file in the script section, from "compiler": "build --win --ia32" to "compiler": "electron-builder --win --ia32", because npm does not recognize the word "build". It would be necessary to review the versions of the packages because those indicated are not up to date.
I also did some tests with Blocklino but the problem is the same.
The problem with the maximize, minimize, reset buttons only occurs with Electron versions greater than 4: some statements in the code are obsolete.
As for the SerialPort, version 9.0.6 does not see serial ports. In the documentation of "https://serialport.io/docs/api-stream" I found these notes:
In the resources/app/index.js file:
lines of code 28-52: document.getElementById('#portserie').mouseover(function(){ // $('#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) } }) })
lines of code 94-114: 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") } })
Is it possible to modify the index.js file to make it compatible with the new version of SerialPort?
I have found the solution. It is necessary to replace the lines I indicated with: lines of code 28-52:
$('#portserie').mouseover(function(){
sp.list().then(ports => {
var nb_com = localStorage.getItem("nb_com"), menu_opt = portserie.getElementsByTagName('option')
if(ports.length > nb_com){
ports.forEach(function(port){
if (port){
var opt = document.createElement('option')
opt.value = port.path
opt.text = port.path
portserie.appendChild(opt)
localStorage.setItem("com",port.path)
}
})
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)
}
})
})
lines of code 94-114:
sp.list().then(ports => {
var opt = document.createElement('option')
opt.value = "com"
opt.text = Blockly.Msg.com1
portserie.appendChild(opt)
ports.forEach(function (port) {
if (port){
var opt = document.createElement('option')
opt.value = port.path;
opt.text = port.path;
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")
}
})
Hi @adalborgo Looking good thanks for the debugging can you do a PR with this changes so that we can try?
I have found the solution. It is necessary to replace the lines I indicated with: lines of code 28-52:
$('#portserie').mouseover(function(){ sp.list().then(ports => { var nb_com = localStorage.getItem("nb_com"), menu_opt = portserie.getElementsByTagName('option') if(ports.length > nb_com){ ports.forEach(function(port){ if (port){ var opt = document.createElement('option') opt.value = port.path opt.text = port.path portserie.appendChild(opt) localStorage.setItem("com",port.path) } }) 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) } }) })
lines of code 94-114:
sp.list().then(ports => { var opt = document.createElement('option') opt.value = "com" opt.text = Blockly.Msg.com1 portserie.appendChild(opt) ports.forEach(function (port) { if (port){ var opt = document.createElement('option') opt.value = port.path; opt.text = port.path; 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") } })
Hi @adalborgo what files is this?
Hi @adalborgo Give a try to this new release https://github.com/OttoDIY/blockly/releases/tag/v1.4.2
@cparrapa I would like to build for window with my small of custom otto lib, so could you share the detail of instructions to build for window os?
Hi @quangvtvp The instructions are in the readme, if complicated we can add it for you. is it a new Otto remix?
Hi @cparrapa, I have already checked the readme file but it not found any step instruction to build exe file for window, could u give me a link?
I tried to build OttoBlockly for Windows from source but without the expected result. Especially the buttons maximize, minimize, restore and USB port selection doesn't work. The installation build processes report no errors. Any suggestions? Thanks.