Fixes, fixes
This commit is contained in:
parent
596d9dd06b
commit
a51a4d929b
40
Makefile
40
Makefile
@ -1,4 +1,3 @@
|
|||||||
<<<<<<< HEAD:Makefile
|
|
||||||
######################################################################
|
######################################################################
|
||||||
# User configuration
|
# User configuration
|
||||||
######################################################################
|
######################################################################
|
||||||
@ -32,42 +31,3 @@ upload_server: $(LUA_FILES)
|
|||||||
upload: $(LUA_FILES) $(HTTP_FILES)
|
upload: $(LUA_FILES) $(HTTP_FILES)
|
||||||
@$(NODEMCU-UPLOADER) -b $(SPEED) -p $(PORT) upload $(foreach f, $^, $(f))
|
@$(NODEMCU-UPLOADER) -b $(SPEED) -p $(PORT) upload $(foreach f, $^, $(f))
|
||||||
|
|
||||||
#test
|
|
||||||
test: $(LUA_FILES) $(HTTP_FILES)
|
|
||||||
echo -b $(SPEED) -p $(PORT) upload $(foreach f, $^, -f $(f) -d $(f))
|
|
||||||
=======
|
|
||||||
######################################################################
|
|
||||||
# User configuration
|
|
||||||
######################################################################
|
|
||||||
# Path to nodemcu-uploader (https://github.com/kmpm/nodemcu-uploader)
|
|
||||||
NODEMCU-UPLOADER=../nodemcu-uploader/nodemcu-uploader.py
|
|
||||||
# Serial port
|
|
||||||
PORT=/dev/cu.usbserial-A602HRAZ
|
|
||||||
# Bauds for the serial connection
|
|
||||||
SPEED=115200
|
|
||||||
|
|
||||||
######################################################################
|
|
||||||
# End of user config
|
|
||||||
######################################################################
|
|
||||||
HTTP_FILES := $(wildcard http/*)
|
|
||||||
LUA_FILES := init.lua httpserver.lua httpserver-request.lua httpserver-static.lua httpserver-error.lua
|
|
||||||
|
|
||||||
# Print usage
|
|
||||||
usage:
|
|
||||||
@echo "make upload_http to upload files to be served"
|
|
||||||
@echo "make upload_server to upload the server code and init.lua"
|
|
||||||
@echo "make upload to upload all"
|
|
||||||
|
|
||||||
# Upload HTTP files only
|
|
||||||
upload_http: $(HTTP_FILES)
|
|
||||||
@$(NODEMCU-UPLOADER) -b $(SPEED) -p $(PORT) upload $(foreach f, $^, $(f))
|
|
||||||
|
|
||||||
# Upload httpserver lua files (init and server module)
|
|
||||||
upload_server: $(LUA_FILES)
|
|
||||||
@$(NODEMCU-UPLOADER) -b $(SPEED) -p $(PORT) upload $(foreach f, $^, $(f))
|
|
||||||
|
|
||||||
# Upload all
|
|
||||||
upload: $(LUA_FILES) $(HTTP_FILES)
|
|
||||||
@$(NODEMCU-UPLOADER) -b $(SPEED) -p $(PORT) upload $(foreach f, $^, $(f))
|
|
||||||
|
|
||||||
>>>>>>> 2357415466bb24cba8ee33109146f6a6a2df0282:makefile
|
|
||||||
|
|||||||
@ -43,11 +43,7 @@ local function parseUri(uri)
|
|||||||
filename,ext = filename:match("(.+)%.(.+)")
|
filename,ext = filename:match("(.+)%.(.+)")
|
||||||
table.insert(fullExt,1,ext)
|
table.insert(fullExt,1,ext)
|
||||||
end
|
end
|
||||||
r.ext = table.concat(fullExt,".")
|
r.ext = table.concat(fullExt,".")
|
||||||
|
|
||||||
-- _, r.ext = r.file:match("(.+)%.(.+)")
|
|
||||||
|
|
||||||
|
|
||||||
r.isScript = r.ext == "lua" or r.ext == "lc"
|
r.isScript = r.ext == "lua" or r.ext == "lc"
|
||||||
r.file = uriToFilename(r.file)
|
r.file = uriToFilename(r.file)
|
||||||
return r
|
return r
|
||||||
|
|||||||
@ -25,7 +25,6 @@ local function sendHeader(connection, code, codeString, mimeType)
|
|||||||
end
|
end
|
||||||
|
|
||||||
return function (connection, args)
|
return function (connection, args)
|
||||||
--print(args.ext)
|
|
||||||
sendHeader(connection, 200, "OK", getMimeType(args.ext))
|
sendHeader(connection, 200, "OK", getMimeType(args.ext))
|
||||||
--print("Begin sending:", args.file)
|
--print("Begin sending:", args.file)
|
||||||
-- Send file in little chunks
|
-- Send file in little chunks
|
||||||
|
|||||||
3
init.lua
3
init.lua
@ -7,7 +7,7 @@ print('chip: ',node.chipid())
|
|||||||
print('heap: ',node.heap())
|
print('heap: ',node.heap())
|
||||||
|
|
||||||
|
|
||||||
cfg={}
|
local cfg={}
|
||||||
cfg.ssid="ESP-"..node.chipid()
|
cfg.ssid="ESP-"..node.chipid()
|
||||||
cfg.pwd="ESP-"..node.chipid()
|
cfg.pwd="ESP-"..node.chipid()
|
||||||
wifi.ap.config(cfg)
|
wifi.ap.config(cfg)
|
||||||
@ -19,6 +19,7 @@ cfg = nil
|
|||||||
local compileAndRemoveIfNeeded = function(f)
|
local compileAndRemoveIfNeeded = function(f)
|
||||||
if file.open(f) then
|
if file.open(f) then
|
||||||
file.close()
|
file.close()
|
||||||
|
print(f)
|
||||||
node.compile(f)
|
node.compile(f)
|
||||||
file.remove(f)
|
file.remove(f)
|
||||||
end
|
end
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user