{"action":"created","issue":{"url":"https://api.github.com/repos/nodemcu/nodemcu-firmware/issues/95","labels_url":"https://api.github.com/repos/nodemcu/nodemcu-firmware/issues/95/labels{/name}","comments_url":"https://api.github.com/repos/nodemcu/nodemcu-firmware/issues/95/comments","events_url":"https://api.github.com/repos/nodemcu/nodemcu-firmware/issues/95/events","html_url":"https://github.com/nodemcu/nodemcu-firmware/issues/95","id":53972983,"number":95,"title":"Add xmodem transfer from eLua","user":{"login":"kmpm","id":96618,"avatar_url":"https://avatars.githubusercontent.com/u/96618?v=3","gravatar_id":"","url":"https://api.github.com/users/kmpm","html_url":"https://github.com/kmpm","followers_url":"https://api.github.com/users/kmpm/followers","following_url":"https://api.github.com/users/kmpm/following{/other_user}","gists_url":"https://api.github.com/users/kmpm/gists{/gist_id}","starred_url":"https://api.github.com/users/kmpm/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/kmpm/subscriptions","organizations_url":"https://api.github.com/users/kmpm/orgs","repos_url":"https://api.github.com/users/kmpm/repos","events_url":"https://api.github.com/users/kmpm/events{/privacy}","received_events_url":"https://api.github.com/users/kmpm/received_events","type":"User","site_admin":false},"labels":[],"state":"closed","locked":false,"assignee":null,"milestone":null,"comments":2,"created_at":"2015-01-10T22:03:12Z","updated_at":"2015-01-11T13:20:21Z","closed_at":"2015-01-11T13:20:21Z","body":"I would love to have a simpler way of doing such a common thing as uploading files.\r\n\r\neLua have implemented a protocol called xmodem which adds a _recv_ command to the shell.\r\nI don't know if it's possible to include this as an optional thing here or if we are missing something neccesary.\r\n\r\nI found some related files in the elua git\r\nhttps://github.com/elua/elua\r\n\r\n* elua/elua\r\n* elua/src/shell/shell_recv.c\r\n* elua/inc/xmodem.h\r\n* elua/inc/xmodem.c"},"comment":{"url":"https://api.github.com/repos/nodemcu/nodemcu-firmware/issues/comments/69494195","html_url":"https://github.com/nodemcu/nodemcu-firmware/issues/95#issuecomment-69494195","issue_url":"https://api.github.com/repos/nodemcu/nodemcu-firmware/issues/95","id":69494195,"user":{"login":"kmpm","id":96618,"avatar_url":"https://avatars.githubusercontent.com/u/96618?v=3","gravatar_id":"","url":"https://api.github.com/users/kmpm","html_url":"https://github.com/kmpm","followers_url":"https://api.github.com/users/kmpm/followers","following_url":"https://api.github.com/users/kmpm/following{/other_user}","gists_url":"https://api.github.com/users/kmpm/gists{/gist_id}","starred_url":"https://api.github.com/users/kmpm/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/kmpm/subscriptions","organizations_url":"https://api.github.com/users/kmpm/orgs","repos_url":"https://api.github.com/users/kmpm/repos","events_url":"https://api.github.com/users/kmpm/events{/privacy}","received_events_url":"https://api.github.com/users/kmpm/received_events","type":"User","site_admin":false},"created_at":"2015-01-11T13:20:21Z","updated_at":"2015-01-11T13:20:21Z","body":"Made my own similar implementation for use in https://github.com/kmpm/nodemcu-uploader\r\n```\r\nfunction recv_block(d)\r\n  if string.byte(d, 1) == 1 then\r\n    size = string.byte(d, 2)\r\n    if size > 0 then\r\n      file.write(string.sub(d, 3, 3+size))\r\n      uart.write(0,'\\006')\r\n    else\r\n      uart.write(0,'\\006')\r\n      file.close()\r\n      uart.on('data')\r\n      uart.setup(0,9600,8,0,1,1)\r\n    end\r\n  else\r\n    uart.write(0, '\\021' .. d)\r\n    uart.setup(0,9600,8,0,1,1)\r\n    uart.on('data')\r\n  end\r\nend\r\nfunction recv_name(d)\r\n  d = string.gsub(d, '\\000', '')\r\n  file.remove(d)\r\n  file.open(d, 'w')\r\n  uart.on('data', 130, recv_block, 0)\r\n  uart.write(0, '\\006')\r\nend\r\nfunction recv()\r\n  uart.setup(0,9600,8,0,1,0)\r\n  uart.on('data', '\\000', recv_name, 0)\r\n  uart.write(0, 'C')\r\nend\r\n```\r\n"}}