Closed kmpm closed 9 years ago
Made my own similar implementation for use in https://github.com/kmpm/nodemcu-uploader
function recv_block(d)
if string.byte(d, 1) == 1 then
size = string.byte(d, 2)
if size > 0 then
file.write(string.sub(d, 3, 3+size))
uart.write(0,'\006')
else
uart.write(0,'\006')
file.close()
uart.on('data')
uart.setup(0,9600,8,0,1,1)
end
else
uart.write(0, '\021' .. d)
uart.setup(0,9600,8,0,1,1)
uart.on('data')
end
end
function recv_name(d)
d = string.gsub(d, '\000', '')
file.remove(d)
file.open(d, 'w')
uart.on('data', 130, recv_block, 0)
uart.write(0, '\006')
end
function recv()
uart.setup(0,9600,8,0,1,0)
uart.on('data', '\000', recv_name, 0)
uart.write(0, 'C')
end
If you do not mind, I would like to know the wishes of users. Vote on google docs and for registered forum users: http://www.esp8266.com/viewtopic.php?f=19&t=1220
go ahead, and thank you!
I am reopening this again. I would really like to avoid having to upload and run these functions in lua every time it's needed. A proper protocol implemented in for example the node api would be great. Like node.recv() for example.
Sorry but we aren't going to implement this.
Ok, thanks anyway. Any plans for something else to aid in uploading files?
@kmpm Peter, I use my own provisioning bootstrap, and do all this over wifi rather than having to plug my devices into a UART to load them . Essentially I initialise the filesystem using DiUS spiffsimg with this one small bootstrap file as its init.lua
so that when you first turn on the esp8266, it picks up a DHCP address and uses a simple UDP ping pong protocol to download the full loader and initialise the SPIFFS file system from a hosted provisioning process (a Lua script which runs on an RPi connected to my router). The script uses signed transfers and passes it's chipID, so the provisioning process can do device specific file system initialisation. When I get around to it, I'll add this to the examples folder.
I would love to have a simpler way of doing such a common thing as uploading files.
eLua have implemented a protocol called xmodem which adds a recv command to the shell. I don't know if it's possible to include this as an optional thing here or if we are missing something neccesary.
I found some related files in the elua git https://github.com/elua/elua