Open quetzalcoatl opened 3 years ago
the uart module is required for NodeMCU-Tool - the whole communication is based on messages terminated by \n
- it would require a lot rework to change this (of course, \0
would be even better..)
\n
- alright. I guessed so, that's why in my "hotfix" I aggregated the whole string before single print()
the uart module is required for NodeMCU-Tool
- That's what I thought when I saw that line in esp8266-commands.js
! And imagine my surprise when I realized that I actually do not have uart
module on the device, and except for fsinfo
NodeMCU-Tool seems to work just fine!
I can terminal
to it, I can fsinfo
(with my hotfix), I can upload/compile/minimize/etc the files. I have not tried download
'ing files, but I suppose that it uses the transferReadHelper
so it probably won't work as it is now, but transferWriteHelper
certainly seems to work, as all files I uploaded were absolutely fine.
It seems that NodeMCU-Tool actually doesn't really rely that much on uart module being present. I reviewed some LUA code in the NodeMCU-Tool and it's mostly print()
'ing that works fine w/o uart
. Of course my knowledge about NodeMCU-Tool is limited, but so far I noticed only that fsinfo
(and probably transferReadHelper
) issues.
I'll probably try to tackle transferReadHelper
and switching between uart-and-non-uart modes too (similar how encoder
is optionally used), but I'm pretty new to esp8266/lua/nodemcu/tool so .. one thing at time :)
However, if you don't see any benefit in uart
-less operation (heh), or if you want to wait until it's more tested (think: transferReadHelper
) etc, no problem :)
Checklist
NodeMCU-Tool terminal
.nodemcu-tool fsinfo
command work? Answer: PARTIALLY, and that's what this issue is about.Environment
Windows 10-2004
ESP8266 looks very much like the Original NodeMCU
v2.0
, but probably a clone3.2.1
8.12.0
Please note that there's
uart
module is NOT included.Debug Output
Issue Description
You've probably already noticed that error in the debug-output:
[serialport] ~ RX: ua error: stdin:1: attempt to index global 'uart'
It comes from
lib/lua/esp8266-commands.js
from
listFiles
on line 32The issue is gone after changing that line from
listFiles: 'local l = file.list();for k,v in pairs(l) do uart.write(0,k..":"..v..";") end print("")',
tolistFiles: 'local l = file.list();local t = {};for k,v in pairs(l) do table.insert(t, k..":"..v..";") end; print(table.concat(t,""))',
Btw. Since patched version probably uses a bit more memory to construct the full string and send it i one go (limitation of print: always include a new line), it may be good a idea to either patch the nodemcu-tool to allow that output to be multi-line and use print() each file line by line, or to detect presence of
uart
module and pick latter or former version of LUA code forlistFiles
Btw. I also noticed one more reference to
uart
intransferReadHelper
but I didn't test that one (yet?)