mirror of
https://github.com/Doodle3D/doodle3d-firmware.git
synced 2024-12-22 11:03:48 +01:00
Change levels and improve consistency in log statements.
This commit is contained in:
parent
5f59e5e2c9
commit
1439bd0434
19
src/main.lua
19
src/main.lua
@ -227,31 +227,32 @@ local function main(environment)
|
|||||||
local version = updater.formatVersion(updater.getCurrentVersion());
|
local version = updater.formatVersion(updater.getCurrentVersion());
|
||||||
log:info(MOD_ABBR, "Doodle3D version: "..util.dump(version))
|
log:info(MOD_ABBR, "Doodle3D version: "..util.dump(version))
|
||||||
|
|
||||||
log:info(MOD_ABBR, "running in autowifi mode")
|
log:info(MOD_ABBR, "Running in autowifi mode")
|
||||||
local rv,msg = setupAutoWifiMode()
|
local rv,msg = setupAutoWifiMode()
|
||||||
|
|
||||||
if rv then
|
if rv then
|
||||||
log:info(MOD_ABBR, "autowifi setup done (" .. msg .. ")")
|
log:info(MOD_ABBR, "Autowifi setup done (" .. msg .. ")")
|
||||||
else
|
else
|
||||||
log:error(MOD_ABBR, "autowifi setup failed (" .. msg .. ")")
|
log:error(MOD_ABBR, "Autowifi setup failed (" .. msg .. ")")
|
||||||
end
|
end
|
||||||
elseif rq:getRequestMethod() == 'CMDLINE' and rq:get('signin') ~= nil then
|
elseif rq:getRequestMethod() == 'CMDLINE' and rq:get('signin') ~= nil then
|
||||||
log:info(MOD_ABBR, "running in signin mode")
|
log:info(MOD_ABBR, "Running in signin mode")
|
||||||
|
|
||||||
local ds = wifi.getDeviceState()
|
local ds = wifi.getDeviceState()
|
||||||
log:info(MOD_ABBR, " ds.mode: "..util.dump(ds.mode))
|
log:info(MOD_ABBR, " wifi deviceState.mode: "..util.dump(ds.mode))
|
||||||
if ds.mode == "sta" then
|
if ds.mode == "sta" then
|
||||||
log:info(MOD_ABBR, " attempting signin")
|
log:info(MOD_ABBR, " attempting signin")
|
||||||
local success,msg = Signin.signin()
|
local success,msg = Signin.signin()
|
||||||
if success then
|
if success then
|
||||||
log:info(MOD_ABBR, "Signin successful")
|
log:info(MOD_ABBR, "Signin successful")
|
||||||
else
|
else
|
||||||
log:info(MOD_ABBR, "Signin failed: "..util.dump(msg))
|
log:warning(MOD_ABBR, "Signin failed: "..util.dump(msg))
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
elseif rq:getRequestMethod() ~= 'CMDLINE' or confDefaults.DEBUG_API then
|
elseif rq:getRequestMethod() ~= 'CMDLINE' or confDefaults.DEBUG_API then
|
||||||
-- log:info(MOD_ABBR, "received request of type " .. rq:getRequestMethod() .. " for " .. (rq:getRequestedApiModule() or "<unknown>")
|
-- Note: the commented log statement will print too many data if it's for instance dumping a gcode add request
|
||||||
-- .. "/" .. (rq:getRealApiFunctionName() or "<unknown>") .. " with arguments: " .. util.dump(rq:getAll()))
|
--log:info(MOD_ABBR, "received request of type " .. rq:getRequestMethod() .. " for " .. (rq:getRequestedApiModule() or "<unknown>")
|
||||||
|
-- .. "/" .. (rq:getRealApiFunctionName() or "<unknown>") .. " with arguments: " .. util.dump(rq:getAll()))
|
||||||
log:info(MOD_ABBR, "received request of type " .. rq:getRequestMethod() .. " for " .. (rq:getRequestedApiModule() or "<unknown>")
|
log:info(MOD_ABBR, "received request of type " .. rq:getRequestMethod() .. " for " .. (rq:getRequestedApiModule() or "<unknown>")
|
||||||
.. "/" .. (rq:getRealApiFunctionName() or "<unknown>"))
|
.. "/" .. (rq:getRealApiFunctionName() or "<unknown>"))
|
||||||
if rq:getRequestMethod() ~= 'CMDLINE' then
|
if rq:getRequestMethod() ~= 'CMDLINE' then
|
||||||
@ -287,7 +288,7 @@ function handle_request(env)
|
|||||||
|
|
||||||
resp:setError("initialization failed" .. errSuffix)
|
resp:setError("initialization failed" .. errSuffix)
|
||||||
resp:send()
|
resp:send()
|
||||||
log:error(MOD_ABBR, "initialization failed" .. errSuffix) --NOTE: this assumes the logger has been initialized properly, despite init() having failed
|
log:error(MOD_ABBR, "Initialization failed" .. errSuffix) --NOTE: this assumes the logger has been initialized properly, despite init() having failed
|
||||||
|
|
||||||
return 1
|
return 1
|
||||||
else
|
else
|
||||||
|
@ -64,7 +64,7 @@ function M.switchConfiguration(components)
|
|||||||
for k,v in pairs(components) do
|
for k,v in pairs(components) do
|
||||||
local fname = k .. '_' .. v
|
local fname = k .. '_' .. v
|
||||||
if type(reconf[fname]) == 'function' then
|
if type(reconf[fname]) == 'function' then
|
||||||
log:verbose(MOD_ABBR, "reconfiguring component '" .. k .. "' (" .. v .. ")")
|
log:info(MOD_ABBR, "reconfiguring component '" .. k .. "' (" .. v .. ")")
|
||||||
reconf[fname](dirtyList)
|
reconf[fname](dirtyList)
|
||||||
else
|
else
|
||||||
log:warning(MOD_ABBR, "unknown component or action '" .. fname .. "' skipped")
|
log:warning(MOD_ABBR, "unknown component or action '" .. fname .. "' skipped")
|
||||||
@ -94,7 +94,7 @@ function M.reloadComponent(c, silent)
|
|||||||
os.execute(cmd)
|
os.execute(cmd)
|
||||||
else
|
else
|
||||||
rv = utils.captureCommandOutput(cmd)
|
rv = utils.captureCommandOutput(cmd)
|
||||||
log:verbose(MOD_ABBR, " result reloading component '" .. c .. "' (cmd: '"..cmd.."'): \n"..utils.dump(rv))
|
log:info(MOD_ABBR, " result reloading component '" .. c .. "' (cmd: '"..cmd.."'): \n"..utils.dump(rv))
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
@ -215,7 +215,7 @@ function reconf.dnsredir_add(dirtyList)
|
|||||||
local redirText = '/#/' .. settings.get('network.ap.address')
|
local redirText = '/#/' .. settings.get('network.ap.address')
|
||||||
local sname = utils.getUciSectionName('dhcp', 'dnsmasq')
|
local sname = utils.getUciSectionName('dhcp', 'dnsmasq')
|
||||||
if sname == nil then return log:error(MOD_ABBR, "dhcp config does not contain a dnsmasq section") end
|
if sname == nil then return log:error(MOD_ABBR, "dhcp config does not contain a dnsmasq section") end
|
||||||
if uci:get('dhcp', sname, 'address') ~= nil then return log:verbose(MOD_ABBR, "DNS address redirection already in place, not re-adding", false) end
|
if uci:get('dhcp', sname, 'address') ~= nil then return log:info(MOD_ABBR, "DNS address redirection already in place, not re-adding", false) end
|
||||||
|
|
||||||
uci:set('dhcp', sname, 'address', {redirText})
|
uci:set('dhcp', sname, 'address', {redirText})
|
||||||
commitBit(dirtyList, 'dhcp'); reloadBit(dirtyList, 'dnsmasq')
|
commitBit(dirtyList, 'dhcp'); reloadBit(dirtyList, 'dnsmasq')
|
||||||
@ -232,7 +232,7 @@ end
|
|||||||
--TODO: handle os.rename() return values (nil+msg on error)
|
--TODO: handle os.rename() return values (nil+msg on error)
|
||||||
function reconf.wwwcaptive_add(dirtyList)
|
function reconf.wwwcaptive_add(dirtyList)
|
||||||
if utils.exists(M.WWW_CAPTIVE_INDICATOR) then
|
if utils.exists(M.WWW_CAPTIVE_INDICATOR) then
|
||||||
return log:verbose(MOD_ABBR, "WWW captive directory already in place, not redoing", false)
|
return log:info(MOD_ABBR, "WWW captive directory already in place, not redoing", false)
|
||||||
end
|
end
|
||||||
local rv,reason = os.rename('/www', M.WWW_RENAME_NAME)
|
local rv,reason = os.rename('/www', M.WWW_RENAME_NAME)
|
||||||
if rv == true then
|
if rv == true then
|
||||||
@ -243,7 +243,7 @@ function reconf.wwwcaptive_add(dirtyList)
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
function reconf.wwwcaptive_rm(dirtyList)
|
function reconf.wwwcaptive_rm(dirtyList)
|
||||||
if not utils.exists(M.WWW_CAPTIVE_INDICATOR) then return log:verbose(MOD_ABBR, "WWW captive directory not in place, not undoing", false) end
|
if not utils.exists(M.WWW_CAPTIVE_INDICATOR) then return log:info(MOD_ABBR, "WWW captive directory not in place, not undoing", false) end
|
||||||
os.remove('/www')
|
os.remove('/www')
|
||||||
if os.rename(M.WWW_RENAME_NAME, '/www') ~= true then
|
if os.rename(M.WWW_RENAME_NAME, '/www') ~= true then
|
||||||
return log:error(MOD_ABBR, "Could not rename " .. M.WWW_RENAME_NAME .. " to /www")
|
return log:error(MOD_ABBR, "Could not rename " .. M.WWW_RENAME_NAME .. " to /www")
|
||||||
@ -290,7 +290,8 @@ function M.setupAccessPoint(ssid)
|
|||||||
local ds = wifi.getDeviceState()
|
local ds = wifi.getDeviceState()
|
||||||
--log:info(MOD_ABBR, " network/status: ")
|
--log:info(MOD_ABBR, " network/status: ")
|
||||||
log:info(MOD_ABBR, " ssid: ".. utils.dump(ds.ssid))
|
log:info(MOD_ABBR, " ssid: ".. utils.dump(ds.ssid))
|
||||||
--[[log:info(MOD_ABBR, " bssid: ".. utils.dump(ds.bssid))
|
--[[
|
||||||
|
log:info(MOD_ABBR, " bssid: ".. utils.dump(ds.bssid))
|
||||||
log:info(MOD_ABBR, " channel: ".. utils.dump(ds.channel))
|
log:info(MOD_ABBR, " channel: ".. utils.dump(ds.channel))
|
||||||
log:info(MOD_ABBR, " mode: ".. utils.dump(ds.mode))
|
log:info(MOD_ABBR, " mode: ".. utils.dump(ds.mode))
|
||||||
log:info(MOD_ABBR, " encryption: ".. utils.dump(ds.encryption))
|
log:info(MOD_ABBR, " encryption: ".. utils.dump(ds.encryption))
|
||||||
@ -302,7 +303,8 @@ function M.setupAccessPoint(ssid)
|
|||||||
log:info(MOD_ABBR, " raw: ".. utils.dump(ds))
|
log:info(MOD_ABBR, " raw: ".. utils.dump(ds))
|
||||||
|
|
||||||
local localip = wifi.getLocalIP()
|
local localip = wifi.getLocalIP()
|
||||||
log:info(MOD_ABBR, " localip: "..utils.dump(localip))]]--
|
log:info(MOD_ABBR, " localip: "..utils.dump(localip))
|
||||||
|
--]]
|
||||||
|
|
||||||
return true
|
return true
|
||||||
end
|
end
|
||||||
@ -313,13 +315,13 @@ end
|
|||||||
-- @tparam string ssid The SSID to use for the access point.
|
-- @tparam string ssid The SSID to use for the access point.
|
||||||
-- @return True on success or nil+msg on error.
|
-- @return True on success or nil+msg on error.
|
||||||
function M.enableAccessPoint(ssid)
|
function M.enableAccessPoint(ssid)
|
||||||
log:verbose(MOD_ABBR, "enableAccessPoint ssid: ".. utils.dump(ssid))
|
log:info(MOD_ABBR, "enableAccessPoint ssid: ".. utils.dump(ssid))
|
||||||
|
|
||||||
M.switchConfiguration{apnet="add_noreload"}
|
M.switchConfiguration{apnet="add_noreload"}
|
||||||
wifi.activateConfig(ssid)
|
wifi.activateConfig(ssid)
|
||||||
|
|
||||||
local ds = wifi.getDeviceState()
|
local ds = wifi.getDeviceState()
|
||||||
log:verbose(MOD_ABBR, " ssid: ".. utils.dump(ds.ssid))
|
log:info(MOD_ABBR, " deviceState.ssid: ".. utils.dump(ds.ssid))
|
||||||
|
|
||||||
return true
|
return true
|
||||||
end
|
end
|
||||||
@ -392,6 +394,7 @@ function M.associateSsid(ssid, passphrase, recreate)
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
log:info(MOD_ABBR, "Network associated")
|
||||||
|
|
||||||
-- signin to connect.doodle3d.com
|
-- signin to connect.doodle3d.com
|
||||||
local success, output = signin.signin()
|
local success, output = signin.signin()
|
||||||
@ -426,11 +429,9 @@ function M.getStatus()
|
|||||||
return "",""
|
return "",""
|
||||||
else
|
else
|
||||||
local status = file:read('*a')
|
local status = file:read('*a')
|
||||||
--log:info(MOD_ABBR, " status: "..utils.dump(status))
|
|
||||||
file:close()
|
file:close()
|
||||||
local code, msg = string.match(status, '([^|]+)|+(.*)')
|
local code, msg = string.match(status, '([^|]+)|+(.*)')
|
||||||
--log:info(MOD_ABBR, " code: "..utils.dump(code))
|
log:verbose(MOD_ABBR, " raw status: "..utils.dump(status).." (code: "..utils.dump(code)..", msg: "..utils.dump(msg)..")")
|
||||||
--log:info(MOD_ABBR, " msg: "..utils.dump(msg))
|
|
||||||
return code,msg
|
return code,msg
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
@ -54,7 +54,7 @@ function M.signin()
|
|||||||
local signinResponse = ""
|
local signinResponse = ""
|
||||||
while true do
|
while true do
|
||||||
if os.time() > nextAttemptTime then
|
if os.time() > nextAttemptTime then
|
||||||
log:verbose(MOD_ABBR, "signin attempt "..utils.dump(attempt).."/"..utils.dump(maxAttempts))
|
log:verbose(MOD_ABBR, " signin attempt "..utils.dump(attempt).."/"..utils.dump(maxAttempts))
|
||||||
local signedin = false
|
local signedin = false
|
||||||
local localip = wifi.getLocalIP();
|
local localip = wifi.getLocalIP();
|
||||||
--log:verbose(MOD_ABBR, " localip: "..utils.dump(localip))
|
--log:verbose(MOD_ABBR, " localip: "..utils.dump(localip))
|
||||||
@ -71,10 +71,10 @@ function M.signin()
|
|||||||
if success ~= nil then
|
if success ~= nil then
|
||||||
signedin = true
|
signedin = true
|
||||||
else
|
else
|
||||||
log:warning(MOD_ABBR, "signin failed request failed (response: "..utils.dump(signinResponse)..")")
|
log:warning(MOD_ABBR, "signin failed, request failed (response: "..utils.dump(signinResponse)..")")
|
||||||
end
|
end
|
||||||
else
|
else
|
||||||
log:warning(MOD_ABBR, "signin failed no local ip found (attempt: "..utils.dump(attempt).."/"..utils.dump(maxAttempts)..")")
|
log:warning(MOD_ABBR, "signin failed, no local ip found (attempt: "..utils.dump(attempt).."/"..utils.dump(maxAttempts)..")")
|
||||||
end
|
end
|
||||||
|
|
||||||
if signedin then
|
if signedin then
|
||||||
|
@ -128,7 +128,7 @@ end
|
|||||||
--returns the wireless local ip address
|
--returns the wireless local ip address
|
||||||
function M.getLocalIP()
|
function M.getLocalIP()
|
||||||
local ifconfig, rv = utils.captureCommandOutput("ifconfig wlan0");
|
local ifconfig, rv = utils.captureCommandOutput("ifconfig wlan0");
|
||||||
--log:verbose(MOD_ABBR, " ifconfig: \n"..utils.dump(ifconfig));
|
log:bulk(MOD_ABBR, " ifconfig: \n"..utils.dump(ifconfig));
|
||||||
|
|
||||||
local localip = ifconfig:match('inet addr:([%d%.]+)')
|
local localip = ifconfig:match('inet addr:([%d%.]+)')
|
||||||
return localip
|
return localip
|
||||||
@ -189,12 +189,12 @@ end
|
|||||||
--- Activate wireless section for given SSID and disable all others
|
--- Activate wireless section for given SSID and disable all others
|
||||||
-- @param ssid SSID of config to enable, or nil to disable all network configs
|
-- @param ssid SSID of config to enable, or nil to disable all network configs
|
||||||
function M.activateConfig(ssid)
|
function M.activateConfig(ssid)
|
||||||
--log:info(MOD_ABBR, "wlanconfig.activateConfig: "..ssid);
|
log:verbose(MOD_ABBR, "wlanconfig.activateConfig: "..ssid);
|
||||||
|
|
||||||
-- make sure only one is enabled
|
-- make sure only one is enabled
|
||||||
uci:foreach('wireless', 'wifi-iface', function(s)
|
uci:foreach('wireless', 'wifi-iface', function(s)
|
||||||
local disabled = s.ssid ~= ssid and '1' or '0'
|
local disabled = s.ssid ~= ssid and '1' or '0'
|
||||||
--log:info(MOD_ABBR, " "..utils.dump(s.ssid).." disable: "..utils.dump(disabled))
|
log:verbose(MOD_ABBR, " ssid: "..utils.dump(s.ssid).." disabled: "..utils.dump(disabled))
|
||||||
uci:set('wireless', s['.name'], 'disabled', disabled)
|
uci:set('wireless', s['.name'], 'disabled', disabled)
|
||||||
end)
|
end)
|
||||||
|
|
||||||
@ -212,11 +212,14 @@ function M.activateConfig(ssid)
|
|||||||
return false
|
return false
|
||||||
end
|
end
|
||||||
end)
|
end)
|
||||||
--[[log:info(MOD_ABBR, " result:");
|
|
||||||
|
--[[
|
||||||
|
log:verbose(MOD_ABBR, " wifi reorder result:");
|
||||||
uci:foreach('wireless', 'wifi-iface', function(s)
|
uci:foreach('wireless', 'wifi-iface', function(s)
|
||||||
local disabled = s.ssid ~= ssid and '1' or '0'
|
local disabled = s.ssid ~= ssid and '1' or '0'
|
||||||
log:info(MOD_ABBR, " "..utils.dump(s.ssid).." disable: "..utils.dump(disabled))
|
log:verbose(MOD_ABBR, " ssid: "..utils.dump(s.ssid).." disabled: "..utils.dump(disabled))
|
||||||
end)]]--
|
end)
|
||||||
|
--]]
|
||||||
|
|
||||||
uci:commit('wireless')
|
uci:commit('wireless')
|
||||||
end
|
end
|
||||||
|
@ -59,7 +59,7 @@ end
|
|||||||
-- returns substituted_wifiboxid (since version 0.10.2)
|
-- returns substituted_wifiboxid (since version 0.10.2)
|
||||||
-- returns substituted_ssid (since version 0.9.1)
|
-- returns substituted_ssid (since version 0.9.1)
|
||||||
function M._global_POST(request, response)
|
function M._global_POST(request, response)
|
||||||
--log:info(MOD_ABBR, "API:config:set")
|
log:verbose(MOD_ABBR, "API:config(set)")
|
||||||
|
|
||||||
if not operationsAccessOrFail(request, response) then return end
|
if not operationsAccessOrFail(request, response) then return end
|
||||||
|
|
||||||
@ -67,14 +67,14 @@ function M._global_POST(request, response)
|
|||||||
|
|
||||||
local validation = {}
|
local validation = {}
|
||||||
for k,v in pairs(request:getAll()) do
|
for k,v in pairs(request:getAll()) do
|
||||||
--log:info(MOD_ABBR, " "..k..": "..v);
|
log:verbose(MOD_ABBR, " about to set '"..k.."' -> '"..v.."'");
|
||||||
local r,m = settings.set(k, v, true)
|
local r,m = settings.set(k, v, true)
|
||||||
|
|
||||||
if r then
|
if r then
|
||||||
validation[k] = "ok"
|
validation[k] = "ok"
|
||||||
elseif r == false then
|
elseif r == false then
|
||||||
validation[k] = "could not save setting ('" .. m .. "')"
|
validation[k] = "could not save setting ('" .. m .. "')"
|
||||||
log:info(MOD_ABBR, " m: "..utils.dump(m))
|
log:info(MOD_ABBR, " failed to set '"..k.."' ("..utils.dump(m)..")")
|
||||||
elseif r == nil then
|
elseif r == nil then
|
||||||
settings.commit()
|
settings.commit()
|
||||||
response:setError(m)
|
response:setError(m)
|
||||||
@ -111,7 +111,7 @@ end
|
|||||||
-- and printer.type is set to 'ultimaker' then
|
-- and printer.type is set to 'ultimaker' then
|
||||||
-- only the printer.startcode under the ultimaker subsection is removed.
|
-- only the printer.startcode under the ultimaker subsection is removed.
|
||||||
function M.reset_POST(request, response)
|
function M.reset_POST(request, response)
|
||||||
--log:info(MOD_ABBR, "API:reset");
|
--log:verbose(MOD_ABBR, "API:config/reset")
|
||||||
if not operationsAccessOrFail(request, response) then return end
|
if not operationsAccessOrFail(request, response) then return end
|
||||||
response:setSuccess()
|
response:setSuccess()
|
||||||
|
|
||||||
@ -120,9 +120,11 @@ function M.reset_POST(request, response)
|
|||||||
local r,m = settings.reset(k);
|
local r,m = settings.reset(k);
|
||||||
if r ~= nil then
|
if r ~= nil then
|
||||||
response:addData(k, "ok")
|
response:addData(k, "ok")
|
||||||
|
log:verbose(MOD_ABBR, " reset " .. k)
|
||||||
else
|
else
|
||||||
response:addData(k, "could not reset key ('" .. m .. "')")
|
response:addData(k, "could not reset key ('" .. m .. "')")
|
||||||
response:setError(m)
|
response:setError(m)
|
||||||
|
log:verbose(MOD_ABBR, " could not reset key " .. k .. "(" .. m .. ")")
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
@ -203,14 +203,14 @@ function M.remove_POST(request, response)
|
|||||||
end
|
end
|
||||||
|
|
||||||
function M.signin(request, response)
|
function M.signin(request, response)
|
||||||
log:info(MOD_ABBR, "API:Network:signin")
|
log:info(MOD_ABBR, "API:network/signin")
|
||||||
local success, output = signin.signin()
|
local success, output = signin.signin()
|
||||||
if success then
|
if success then
|
||||||
log:info(MOD_ABBR, "API:Network:signed in")
|
log:info(MOD_ABBR, " signed in")
|
||||||
response:setSuccess("API:Network:signed in")
|
response:setSuccess("API:Network:signed in")
|
||||||
response:addData("response", output)
|
response:addData("response", output)
|
||||||
else
|
else
|
||||||
log:info(MOD_ABBR, "API:Network:Signing in failed")
|
log:info(MOD_ABBR, "signing in failed")
|
||||||
response:setError("Signing in failed")
|
response:setError("Signing in failed")
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
@ -166,6 +166,7 @@ end
|
|||||||
--accepts: first(bool) (chunks will be concatenated but output file will be cleared first if this argument is true)
|
--accepts: first(bool) (chunks will be concatenated but output file will be cleared first if this argument is true)
|
||||||
--accepts: start(bool) (only when this argument is true will printing be started)
|
--accepts: start(bool) (only when this argument is true will printing be started)
|
||||||
function M.print_POST(request, response)
|
function M.print_POST(request, response)
|
||||||
|
log:info(MOD_ABBR, "API:printer/print")
|
||||||
|
|
||||||
local controllerIP = accessManager.getController()
|
local controllerIP = accessManager.getController()
|
||||||
local hasControl = false
|
local hasControl = false
|
||||||
@ -198,7 +199,7 @@ function M.print_POST(request, response)
|
|||||||
end
|
end
|
||||||
|
|
||||||
if argIsFirst == true then
|
if argIsFirst == true then
|
||||||
log:verbose(MOD_ABBR, "clearing all gcode for " .. printer:getId())
|
log:verbose(MOD_ABBR, " clearing all gcode for " .. printer:getId())
|
||||||
response:addData('gcode_clear',true)
|
response:addData('gcode_clear',true)
|
||||||
local rv,msg = printer:clearGcode()
|
local rv,msg = printer:clearGcode()
|
||||||
|
|
||||||
|
@ -31,7 +31,7 @@ local SKETCH_FILE_EXTENSION = 'svg'
|
|||||||
-- creates sketch directory, and sets response to error state on failure
|
-- creates sketch directory, and sets response to error state on failure
|
||||||
local function createSketchDirectory()
|
local function createSketchDirectory()
|
||||||
if os.execute('mkdir -p ' .. M.SKETCH_DIR) ~= 0 then
|
if os.execute('mkdir -p ' .. M.SKETCH_DIR) ~= 0 then
|
||||||
log:error(MOD_ABBR, "Error: could not create sketch directory '" .. M.SKETCH_DIR .. "'")
|
log:error(MOD_ABBR, "could not create sketch directory '" .. M.SKETCH_DIR .. "'")
|
||||||
response:setError("could not create sketch directory")
|
response:setError("could not create sketch directory")
|
||||||
return false
|
return false
|
||||||
end
|
end
|
||||||
|
Loading…
Reference in New Issue
Block a user