mirror of
https://github.com/Doodle3D/doodle3d-firmware.git
synced 2024-12-22 11:03:48 +01:00
Fix dhcp address serving in AP mode; small fix in printer API.
This commit is contained in:
parent
68f72565fe
commit
6f431942cc
@ -86,6 +86,9 @@ function reconf.network_reload(dirtyList) reloadBit(dirtyList, 'network') end
|
||||
--[[ Issue '/etc/init.d/wireless reload' command ]]
|
||||
function reconf.wireless_reload(dirtyList) reloadBit(dirtyList, 'wireless') end
|
||||
|
||||
--[[ Issue '/etc/init.d/dnsmasq reload' command ]]
|
||||
function reconf.dhcp_reload(dirtyList) reloadBit(dirtyList, 'dnsmasq') end
|
||||
|
||||
--[[ Add wlan interface declaration to /etc/config/network ]]
|
||||
function reconf.wifiiface_add(dirtyList)
|
||||
uci:set('network', wifi.NET, 'interface')
|
||||
@ -149,7 +152,8 @@ end
|
||||
|
||||
|
||||
--[[ Add/remove DHCP pool for wireless net ]]
|
||||
function reconf.dhcppool_add(dirtyList)
|
||||
function reconf.dhcppool_add_noreload(dirtyList) reconf.dhcppool_add(dirtyList, true) end
|
||||
function reconf.dhcppool_add(dirtyList, noReload)
|
||||
uci:set('dhcp', wifi.NET, 'dhcp') --create section
|
||||
M.uciTableSet('dhcp', wifi.NET, {
|
||||
interface = wifi.NET,
|
||||
@ -157,7 +161,8 @@ function reconf.dhcppool_add(dirtyList)
|
||||
limit = '150',
|
||||
leasetime = '12h',
|
||||
})
|
||||
commitBit(dirtyList, 'dhcp'); reloadBit(dirtyList, 'dnsmasq')
|
||||
commitBit(dirtyList, 'dhcp');
|
||||
if noReload == nil or noReload == false then reloadBit(dirtyList, 'dnsmasq') end
|
||||
end
|
||||
function reconf.dhcppool_rm(dirtyList)
|
||||
uci:delete('dhcp', wifi.NET)
|
||||
|
@ -145,7 +145,9 @@ function M.openap_POST(request, response)
|
||||
local ssid = wifi.getSubstitutedSsid(settings.get('network.ap.ssid'))
|
||||
netconf.switchConfiguration{apnet="add_noreload"}
|
||||
wifi.activateConfig(ssid)
|
||||
netconf.switchConfiguration{ wifiiface="add", network="reload", staticaddr="add", dhcppool="add", wwwredir="add", dnsredir="add" }
|
||||
-- NOTE: dnsmasq must be reloaded after network or it will be unable to serve IP addresses
|
||||
netconf.switchConfiguration{ wifiiface="add", network="reload", staticaddr="add", dhcppool="add_noreload", wwwredir="add", dnsredir="add" }
|
||||
netconf.switchConfiguration{dhcp="reload"}
|
||||
response:setSuccess("switched to Access Point mode")
|
||||
response:addData("ssid", ssid)
|
||||
end
|
||||
|
@ -244,7 +244,7 @@ function M.heatup_POST(request, response)
|
||||
local argId,devpath,ultipath = getPrinterDataOrFail(request, response)
|
||||
if argId == nil then return end
|
||||
|
||||
local gcode = settings.get('printer.autoWarmUpCommand').."\n";
|
||||
local gcode = settings.get('printer.autoWarmUpCommand') .. "\n"
|
||||
local rv,msg = sendGcode(ultipath, gcode)
|
||||
|
||||
if rv then
|
||||
@ -257,7 +257,6 @@ function M.heatup_POST(request, response)
|
||||
end
|
||||
end
|
||||
|
||||
--UNTESTED
|
||||
--requires id(int)
|
||||
function M.stop_POST(request, response)
|
||||
local argId,devpath,ultipath = getPrinterDataOrFail(request, response)
|
||||
@ -280,9 +279,9 @@ end
|
||||
--accepts: last(bool) (chunks will be concatenated and only when this argument is true will printing be started)
|
||||
function M.print_POST(request, response)
|
||||
local argId,devpath,ultipath = getPrinterDataOrFail(request, response)
|
||||
local gtFile = ultipath .. '/' .. GCODE_TMP_FILE
|
||||
|
||||
if argId == nil then return end
|
||||
|
||||
local gtFile = ultipath .. '/' .. GCODE_TMP_FILE
|
||||
|
||||
local argGcode = request:get("gcode")
|
||||
local argIsFirst = utils.toboolean(request:get("first"))
|
||||
|
Loading…
Reference in New Issue
Block a user