Giter VIP home page Giter VIP logo

nodemcu-uploader's Introduction

nodemcu-uploader.py

A simple tool for uploading files to the filesystem of an ESP8266 running NodeMCU as well as some other useful commands.

It should work on Linux, Windows, and OS X; and with any type of file that fits the filesystem, binary or text.

Usage

--port and --baud are set to default /dev/ttyUSB0 and 9600 respectively.

###Upload Uploading a number of files. Supports multiple files. If you want an alternate destination name, just add a colon ":" and the new destination filename.

./nodemcu-uploader.py upload init.lua README.md nodemcu-uploader.py [--compile] [--restart]

Uploading a number of files, but saving with a different file name.

./nodemcu-uploader.py upload init.lua:new_init.lua README.md:new_README.md [--compile] [--restart]

Uploading a number of files and verify successful uploading.

./nodemcu-uploader.py upload init.lua README.md nodemcu-uploader.py -v

###Download Downloading a number of files. Supports multiple files. If you want an alternate destination name, just add a colon ":" and the new destination filename.

./nodemcu-uploader.py download init.lua README.md nodemcu-uploader.py

Downloading a number of files, but saving with a different file name.

./nodemcu-uploader.py download init.lua:new_init.lua README.md:new_README.md

###List files

./nodemcu-uploader.py --port com1 file list

###Format filesystem

./nodemcu-uploader.py file format

Todo

  • Speed up the initial step of uploading the script to NodeMCU
  • Implement a change of baudrate for the actual transfer and go back when done

Details

This is almost an implementation of xmodem protocol for the upload part.

  1. Client calls the function recv()
  2. NodeMCU disables echo and send a 'C' to tell that it's ready to receive data
  3. Client sends a filename terminated with 0x00
  4. NodeMCU sends ACK
  5. Client send block of data according to the definition.
  6. Client sends ACK
  7. Step 5 and 6 are repeated until NodeMCU receives a block with 0 as size.
  8. NodeMCU enables normal terminal again with echo

Data Block Definition

SOH, size, data[128]

  • SOH = 0x01
  • Single byte telling how much of the 128 bytes data that are actually used.
  • Data padded with random bytes to fill out the 128 bytes frame.

This gives a total 130 bytes per block.

The block size was decided for...

  1. Being close to xmodem from where the inspiration came
  2. A fixed size allow the use of the uart.on('data') event very easy.
  3. 130 bytes would fit in the receive buffer buffer.
  4. It would not waste that much traffic if the total size uploaded was not a multiple of the allowed datasize.

nodemcu-uploader's People

Contributors

kmpm avatar automationd avatar jensh avatar tgfuellner avatar jonasbjurel avatar

Watchers

Martin Schuhfuss avatar James Cloos avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.