mirror of
https://github.com/Doodle3D/doodle3d-firmware.git
synced 2024-12-22 02:53:49 +01:00
Merge branch 'develop'
Conflicts: ReleaseNotes.md src/FIRMWARE-VERSION
This commit is contained in:
parent
468af0e604
commit
06e46bee65
2
.project
2
.project
@ -1,6 +1,6 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<projectDescription>
|
||||
<name>d3d-box-wifi</name>
|
||||
<name>doodle3d-firmware</name>
|
||||
<comment></comment>
|
||||
<projects>
|
||||
</projects>
|
||||
|
@ -1,5 +1,20 @@
|
||||
<<<<<<< HEAD
|
||||
=======
|
||||
|
||||
# 0.10.0 (20th jan 2014)
|
||||
- WordArt
|
||||
- Adding basic shapes
|
||||
- 2D edit functionality: move, scale, rotate
|
||||
- Vertical shape buttons in foldable menu (creating more vertical space to draw)
|
||||
- Fixed issues connecting to networks
|
||||
- Doesn't switch to access point after firmware update anymore
|
||||
- Speed and flow rate settings for bottom layers
|
||||
- Improved Makerbot gcode for better adhesion
|
||||
- Traveling disabled in bottom layers (providing sort of a poor man's raft)
|
||||
- Feedback on 'restore settings to default'-button
|
||||
- Reimplemented layout, lots of improvements
|
||||
- Re-enabled regular browser keyboard shortcuts
|
||||
- Faster click responses on iOS
|
||||
- magnifying glass on iOS is now prevented from showing up
|
||||
|
||||
# 0.9.13 (23th dec 2013)
|
||||
- Links to release notes in settings update panel, both for current version and for updateable version.
|
||||
- On finishing the tour the status message, thermometer and progress indicators are only hidden when appropriate
|
||||
@ -14,7 +29,6 @@
|
||||
- Settings can be saved even if there are printer driver issues
|
||||
- Save and restore settings issues fixed
|
||||
|
||||
>>>>>>> develop
|
||||
# 0.9.12 (18th dec 2013):
|
||||
- Refill wifibox uci settings after reset, preventing printer driver crash (#138)
|
||||
|
||||
|
39
extra/openwrt-build/openwrt-diffconfig-extramini
Normal file
39
extra/openwrt-build/openwrt-diffconfig-extramini
Normal file
@ -0,0 +1,39 @@
|
||||
CONFIG_TARGET_ar71xx=y
|
||||
CONFIG_TARGET_ar71xx_generic=y
|
||||
CONFIG_TARGET_ar71xx_generic_TLMR3020=y
|
||||
# CONFIG_BUSYBOX_CONFIG_FEATURE_IPV6 is not set
|
||||
CONFIG_DOODLE3D_CLIENT_MINIFY_JS=y
|
||||
# CONFIG_IPV6 is not set
|
||||
# CONFIG_KERNEL_DEBUG_INFO is not set
|
||||
# CONFIG_KERNEL_DEBUG_KERNEL is not set
|
||||
# CONFIG_KERNEL_KALLSYMS is not set
|
||||
# CONFIG_KERNEL_MAGIC_SYSRQ is not set
|
||||
# CONFIG_PACKAGE_6relayd is not set
|
||||
CONFIG_PACKAGE_doodle3d-client=y
|
||||
# CONFIG_PACKAGE_kmod-ip6tables is not set
|
||||
# CONFIG_PACKAGE_kmod-ipv6 is not set
|
||||
# CONFIG_PACKAGE_kmod-ppp is not set
|
||||
CONFIG_PACKAGE_kmod-usb-acm=y
|
||||
CONFIG_PACKAGE_kmod-usb-serial=y
|
||||
CONFIG_PACKAGE_kmod-usb-serial-ftdi=y
|
||||
# CONFIG_PACKAGE_libip6tc is not set
|
||||
CONFIG_PACKAGE_libiwinfo=y
|
||||
CONFIG_PACKAGE_libiwinfo-lua=y
|
||||
CONFIG_PACKAGE_liblua=y
|
||||
CONFIG_PACKAGE_libuci-lua=y
|
||||
CONFIG_PACKAGE_lua=y
|
||||
CONFIG_PACKAGE_luafilesystem=y
|
||||
# CONFIG_PACKAGE_odhcp6c is not set
|
||||
# CONFIG_PACKAGE_ppp is not set
|
||||
CONFIG_PACKAGE_print3d=y
|
||||
CONFIG_PACKAGE_uclibcxx=y
|
||||
CONFIG_PACKAGE_uhttpd=y
|
||||
CONFIG_PACKAGE_uhttpd-mod-lua=y
|
||||
CONFIG_PACKAGE_wifibox=y
|
||||
CONFIG_STRIP_KERNEL_EXPORTS=y
|
||||
# CONFIG_TARGET_ROOTFS_TARGZ is not set
|
||||
CONFIG_USE_MKLIBS=y
|
||||
CONFIG_WIFIBOX_AP_SSID="d3d-ap-%%MAC_TAIL%%"
|
||||
CONFIG_WIFIBOX_INIT_PRIORITY=18
|
||||
CONFIG_WIFIBOX_WIRELESS_DEVICE="radio0"
|
||||
CONFIG_PACKAGE_kmod-lib-crc-ccitt=y
|
37
extra/openwrt-build/openwrt-diffconfig-mini
Normal file
37
extra/openwrt-build/openwrt-diffconfig-mini
Normal file
@ -0,0 +1,37 @@
|
||||
CONFIG_TARGET_ar71xx=y
|
||||
CONFIG_TARGET_ar71xx_generic=y
|
||||
CONFIG_TARGET_ar71xx_generic_TLMR3020=y
|
||||
# CONFIG_BUSYBOX_CONFIG_FEATURE_IPV6 is not set
|
||||
CONFIG_DOODLE3D_CLIENT_MINIFY_JS=y
|
||||
# CONFIG_IPV6 is not set
|
||||
# CONFIG_KERNEL_DEBUG_INFO is not set
|
||||
# CONFIG_KERNEL_DEBUG_KERNEL is not set
|
||||
# CONFIG_KERNEL_KALLSYMS is not set
|
||||
# CONFIG_KERNEL_MAGIC_SYSRQ is not set
|
||||
# CONFIG_PACKAGE_6relayd is not set
|
||||
CONFIG_PACKAGE_doodle3d-client=y
|
||||
# CONFIG_PACKAGE_kmod-ip6tables is not set
|
||||
# CONFIG_PACKAGE_kmod-ipv6 is not set
|
||||
# CONFIG_PACKAGE_kmod-ppp is not set
|
||||
CONFIG_PACKAGE_kmod-usb-acm=y
|
||||
CONFIG_PACKAGE_kmod-usb-serial=y
|
||||
CONFIG_PACKAGE_kmod-usb-serial-ftdi=y
|
||||
# CONFIG_PACKAGE_libip6tc is not set
|
||||
CONFIG_PACKAGE_libiwinfo=y
|
||||
CONFIG_PACKAGE_libiwinfo-lua=y
|
||||
CONFIG_PACKAGE_liblua=y
|
||||
CONFIG_PACKAGE_libuci-lua=y
|
||||
CONFIG_PACKAGE_lua=y
|
||||
CONFIG_PACKAGE_luafilesystem=y
|
||||
# CONFIG_PACKAGE_odhcp6c is not set
|
||||
# CONFIG_PACKAGE_ppp is not set
|
||||
CONFIG_PACKAGE_print3d=y
|
||||
CONFIG_PACKAGE_uclibcxx=y
|
||||
CONFIG_PACKAGE_uhttpd=y
|
||||
CONFIG_PACKAGE_uhttpd-mod-lua=y
|
||||
CONFIG_PACKAGE_wifibox=y
|
||||
# CONFIG_TARGET_ROOTFS_TARGZ is not set
|
||||
CONFIG_WIFIBOX_AP_SSID="d3d-ap-%%MAC_TAIL%%"
|
||||
CONFIG_WIFIBOX_INIT_PRIORITY=18
|
||||
CONFIG_WIFIBOX_WIRELESS_DEVICE="radio0"
|
||||
CONFIG_PACKAGE_kmod-lib-crc-ccitt=y
|
22
extra/openwrt-build/openwrt-diffconfig-regular
Normal file
22
extra/openwrt-build/openwrt-diffconfig-regular
Normal file
@ -0,0 +1,22 @@
|
||||
CONFIG_TARGET_ar71xx=y
|
||||
CONFIG_TARGET_ar71xx_generic=y
|
||||
CONFIG_TARGET_ar71xx_generic_TLMR3020=y
|
||||
CONFIG_DOODLE3D_CLIENT_MINIFY_JS=y
|
||||
CONFIG_PACKAGE_doodle3d-client=y
|
||||
CONFIG_PACKAGE_kmod-usb-acm=y
|
||||
CONFIG_PACKAGE_kmod-usb-serial=y
|
||||
CONFIG_PACKAGE_kmod-usb-serial-ftdi=y
|
||||
CONFIG_PACKAGE_libiwinfo=y
|
||||
CONFIG_PACKAGE_libiwinfo-lua=y
|
||||
CONFIG_PACKAGE_liblua=y
|
||||
CONFIG_PACKAGE_libuci-lua=y
|
||||
CONFIG_PACKAGE_lua=y
|
||||
CONFIG_PACKAGE_luafilesystem=y
|
||||
CONFIG_PACKAGE_print3d=y
|
||||
CONFIG_PACKAGE_uclibcxx=y
|
||||
CONFIG_PACKAGE_uhttpd=y
|
||||
CONFIG_PACKAGE_uhttpd-mod-lua=y
|
||||
CONFIG_PACKAGE_wifibox=y
|
||||
CONFIG_WIFIBOX_AP_SSID="d3d-ap-%%MAC_TAIL%%"
|
||||
CONFIG_WIFIBOX_INIT_PRIORITY=18
|
||||
CONFIG_WIFIBOX_WIRELESS_DEVICE="radio0"
|
@ -1,5 +1 @@
|
||||
<<<<<<< HEAD
|
||||
0.9.12
|
||||
=======
|
||||
0.9.13
|
||||
>>>>>>> develop
|
||||
0.10.0
|
@ -137,7 +137,7 @@ M.printer_heatedbed = {
|
||||
description = 'Printer has heated bed',
|
||||
}
|
||||
|
||||
local default_makerbot_startcode = '(**** CONFIGURATION MACROS ****)\n;@printer {printerType}\n;@enable progress\n(** This GCode was generated by ReplicatorG 0040 **)\n(* using Skeinforge (50) *)\n(* for a Dual headed Replicator 2 *)\n(* on 2013/10/27 15:07:27 (+0100) *)\n(**** start.gcode for Replicator 2X, single head ****)\nM103 (disable RPM)\nM73 P0 (enable build progress)\nG21 (set units to mm)\nG90 (set positioning to absolute)\nM104 S240 T0 (set extruder temperature) (temp updated by printOMatic)\n{if heatedBed}M140 S110 T0 (set HBP temperature)\n(**** begin homing ****)\nG162 X Y F2500 (home XY axes maximum)\nG161 Z F1100 (home Z axis minimum)\nG92 Z-5 (set Z to -5)\nG1 Z0.0 (move Z to "0")\nG161 Z F100 (home Z axis minimum)\nM132 X Y Z A B (Recall stored home offsets for XYZAB axis)\n(**** end homing ****)\nG1 X-141 Y-74 Z10 F3300.0 (move to waiting position)\nG130 X20 Y20 Z20 A20 B20 (Lower stepper Vrefs while heating)\nM6 T0 (wait for toolhead, and HBP to reach temperature)\nG130 X127 Y127 Z40 A127 B127 (Set Stepper motor Vref to defaults)\nM108 R3.0 T0\nG0 X-141 Y-74 (Position Nozzle)\nG0 Z0.6 (Position Height)\nM108 R5.0 (Set Extruder Speed)\nM101 (Start Extruder)\nG4 P2000 (Create Anchor)\nG92 X0 Y0\nM106\n(**** end of start.gcode ****)'
|
||||
local default_makerbot_startcode = ";@printer {printerType}\nM136 (enable build)\nM73 P0\nG162 X Y F2000(home XY axes maximum)\nG161 Z F900(home Z axis minimum)\nG92 X0 Y0 Z-5 A0 B0 (set Z to -5)\nG1 Z0.0 F900(move Z to '0')\nG161 Z F100(home Z axis minimum)\nM132 X Y Z A B (Recall stored home offsets for XYZAB axis)\nG92 X152 Y72 Z0 A0 B0\nG1 X-112 Y-73 Z0.5 F3300.0 (move to front left 'zero' position)\nG92 X0 Y0 Z0.5 A0 B0\nG1 X0 Y0 Z0.5 F3300.0 (move to waiting position)\nG130 X20 Y20 A20 B20 (Lower stepper Vrefs while heating)\n{if heatedBed};M109 S{printingBedTemp} T0\n{if heatedBed}M140 S{printingBedTemp} T0\nM104 S{printingTemp} T0\n;M134 T0\nM135 T0\nM104 S{printingTemp} T0\nM133 T0\nG130 X127 Y127 A127 B127 (Set Stepper motor Vref to defaults)\nG1 F100 A10 ;extrude 10mm\nG92 A0 ;reset again\nG0 Z20"
|
||||
local default_deltabot_startcode = ';Generated with Doodle3D (deltabot)\nM109 S{printingTemp} ;set target temperature\n{if heatedBed}M190 S{printingBedTemp} ;set target bed temperature\nG21 ;metric values\nG91 ;relative positioning\nM107 ;start with the fan off\nG28 ; move to home\nG92 E0 ;zero the extruded length\nG90 ;absolute positioning\nM117 Printing Doodle... ;display message (20 characters to clear whole screen)'
|
||||
M.printer_startcode = {
|
||||
default = ';Generated with Doodle3D (default)\nM109 S{printingTemp} ;set target temperature \n{if heatedBed}M190 S{printingBedTemp} ;set target bed temperature\nG21 ;metric values\nG91 ;relative positioning\nM107 ;start with the fan off\nG28 X0 Y0 ;move X/Y to min endstops\nG28 Z0 ;move Z to min endstops\nG1 Z15 F9000 ;move the platform down 15mm\nG92 E0 ;zero the extruded length\nG1 F200 E10 ;extrude 10mm of feed stock\nG92 E0 ;zero the extruded length again\nG92 E0 ;zero the extruded length again\nG1 F9000\nG90 ;absolute positioning\nM117 Printing Doodle... ;display message (20 characters to clear whole screen)',
|
||||
@ -154,7 +154,7 @@ M.printer_startcode = {
|
||||
description = ''
|
||||
}
|
||||
|
||||
local default_makerbot_endcode = '(******* End.gcode*******)\nM73 P100 ( End build progress )\nG0 Z150 ( Send Z axis to bottom of machine )\nM18 ( Disable steppers )\nM104 S0 T0 ( Cool down the Right Extruder )\nG162 X Y F2500 ( Home XY endstops )\nM18 ( Disable stepper motors )\nM70 P5 ( We <3 Making Things!)\nM72 P1 ( Play Ta-Da song )\n(*********end End.gcode*******)'
|
||||
local default_makerbot_endcode = 'M73 P100\nG92 A0 B0 ;reset extruder position to prevent retraction\nM18 A B(Turn off A and B Steppers)\nG1 Z155 F900\nG162 X Y F2000\nM18 X Y Z(Turn off steppers after a build)\n{if heatedBed}M140 S{preheatBedTemp} T0\nM104 S{preheatTemp} T0\nM73 P100 (end build progress )\nM70 P5 (We <3 Making Things!)\nM72 P1 ( Play Ta-Da song )\nM137 (build end notification)'
|
||||
local default_deltabot_endcode = 'M107 ;fan offG91 ;relative positioningG1 E-1 F300 ;retract the filament a bit before lifting the nozzle, to release some of the pressureG1 Z+0.5 E-5 X-20 Y-20 F9000 ;move Z up a bit and retract filament even moreG28 ;move to homeM84 ;disable axes / steppersG90 ;absolute positioningM109 S0 ; hot end off{if heatedBed}M140 S{preheatBedTemp}M117 Done ;display message (20 characters to clear whole screen)'
|
||||
M.printer_endcode = {
|
||||
default = 'M107 ;fan off\nG91 ;relative positioning\nG1 E-1 F300 ;retract the filament a bit before lifting the nozzle, to release some of the pressure\nG1 Z+0.5 E-5 X-20 Y-20 F9000 ;move Z up a bit and retract filament even more\nG28 X0 Y0 ;move X/Y to min endstops, so the head is out of the way\nM84 ;disable axes / steppers\nG90 ;absolute positioning\nM104 S{preheatTemp}\n{if heatedBed}M140 S{preheatBedTemp}\nM117 Done ;display message (20 characters to clear whole screen)',
|
||||
@ -242,6 +242,18 @@ M.printer_firstLayerSlow = {
|
||||
description = 'Print the first layer slowly to get a more stable start'
|
||||
}
|
||||
|
||||
M.printer_bottomLayerSpeed = {
|
||||
default = 35,
|
||||
type = 'int',
|
||||
description = 'If first layers are to be printed slowly, use this speed'
|
||||
}
|
||||
|
||||
M.printer_bottomFlowRate = {
|
||||
default = 2,
|
||||
type = 'float',
|
||||
description = 'Multiplication factor for filament flow rate in first few layers'
|
||||
}
|
||||
|
||||
M.printer_heatup_enabled = {
|
||||
default = true,
|
||||
type = 'bool',
|
||||
|
@ -59,7 +59,7 @@ local function setupAutoWifiMode()
|
||||
return nil, "autowifi: could not scan wifi networks (" .. msg .. ")"
|
||||
end
|
||||
|
||||
log:info("current wifi name/mode: " .. (netName or "<nil>") .. "/" .. netMode .. ", ssid of self: " .. apSsid)
|
||||
log:info("current wifi name: " .. (netName or "<nil>") .. ", mode: " .. netMode .. ", ssid of self: " .. apSsid)
|
||||
local visNet, knownNet = {}, {}
|
||||
for _,sn in ipairs(scanList) do
|
||||
table.insert(visNet, sn.ssid)
|
||||
@ -76,6 +76,7 @@ local function setupAutoWifiMode()
|
||||
end
|
||||
|
||||
-- try to find a known network which is also visible (ordered by known network definitions)
|
||||
-- when it finds a access point configuration first, it will use that
|
||||
local connectWith = nil
|
||||
for _,kn in ipairs(knownSsids) do
|
||||
if kn.mode == 'ap' and kn.ssid == apSsid then break end
|
||||
@ -86,14 +87,14 @@ local function setupAutoWifiMode()
|
||||
end
|
||||
|
||||
if connectWith then
|
||||
local rv,msg = netconf.associateSsid(connectWith)
|
||||
local rv,msg = netconf.associateSsid(connectWith,nil,nil,true)
|
||||
if rv then
|
||||
return true, "autowifi: associated -- client mode with ssid '" .. connectWith .. "'"
|
||||
else
|
||||
return nil, "autowifi: could not associate with ssid '" .. connectWith .. "' (" .. msg .. ")"
|
||||
end
|
||||
elseif netMode ~= 'ap' or netName ~= apSsid then
|
||||
local rv,msg = netconf.setupAccessPoint(apSsid)
|
||||
local rv,msg = netconf.setupAccessPoint(apSsid,true)
|
||||
if rv then
|
||||
return true, "autowifi: configured as access point with ssid '" .. apSsid .. "'"
|
||||
else
|
||||
|
@ -53,10 +53,11 @@ function M.init(wifiInstance, reloadSilent)
|
||||
end
|
||||
|
||||
--- Switch configuration between AP and station modes
|
||||
-- @param components a table with components as keys with operations as values (add or remove)
|
||||
-- @param table components a table with components as keys with operations as values (add or remove)
|
||||
-- @param boolean boot If true, the components have to start instead of reloaded (only needed on boot)
|
||||
-- Valid components (each with add and rm operation) are: apnet, staticaddr, dhcppool, wwwredir, dnsredir, wwwcaptive, natreflect.
|
||||
-- and additionally: wifiiface/add, network/reload
|
||||
function M.switchConfiguration(components)
|
||||
function M.switchConfiguration(components,boot)
|
||||
local dirtyList = {} -- laundry list, add config/script name as key with value c (commit), r (reload) or b (both)
|
||||
|
||||
for k,v in pairs(components) do
|
||||
@ -74,7 +75,7 @@ function M.switchConfiguration(components)
|
||||
if v == 'c' or v == 'b' then M.commitComponent(k) end
|
||||
end
|
||||
for k,v in pairs(dirtyList) do
|
||||
if v == 'r' or v == 'b' then M.reloadComponent(k, silent) end
|
||||
if v == 'r' or v == 'b' then M.reloadComponent(k, silent, boot) end
|
||||
end
|
||||
end
|
||||
|
||||
@ -83,15 +84,18 @@ function M.commitComponent(c)
|
||||
uci:commit(c)
|
||||
end
|
||||
|
||||
function M.reloadComponent(c, silent)
|
||||
function M.reloadComponent(c, silent, boot)
|
||||
log:info("reloading component '" .. c .. "'")
|
||||
local cmd = '/etc/init.d/' .. c .. ' reload'
|
||||
local command = 'reload'
|
||||
-- if booting, the services have to be started before they can be reloaded
|
||||
if boot then command = 'start' end
|
||||
local cmd = '/etc/init.d/' .. c .. ' '..command
|
||||
if silent ~= nil and silent then
|
||||
cmd = cmd .. ' &> /dev/null'
|
||||
os.execute(cmd)
|
||||
else
|
||||
rv = utils.captureCommandOutput(cmd)
|
||||
log:info(" result reloading component '" .. c .. "': "..utils.dump(rv))
|
||||
log:debug(" result reloading component '" .. c .. "' (cmd: '"..cmd.."'): \n"..utils.dump(rv))
|
||||
end
|
||||
end
|
||||
|
||||
@ -271,16 +275,20 @@ end
|
||||
-- Note: this function might belong in the wlanconfig module but that would introduce
|
||||
-- a circular dependency, easiest solution is to place the function here.
|
||||
-- @tparam string ssid The SSID to use for the access point.
|
||||
-- @tparam boolean boot If true, the components have to start instead of reloaded (only needed on boot)
|
||||
-- @return True on success or nil+msg on error.
|
||||
function M.setupAccessPoint(ssid)
|
||||
|
||||
function M.setupAccessPoint(ssid,boot)
|
||||
M.setStatus(M.CREATING,"Creating access point '"..ssid.."'...");
|
||||
boot = boot or false
|
||||
--boot = false
|
||||
if boot then log:info(" boot mode") end
|
||||
|
||||
M.switchConfiguration{apnet="add_noreload"}
|
||||
-- add access point configuration
|
||||
M.switchConfiguration({apnet="add_noreload"},boot)
|
||||
wifi.activateConfig(ssid)
|
||||
-- NOTE: dnsmasq must be reloaded after network or it will be unable to serve IP addresses
|
||||
M.switchConfiguration{ wifiiface="add", network="reload", staticaddr="add", dhcppool="add_noreload", wwwredir="add", dnsredir="add" }
|
||||
M.switchConfiguration{dhcp="reload"}
|
||||
M.switchConfiguration({ wifiiface="add", network="reload", staticaddr="add", dhcppool="add_noreload", wwwredir="add", dnsredir="add" },boot)
|
||||
M.switchConfiguration({dhcp="reload"},boot)
|
||||
|
||||
M.setStatus(M.CREATED,"Access point created");
|
||||
|
||||
@ -327,10 +335,11 @@ end
|
||||
-- @tparam string ssid The SSID to associate with.
|
||||
-- @tparam string passphrase The passphrase (if any) to use, may be left out if a UCI configuration exists.
|
||||
-- @tparam boolean recreate If true, a new UCI configuration based on scan data will always be created, otherwise an attempt will be made to use an existing configuration.
|
||||
-- @tparam boolean boot If true, the components have to start instead of reloaded (only needed on boot)
|
||||
-- @return True on success or nil+msg on error.
|
||||
function M.associateSsid(ssid, passphrase, recreate)
|
||||
function M.associateSsid(ssid, passphrase, recreate, boot)
|
||||
log:info("netconfig:associateSsid: "..(ssid or "<nil>")..", "..(recreate or "<nil>"))
|
||||
|
||||
if boot then log:info(" boot mode") end
|
||||
M.setStatus(M.CONNECTING,"Connecting...");
|
||||
|
||||
-- see if previously configured network for given ssid exists
|
||||
@ -359,7 +368,8 @@ function M.associateSsid(ssid, passphrase, recreate)
|
||||
wifi.activateConfig(ssid)
|
||||
--M.switchConfiguration{ wifiiface="add", apnet="rm", staticaddr="rm", dhcppool="rm", wwwredir="rm", dnsredir="rm", wwwcaptive="rm", wireless="reload" }
|
||||
--M.switchConfiguration{ wifiiface="add", apnet="rm", staticaddr="rm", dhcppool="rm", wwwredir="rm", dnsredir="rm", wireless="reload" }
|
||||
M.switchConfiguration{ wifiiface="add", staticaddr="rm", dhcppool="rm", wwwredir="rm", dnsredir="rm", wireless="reload" }
|
||||
--M.switchConfiguration{ wifiiface="add", staticaddr="rm", dhcppool="rm", wwwredir="rm", dnsredir="rm", wireless="reload" }
|
||||
M.switchConfiguration({ wifiiface="add", staticaddr="rm", dhcppool="rm", wwwredir="rm", dnsredir="rm" },boot)
|
||||
|
||||
-- check if we are actually associated
|
||||
local status = wifi.getDeviceState()
|
||||
|
@ -43,23 +43,56 @@ function M.signin()
|
||||
|
||||
local baseurl = "http://connect.doodle3d.com/api/signin.php"
|
||||
|
||||
local attemptInterval = 1
|
||||
local maxAttempts = 20
|
||||
local attempt = 0
|
||||
|
||||
local nextAttemptTime = os.time()
|
||||
|
||||
local localip = ""
|
||||
local signinResponse = ""
|
||||
while true do
|
||||
if os.time() > nextAttemptTime then
|
||||
log:debug("signin attempt "..utils.dump(attempt).."/"..utils.dump(maxAttempts))
|
||||
local signedin = false
|
||||
local localip = wifi.getLocalIP();
|
||||
if localip == nil then
|
||||
log:error("signin failed no local ip found")
|
||||
M.setStatus(IDLE_STATUS,"idle")
|
||||
return false
|
||||
end
|
||||
--log:debug(" localip: "..utils.dump(localip))
|
||||
if localip ~= nil then
|
||||
|
||||
local wifiboxid = wifi.getSubstitutedSsid(settings.get('network.cl.wifiboxid'))
|
||||
wifiboxid = urlcode.escape(wifiboxid)
|
||||
|
||||
local cmd = "wget -q -T 2 -t 1 -O - "..baseurl.."?wifiboxid="..wifiboxid.."\\&localip="..localip;
|
||||
local output = utils.captureCommandOutput(cmd);
|
||||
log:info("signin: "..output)
|
||||
signinResponse = utils.captureCommandOutput(cmd);
|
||||
log:debug(" signin response: \n"..utils.dump(signinResponse))
|
||||
local success = signinResponse:match('"status":"success"')
|
||||
log:debug(" success: "..utils.dump(success))
|
||||
if success ~= nil then
|
||||
signedin = true
|
||||
else
|
||||
log:warn("signin failed request failed (response: "..utils.dump(signinResponse)..")")
|
||||
end
|
||||
else
|
||||
log:warn("signin failed no local ip found (attempt: "..utils.dump(attempt).."/"..utils.dump(maxAttempts)..")")
|
||||
end
|
||||
|
||||
if signedin then
|
||||
break
|
||||
else
|
||||
attempt = attempt+1
|
||||
if attempt >= maxAttempts then
|
||||
-- still no localIP; fail
|
||||
M.setStatus(IDLE_STATUS,"idle")
|
||||
return false
|
||||
else
|
||||
nextAttemptTime = os.time() + attemptInterval
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
M.setStatus(IDLE_STATUS,"idle")
|
||||
|
||||
return string.len(output) > 0, output
|
||||
return string.len(signinResponse) > 0, signinResponse
|
||||
end
|
||||
|
||||
function M.getStatus()
|
||||
|
@ -124,6 +124,7 @@ end
|
||||
--returns the wireless local ip address
|
||||
function M.getLocalIP()
|
||||
local ifconfig, rv = utils.captureCommandOutput("ifconfig wlan0");
|
||||
--log:debug(" ifconfig: \n"..utils.dump(ifconfig));
|
||||
local localip = ifconfig:match('inet addr:([%d\.]+)')
|
||||
return localip;
|
||||
end
|
||||
|
@ -84,14 +84,6 @@ function M._global_POST(request, response)
|
||||
|
||||
local substitutedSsid = wifi.getSubstitutedSsid(settings.get('network.ap.ssid'))
|
||||
response:addData("substituted_ssid",substitutedSsid)
|
||||
|
||||
-- we now call signin seperately trough cgi-bin
|
||||
--[[log:info("API:Network:try signing in")
|
||||
if signin.signin() then
|
||||
log:info("API:Network:signin successfull")
|
||||
else
|
||||
log:info("API:Network:signin failed")
|
||||
end]]--
|
||||
end
|
||||
|
||||
function M.all_GET(request, response)
|
||||
|
@ -147,7 +147,7 @@ function M.associate_POST(request, response)
|
||||
|
||||
response:setSuccess("wlan is trying to associate")
|
||||
|
||||
local rv,msg = netconf.associateSsid(argSsid, argPhrase, argRecreate)
|
||||
local rv,msg = netconf.associateSsid(argSsid, argPhrase, argRecreate,false)
|
||||
if rv then
|
||||
log:info("associated to wifi: "..utils.dump(argSsid))
|
||||
else
|
||||
|
@ -159,8 +159,8 @@ function M.install_POST(request, response)
|
||||
updater.setLogger(log)
|
||||
updater.setState(updater.STATE.INSTALLING,"")
|
||||
|
||||
local ssid = wifi.getSubstitutedSsid(settings.get('network.ap.ssid'))
|
||||
local rv,msg = netconf.enableAccessPoint(ssid)
|
||||
--local ssid = wifi.getSubstitutedSsid(settings.get('network.ap.ssid'))
|
||||
--local rv,msg = netconf.enableAccessPoint(ssid)
|
||||
|
||||
if not argVersion then
|
||||
local success,status,msg = updater.getStatus()
|
||||
|
@ -5,9 +5,9 @@
|
||||
# This software is licensed under the terms of the GNU GPL v2 or later.
|
||||
# See file LICENSE.txt or visit http://www.gnu.org/licenses/gpl.html for full license details.
|
||||
|
||||
sleep 5s
|
||||
sleep 15m
|
||||
while true; do
|
||||
/usr/share/lua/wifibox/script/d3dapi signin > /dev/null 2> /dev/null
|
||||
|
||||
sleep 1h
|
||||
sleep 15m
|
||||
done
|
||||
|
@ -18,6 +18,7 @@ boot() {
|
||||
|
||||
$LOGGER "Start signing in..."
|
||||
/usr/share/lua/wifibox/script/signin.sh > /dev/null 2> /dev/null &
|
||||
|
||||
}
|
||||
|
||||
start() {
|
||||
|
@ -145,7 +145,7 @@ end
|
||||
-- @treturn string Output of the command that was run.
|
||||
-- @todo: this function has been duplicated from rest/api/api_system.lua
|
||||
function M.captureCommandOutput(cmd)
|
||||
local f = assert(io.popen(cmd, 'r'))
|
||||
local f = assert(io.popen(cmd..' 2>&1', 'r'))
|
||||
local output = assert(f:read('*all'))
|
||||
f:close()
|
||||
return output
|
||||
|
Loading…
Reference in New Issue
Block a user