Removed incorrect inclusions in LUA_FUNCTIONS which guaranteed that function reuse would never occur.
Replaced file.read() (old API, no longer supported in IDF v4) with fd:read()
Removed unnecessary d:sub(1,-2) which had no effect, in recv_name
Fix typo in download_file
Support 'print' command for files larger than 1024 bytes - this meant switching from using print() to uart.write()
Better error handling in 'download' if the file doesn't exist
Note, the 'download' command seems to be broken on esp32 even with Lua 5.1 and IDF v3 because of line ending conversion, and I haven't fixed that here.
Tested on esp8266 (with some old Lua 5.1 ROM on it), esp32 with IDF v3 and Lua 5.1 (from dev-esp32 branch); and esp32 with v4 and Lua 5.3 (from dev-esp32-idf4 branch). IDF v4 with Lua 5.1 should work fine too. 'download' command only tested successfully on esp8266.
Specifically:
Note, the 'download' command seems to be broken on esp32 even with Lua 5.1 and IDF v3 because of line ending conversion, and I haven't fixed that here.
Tested on esp8266 (with some old Lua 5.1 ROM on it), esp32 with IDF v3 and Lua 5.1 (from dev-esp32 branch); and esp32 with v4 and Lua 5.3 (from dev-esp32-idf4 branch). IDF v4 with Lua 5.1 should work fine too. 'download' command only tested successfully on esp8266.