Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add xmodem transfer from eLua #95

Closed
kmpm opened this issue Jan 10, 2015 · 8 comments
Closed

Add xmodem transfer from eLua #95

kmpm opened this issue Jan 10, 2015 · 8 comments

Comments

@kmpm
Copy link
Contributor

kmpm commented Jan 10, 2015

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

  • elua/elua
  • elua/src/shell/shell_recv.c
  • elua/inc/xmodem.h
  • elua/inc/xmodem.c
@Hoksmur
Copy link

Hoksmur commented Jan 11, 2015

It is real to program in lua. See example in uart.on description.

@kmpm
Copy link
Contributor Author

kmpm commented Jan 11, 2015

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

@kmpm kmpm closed this as completed Jan 11, 2015
@Hoksmur
Copy link

Hoksmur commented Jan 12, 2015

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

@nodemcu
Copy link
Collaborator

nodemcu commented Jan 12, 2015

go ahead, and thank you!

@kmpm
Copy link
Contributor Author

kmpm commented Apr 7, 2015

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.

@kmpm kmpm reopened this Apr 7, 2015
@TerryE
Copy link
Collaborator

TerryE commented Nov 2, 2015

Sorry but we aren't going to implement this.

@TerryE TerryE closed this as completed Nov 2, 2015
@kmpm
Copy link
Contributor Author

kmpm commented Nov 6, 2015

Ok, thanks anyway.
Any plans for something else to aid in uploading files?

@TerryE
Copy link
Collaborator

TerryE commented Nov 6, 2015

@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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants