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 nodemcu-tool upload option #130

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 14 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -3,15 +3,26 @@
######################################################################

# Path to nodemcu-uploader (https://github.com/kmpm/nodemcu-uploader)
NODEMCU-UPLOADER?=python ../nodemcu-uploader/nodemcu-uploader.py
NODEMCU_UPLOADER?=python ../nodemcu-uploader/nodemcu-uploader.py

# Path to nodemcu-tool (https://github.com/AndiDittrich/NodeMCU-Tool)
NODEMCU_TOOL?=../nodemcu-tool/node_modules/nodemcu-tool/bin/nodemcu-tool.js

USE_NODEMCU_TOOL?=

# Serial port
PORT?=/dev/cu.SLAB_USBtoUART
SPEED?=115200

ifdef USE_NODEMCU_TOOL
define _upload
@$(NODEMCU_TOOL) -b $(SPEED) --baud $(SPEED) -p $(PORT) upload --keeppath $^
endef
else
define _upload
@$(NODEMCU-UPLOADER) -b $(SPEED) --start_baud $(SPEED) -p $(PORT) upload $^
@$(NODEMCU_UPLOADER) -b $(SPEED) --start_baud $(SPEED) -p $(PORT) upload $^
endef
endif

######################################################################

Expand Down Expand Up @@ -62,5 +73,6 @@ upload_all_lfs: $(HTTP_FILES) $(LFS_FILES) $(WIFI_CONFIG)
$(_upload)

.ENTRY: usage
MAKEFLAGS: --always-make
.PHONY: usage upload_http upload_server upload_wifi_config \
upload_lfs upload_all upload_all_lfs
6 changes: 5 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ Let the abuse begin.

1. Modify your local copy of the configuration file httpserver-conf.lua.

2. Upload server files using [nodemcu-uploader](https://github.com/kmpm/nodemcu-uploader).
2. Upload server files using [nodemcu-uploader](https://github.com/kmpm/nodemcu-uploader) or [nodemcu-tool](https://github.com/AndiDittrich/NodeMCU-Tool).
The easiest is to use GNU Make with the bundled Makefile. Open the Makefile and modify the
user configuration to point to your nodemcu-uploader script and your serial port.
Type the following to upload the server code, init.lua (which you may want to modify),
Expand All @@ -49,6 +49,10 @@ Let the abuse begin.
Restart the server. This will execute included init.lua which will compile the server code,
configure WiFi, and start the server.

nodemcu-uploader is used by default. In order to switch to nodemcu-tool, use option `USE_NODEMCU_TOOL`. For example, to upload wifi configuration using nodemcu-tool, use command:

make upload_wifi_config USE_NODEMCU_TOOL=1

3. Want to serve your own files? Put them under the http/ folder and upload to the chip.
For example, assuming you want to serve myfile.html, upload by typing:

Expand Down