Merged branch develop into master

This commit is contained in:
peteruithoven 2016-06-15 14:21:32 +02:00
commit 32bf0db636
8 changed files with 66 additions and 15 deletions

View File

@ -101,6 +101,10 @@ define Package/wifibox/install
#$(INSTALL_DIR) $(1)/www
$(INSTALL_DIR) $(1)/www/cgi-bin
#copy wps button script to procd folder
$(INSTALL_DIR) $(1)/etc/rc.button/
$(INSTALL_BIN) $(WIFIBOX_BASE_DIR)/script/wifi-switch-netconfig.sh $(1)/etc/rc.button/wps
### create all files in /usr/share/lua/autowifi (autowifi)
$(CP) $(WIFIBOX_BASE_DIR)/opkg.conf $(1)/$(TGT_LUA_DIR_SUFFIX)/
@ -118,6 +122,7 @@ define Package/wifibox/install
$(INSTALL_BIN) $(WIFIBOX_BASE_DIR)/script/wifibox_init $(1)/etc/init.d/wifibox
$(INSTALL_BIN) $(WIFIBOX_BASE_DIR)/script/dhcpcheck_init $(1)/etc/init.d/dhcpcheck
$(INSTALL_BIN) $(WIFIBOX_BASE_DIR)/script/d3dapi $(1)/$(TGT_LUA_DIR_SUFFIX)/script
$(LN) -s /$(TGT_LUA_DIR_SUFFIX)/script/d3dapi $(1)/bin/d3dapi
$(INSTALL_BIN) $(WIFIBOX_BASE_DIR)/script/signin.sh $(1)/$(TGT_LUA_DIR_SUFFIX)/script
$(CP) $(WIFIBOX_BASE_DIR)/script/logrotate-wifibox.conf $(1)/etc/logrotate.d/wifibox.conf

View File

@ -1,4 +1,14 @@
Changelog
# 0.10.11
# 0.10.11-a (25 may 2016)
- After pressing the reset button for about 4 seconds the WiFi-Box will go to access point mode. Useful for when you can't reach it.
- Becomes access point when it can't connect to WiFi network.
- Handles more clients by tweaking the uhttpd config.
- Print3D isn't killed when there is no memory available.
- New banner (shown after ssh login)
- Ultimaker 2 type printers show status information on display.
# 0.10.10 (11 may 2016)
- Logging client version info to console.
- Logging less when printing to makerbot/wanhao

View File

@ -37,14 +37,17 @@ addFirewallNet() {
if [ ! -f $IPKG_INSTROOT/etc/banner.default ]; then
mv $IPKG_INSTROOT/etc/banner $IPKG_INSTROOT/etc/banner.default
cat <<-\EOM > $IPKG_INSTROOT/etc/banner
........D o o d l e 3 D
.......________ _____ _____
....../ / / |__ / __/ / - /___ __
...../ / / /--// _|-// --| . /v /
..../________/__//__/__//____/___/_^_\
...
..A cad in a box.
.
,------. ,--.,--. ,----. ,------.
| .-. \ ,---. ,---. ,-| || | ,---. '.-. || .-. \
| | \ :| .-. || .-. |' .-. || || .-. : .' < | | \ :
| '--' /' '-' '' '-' '\ `-' || |\ --./'-' || '--' /
`-------' `---' `---' `---' `--' `----'`----' `-------'
__ ___ ______ _ ____
\ \ / (_) ____(_) | _ \
\ \ /\ / / _| |__ _ ______| |_) | _____ __
\ \/ \/ / | | __| | |______| _ < / _ \ \/ /
\ /\ / | | | | | | |_) | (_) > <
\/ \/ |_|_| |_| |____/ \___/_/\_\
EOM
fi
@ -55,7 +58,6 @@ if [ $? -gt 0 ]; then
cat <<-\EOM >> $IPKG_INSTROOT/root/.profile
# DO NOT MODIFY - this block of lines has been added by the wifibox package.
alias d='ls -la'
alias d3dapi='/usr/share/lua/wifibox/script/d3dapi'
alias encore='ulimit -c unlimited'
alias wopkg='opkg -f /usr/share/lua/wifibox/opkg.conf'
@ -99,7 +101,7 @@ if [ -z "$IPKG_INSTROOT" ]; then
echo "Adding network interface 'wlan'..."
uci set network.wlan=interface
uci commit network; /etc/init.d/network reload
echo "Setting default wifibox log level..."
uci set wifibox.general.system_log_level='info'
uci -q delete wifibox.system.loglevel # remove key used in older versions (<=0.10.8a) if it exists
@ -121,8 +123,10 @@ else
uci set network.lan.ipaddr=192.168.5.1
echo -e "beta\nbeta" | passwd root
# uhttpd config: https://wiki.openwrt.org/doc/uci/uhttpd#server_settings
uci set uhttpd.main.lua_handler='/usr/share/lua/wifibox/main.lua'
uci set uhttpd.main.lua_prefix='/d3dapi'
uci set uhttpd.main.max_requests='10'
uci set wireless.@wifi-device[0].disabled=0
uci delete wireless.radio0.channel

View File

@ -1 +1 @@
0.10.10
0.10.11

View File

@ -203,7 +203,7 @@ M.printer_filamentThickness = {
local default_makerbot_startcode = ';@printer {printerType}\nM136 (enable build)\nM73 P0 (Set build percentage to 0)\nG162 X Y F2000 (home XY axes to maximum)\nG161 Z F900 (home Z axis to minimum quick)\nG92 X0 Y0 Z0 A0 B0 (set axis positions to 0)\nG1 Z5.0 F900 (move Z axis down)\nG161 Z F100 (home Z axis to minimum more precise)\nG92 X0 Y0 Z0 A0 B0 (set axis positions to 0)\nG1 Z2.0 F900 (move Z axis to safety height)\nG1 X-264 Y-145 Z0 F3300.0 (move XY to start position)\nG92 X0 Y0 Z0 A0 B0 (set axis position to 0)\nG130 X20 Y20 A20 B20 (Lower stepper Vrefs while heating)\n{if heatedBed}M140 S{printingBedTemp} T0 (Set bed temp)\nM135 T0 (use first extruder)\nM104 S{printingTemp} T0 (set extruder temp)\nM133 T0 (Wait for extruder)\nG130 X127 Y127 A127 B127 (Set Stepper motor Vref to defaults)\nG1 F100 A10 (extrude 10mm)\nG92 A0 (reset extruder)\nG0 Z20 (move up, to lose filament)'
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)'
local default_ultimaker2_startcode = ';Generated with Doodle3D (ultimaker2)\nM109 S{printingTemp} ;set target temperature \n{if heatedBed}M190 S{printingBedTemp} ;set target bed temperature\nG21 ;metric values\nG90 ;absolute positioning\nM107 ;start with the fan off\nG28 ; home to 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\nG1 F9000\nM117 Printing Doodle... ;display message (20 characters to clear whole screen)\n'
local default_ultimaker2_startcode = ';Generated with Doodle3D (ultimaker2)\nM10000\nM10000\nM10001 X8 Y28 SDoodle3D heat up...\nM109 S{printingTemp} ;set target temperature \n{if heatedBed}M190 S{printingBedTemp} ;set target bed temperature\nG21 ;metric values\nG90 ;absolute positioning\nM107 ;start with the fan off\nG28 ; home to 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\nG1 F9000\nM10000\nM10000\nM10001 X8 Y28 SDoodle3D printing...\n'
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)',
default_ultimaker2 = default_ultimaker2_startcode,
@ -224,7 +224,7 @@ M.printer_startcode = {
local default_makerbot_endcode = 'G92 A0 B0 ;reset extruder position to prevent retraction\nM18 A B(Turn off A and B Steppers)\nG162 Z 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\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)'
local default_ultimaker2_endcode = '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+5.5 E-5 X-20 Y-20 F9000 ;move Z up a bit and retract filament even more\nG28 ;home the printer\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)'
local default_ultimaker2_endcode = 'M10000\nM10000\nM10001 X20 Y28 SDoodle3D done!\nM107 ;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+5.5 E-5 X-20 Y-20 F9000 ;move Z up a bit and retract filament even more\nG28 ;home the printer\nM84 ;disable axes / steppers\nG90 ;absolute positioning\nM104 S{preheatTemp}\n{if heatedBed}M140 S{preheatBedTemp}\n'
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)',
default_ultimaker2 = default_ultimaker2_endcode,

View File

@ -177,11 +177,13 @@ end
function M.removeConfig(ssid)
local rv = false
uci:foreach('wireless', 'wifi-iface', function(s)
log:verbose(MOD_ABBR, utils.dump(s.ssid).."\n "..utils.dump(s))
if s.ssid == ssid then
uci:delete('wireless', s['.name'])
rv = true
log:verbose(MOD_ABBR, "deleting faulty ssid: "..utils.dump(s['.name']))
rv = uci:delete('wireless', s['.name'])
end
end)
uci:save('wireless')
uci:commit('wireless')
return rv
end

View File

@ -154,6 +154,11 @@ function M.associate_POST(request, response)
log:info(MOD_ABBR, "associated to wifi: "..utils.dump(argSsid))
else
log:info(MOD_ABBR, "failed to associate to wifi: "..utils.dump(argSsid).." ("..utils.dump(msg)..")")
wifi.removeConfig(argSsid)
local backupssid = wifi.getSubstitutedSsid(settings.get('network.ap.ssid'))
netconf.setupAccessPoint(backupssid)
netconf.enableAccessPoint(backupssid)
wifi.removeConfig(argSsid)
end
end
@ -218,4 +223,17 @@ function M.alive(request, response)
response:setSuccess("alive")
end
function M.reset_POST(request, response)
response:setSuccess("Resetting networks")
log:info(MOD_ABBR, "Resetting networks")
for _, net in ipairs(wifi.getConfigs()) do
wifi.removeConfig(net.ssid)
end
local ssid = wifi.getSubstitutedSsid(settings.get('network.ap.ssid'))
netconf.setupAccessPoint(ssid)
netconf.enableAccessPoint(ssid)
end
return M

View File

@ -0,0 +1,12 @@
#!/bin/sh
[ "${ACTION}" = "released" ] || exit 0
. /lib/functions.sh
logger "$BUTTON pressed for $SEEN seconds"
if [ "$SEEN" -gt 4 ]
then
logger "Resetting Wireless"
d3dapi p=/network/reset r=POST
fi