0
0
mirror of https://github.com/Doodle3D/doodle3d-firmware.git synced 2024-06-25 02:51:23 +02:00

Compare commits

..

No commits in common. "master" and "0.10.10" have entirely different histories.

12 changed files with 37 additions and 357 deletions

View File

@ -101,10 +101,6 @@ 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)/
@ -122,14 +118,9 @@ 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
$(INSTALL_BIN) $(WIFIBOX_BASE_DIR)/script/print-fetch.lua $(1)/$(TGT_LUA_DIR_SUFFIX)/script
$(LN) -s /$(TGT_LUA_DIR_SUFFIX)/script/print-fetch.lua $(1)/bin/print-fetch
$(CP) $(WIFIBOX_BASE_DIR)/script/wifibox.uci.config $(1)/etc/config/wifibox # copy base configuration to uci config dir
$(CP) $(WIFIBOX_BASE_DIR)/FIRMWARE-VERSION $(1)/etc/wifibox-version

View File

@ -1,38 +1,4 @@
Changelog
# 0.11.0 (12 jul 2017)
# 0.11.0-c (10 jul 2017)
- fix: Also closing file descriptor after removing current print file (commit 550e151)
# 0.11.0-b (6 jul 2017)
- show id of current print in d3dapi/info/status when printing in 'fetch' mode.
- code reuse and cleanup for control, kill and status
# 0.11.0-a (23 jun 2017)
- Added 'fetch' functionality to let the WiFi-Box print from a remote server. This enables the WiFi-Box to print large g-code files. (yeah!)
- Added support for the Renkforce RF100 printer.
- Changed 'default startcode' to prevent Ultimaker 2 series to bump into platform [#21](https://github.com/Doodle3D/WiFi-Box/issues/21) when Ultimaker (original) is selected.
- Changed default nozzle temperature from 230 to 210 °C.
- Fixed corrupted endcode for delta printers.
- Changed default endcode to cooldown to 0 after print instead of cooling down to preheat temperature.
# 0.10.12
# 0.10.12-b (12 jan 2017)
- Post install update to config for changes in 0.10.10 (fixes print3d logging)
# 0.10.12-a (26 jul 2016)
- Added Ultimaker Original Plus (Thanks Remco)
- Added extra usb drivers
# 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,17 +37,14 @@ 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
@ -58,6 +55,7 @@ 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'
@ -101,7 +99,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
@ -123,10 +121,8 @@ 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
@ -138,11 +134,6 @@ else
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
# update wifibox's config for config changes in 0.10.10
uci set wifibox.system.log_path='/tmp'
uci set wifibox.system.api_log_filename='wifibox.log'
uci set wifibox.system.p3d_log_basename='print3d'
crontab -l 2> /dev/null | grep logrotate\.conf > /dev/null
if [ $? -ne 0 ]; then
# add line, method from http://askubuntu.com/a/58582

View File

@ -1 +1 @@
0.11.0
0.10.10

View File

@ -128,7 +128,6 @@ M.printer_dimensions_x = {
default_minifactory = 150,
default_lulzbot_taz_4 = 298,
default_ultimaker2go = 120,
default_renkforce_rf100 = 100,
default_doodle_dream = 120,
default_wanhao_duplicator4 = 210,
default_colido_2_0_plus = 230,
@ -149,7 +148,6 @@ M.printer_dimensions_y = {
default_minifactory = 150,
default_lulzbot_taz_4 = 275,
default_ultimaker2go = 120,
default_renkforce_rf100 = 100,
default_doodle_dream = 120,
default_wanhao_duplicator4 = 140,
default_colido_2_0_plus = 150,
@ -166,7 +164,6 @@ M.printer_dimensions_z = {
default__3Dison_plus = 150,
default_lulzbot_taz_4 = 250,
default_ultimaker2go = 112,
default_renkforce_rf100 = 100,
default_doodle_dream = 80,
default_wanhao_duplicator4 = 140,
default_colido_2_0_plus = 140,
@ -189,7 +186,6 @@ M.printer_heatedbed = {
default_colido_m2020 = true,
default_colido_x3045 = true,
default_craftbot_plus = true,
default_ultimaker_original_plus = true,
subSection = 'printer_type',
type = 'bool',
description = 'Printer has heated bed',
@ -197,7 +193,6 @@ M.printer_heatedbed = {
M.printer_filamentThickness = {
default = 2.89,
default_doodle_dream = 1.75,
default_renkforce_rf100 = 1.75,
default_wanhao_duplicator4 = 1.75,
default_craftbot_plus = 1.75,
type = 'float',
@ -208,10 +203,9 @@ 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)\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'
local default_ultimaker_original_plus_startcode = ';Generated with Doodle3D (Ultimaker Original Plus)\n{if heatedBed}M190 S{printingBedTemp}\nM109 S{printingTemp}\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)'
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'
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\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\nG91 ;relative positioning\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 = ';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,
default_ultimaker2go = default_ultimaker2_startcode,
default__3Dison_plus = ';@printer {printerType}\nM136 (enable build)\nM73 P0\nG21\nG90\nM103\n;M109 S50 T0\nM140 S50 T0\nM104 S{printingTemp} T0\n;M134 T0\nM135 T0\nM104 S{printingTemp} T0\nG162 X Y F2000(home XY axes maximum)\nG161 Z F900(home Z axis minimum)\nG92 X113.5 Y74 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)\nG1 Z50 F3300\nG130 X20 Y20 A20 B20 (Lower stepper Vrefs while heating)\nM133 T0\nM6 T0\nG130 X127 Y127 A127 B127 (Set Stepper motor Vref to defaults)\nG0 Z0.2 F3000\nG1 Z0 F100 A10 ;extrude 10mm\nG92 X227 Y148 Z0 A0 ;reset again\nG1 X227 Y148 Z0',
@ -223,20 +217,19 @@ M.printer_startcode = {
default_delta_rostockmax = default_deltabot_startcode,
default_deltamaker = default_deltabot_startcode,
default_kossel = default_deltabot_startcode,
default_ultimaker_original_plus = default_ultimaker_original_plus_startcode,
type = 'string',
subSection = 'printer_type',
description = ''
}
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 S0 T0\nM104 S0 T0\nM72 P1 ( Play Ta-Da song )\nM137 (build end notification)'
local default_deltabot_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+0.5 E-5 X-20 Y-20 F9000 ;move Z up a bit and retract filament even more\nG28 ;move to home\nM84 ;disable axes / steppers\nG90 ;absolute positioning\nM109 S0 ; hot end off\n{if heatedBed}M140 S0\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 S0\n{if heatedBed}M140 S0\n'
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)'
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 S0\n{if heatedBed}M140 S0\nM117 Done ;display message (20 characters to clear whole screen)',
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,
default_ultimaker2go = default_ultimaker2_endcode,
default__3Dison_plus = '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)\nM140 S0 T0\nM104 S0 T0\nM73 P100 (end build progress )\nM72 P1 ( Play Ta-Da song )\nM137 (build end notification)\n',
default__3Dison_plus = '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)\nM140 S35 T0\nM104 S180 T0\nM73 P100 (end build progress )\nM72 P1 ( Play Ta-Da song )\nM137 (build end notification)\n',
default_makerbot_generic = default_makerbot_endcode,
default_makerbot_replicator2 = default_makerbot_endcode,
default_makerbot_replicator2x = default_makerbot_endcode,
@ -245,7 +238,7 @@ M.printer_endcode = {
default_delta_rostockmax = default_deltabot_endcode,
default_deltamaker = default_deltabot_endcode,
default_kossel = default_deltabot_endcode,
default_craftbot_plus = '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\nM109 S0\n{if heatedBed}M140 S0\nM117 Done ;display message (20 characters to clear whole screen)',
default_craftbot_plus = '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\nM109 S{preheatTemp}\n{if heatedBed}M140 S{preheatBedTemp}\nM117 Done ;display message (20 characters to clear whole screen)',
type = 'string',
subSection = 'printer_type',
description = ''
@ -262,7 +255,7 @@ M.printer_baudrate = {
}
M.printer_temperature = {
default = 210,
default = 230,
type = 'int',
description = 'printing temperature',
min = 0
@ -334,19 +327,19 @@ M.printer_bottomEnableTraveling = {
}
M.printer_heatup_enabled = {
default = false,
default = true,
type = 'bool',
description = ''
}
M.printer_heatup_temperature = {
default = 0,
default = 180,
type = 'int',
description = ''
}
M.printer_heatup_bed_temperature = {
default = 0,
default = 70,
type = 'int',
description = ''
}
@ -422,10 +415,4 @@ M.doodle3d_update_baseUrl = {
description = ''
}
M.gcode_server = {
default = 'http://gcodeserver.doodle3d.com',
type = 'string',
description =''
}
return M

View File

@ -177,13 +177,11 @@ 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
log:verbose(MOD_ABBR, "deleting faulty ssid: "..utils.dump(s['.name']))
rv = uci:delete('wireless', s['.name'])
uci:delete('wireless', s['.name'])
rv = true
end
end)
uci:save('wireless')
uci:commit('wireless')
return rv
end

View File

@ -154,11 +154,6 @@ 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
@ -223,17 +218,4 @@ 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

@ -48,36 +48,6 @@ function M.temperature(request, response)
end
end
local function setCurrentPrint(id)
local cpfileName = "/tmp/current-print"
if id == nil then
io.popen('rm ' .. cpfileName):close()
return true
end
local cpfile = io.open(cpfileName, 'w+')
if cpfile == nil then
return false
end
cpfile:write(id)
cpfile:close()
return true
end
local function getCurrentPrint()
local idfile = io.open('/tmp/current-print')
if idfile ~= nil then
return idfile:read('*a')
end
end
local function stopFetch()
log:verbose(MOD_ABBR, "stopping print-fetch and removing start/endgcode")
io.popen("killall print-fetch"):close()
io.popen("rm /tmp/startcode /tmp/endcode"):close()
setCurrentPrint(nil)
end
function M.progress(request, response)
local argId = request:get("id")
local printer,msg = printerUtils.createPrinterOrFail(argId, response)
@ -86,13 +56,7 @@ function M.progress(request, response)
-- NOTE: despite their names, `currentLine` is still the error indicator and `bufferedLines` the message in such case.
local currentLine,bufferedLines,totalLines,bufferSize,maxBufferSize,seqNumber,seqTotal = printer:getProgress()
local printId = getCurrentPrint()
response:addData('id', argId)
if printId ~= nil then
response:addData('current_print', printId)
end
if currentLine then
response:setSuccess()
response:addData('current_line', currentLine)
@ -192,14 +156,11 @@ function M.stop_POST(request, response)
local printer,msg = printerUtils.createPrinterOrFail(argId, response)
if not printer or not printer:hasSocket() then return end
stopFetch()
if(argGcode == nil) then
argGcode = ""
end
local rv,msg = printer:stopPrint(argGcode)
response:addData('id', argId)
if rv then
response:setSuccess()
@ -224,81 +185,6 @@ local function addSequenceNumbering(printer, response)
end
end
function M.fetch_POST(request, response)
if not accessManager.hasControl(request.remoteAddress) then
response:setFail("No control access")
return
else
accessManager.setController(request.remoteAddress)
end
local printer,msg = printerUtils.createPrinterOrFail(argId, response)
if not printer or not printer:hasSocket() then return end
local state = printer:getState()
if state ~= "idle" then
response:setFail("printer is not idle")
return
end
log:verbose(MOD_ABBR, " clearing all gcode for " .. printer:getId())
stopFetch()
local rv,msg = printer:clearGcode()
if rv == false then
response:addData('status', msg)
response:setFail("could not clear gcode (" .. msg .. ")")
elseif rv == nil then
response:setError(msg)
return
end
local gcodeFiles = " "
local startCode = request:get("start_code")
if startCode ~= nil then
gcodeFiles = gcodeFiles .. '/tmp/startcode '
local startCodeFile = io.open('/tmp/startcode', 'w+')
if startCodeFile == nil then
response:setError("could not open startCode file for writing")
return
end
startCodeFile:write(startCode)
end
local endCode = request:get("end_code")
if endCode ~= nil then
gcodeFiles = gcodeFiles .. '/tmp/endcode '
local endCodeFile = io.open('/tmp/endcode', 'w+')
if endCodeFile == nil then
response:setError("could not open endcode file for writing")
return
end
endCodeFile:write(endCode)
end
local socket = printer:getId()
if socket == nil then
response:setError("no socket found")
return
end
local gcodeServer = settings.get('gcode.server')
if gcodeServer == nil then
response:setError("no gcode server configured")
return
end
local id = request:get("id")
if id == nil then
response:setError("no id supplied")
return
end
setCurrentPrint(id)
log:info(MOD_ABBR, " starting fetch print. id: " .. id .. " server: " .. gcodeServer)
io.popen("print-fetch " .. socket .. " " .. gcodeServer .. " " .. id .. gcodeFiles)
response:setSuccess()
end
--requires: gcode(string) (the gcode to be appended)
--accepts: id(string) (the printer ID to append to)
--accepts: clear(bool) (chunks will be concatenated but output file will be cleared first if this argument is true)
@ -311,12 +197,20 @@ end
-- a fail with a (formal, i.e., parseable) status argument will be returned;
-- additionally, current sequence number and total will be returned (both are -1 if they have not been set)
function M.print_POST(request, response)
if not accessManager.hasControl(request.remoteAddress) then
local controllerIP = accessManager.getController()
local hasControl = false
if controllerIP == "" then
accessManager.setController(request.remoteAddress)
hasControl = true
elseif controllerIP == request.remoteAddress then
hasControl = true
end
if not hasControl then
response:setFail("No control access")
return
else
accessManager.setController(request.remoteAddress)
end
local argId = request:get("id")
local argGcode = request:get("gcode")
local argClear = utils.toboolean(request:get("clear"))
@ -332,8 +226,6 @@ function M.print_POST(request, response)
local printer,msg = printerUtils.createPrinterOrFail(argId, response)
if not printer or not printer:hasSocket() then return end
stopFetch()
response:addData('id', argId)
if argGcode == nil or argGcode == '' then

View File

@ -1,112 +0,0 @@
#!/usr/bin/lua
local function log(message)
os.execute("logger " .. message)
print(message)
end
if (table.getn(arg) == 0) then
print("Usage: ./print-fetch {printerSocket} {gcodeServerURL} {id} [startGcode] [endGCode]")
return
end
log("starting gcode fetch program")
package.cpath = package.cpath .. '/usr/lib/lua/?.so'
JSON = (loadfile "/usr/share/lua/wifibox/util/JSON.lua")()
local p3d = require("print3d")
local printer = p3d.getPrinter(arg[1])
if printer == nil then
log("error connecting to printer")
return
end
local gcodeServer = arg[2]
local finished = false
local id = arg[3]
log("gcode file id: " .. id)
log("gcode server: " .. gcodeServer)
local info = JSON:decode(io.popen("wget -qO - " .. gcodeServer .. "/info/" .. id):read("*a"))
if info == nil then
log("could not retrieve file info")
return
end
local current_line = 0
local total_lines = tonumber(info["lines"])
local started = false
log("total lines: " .. total_lines)
local startCode = nil
local endCode = nil
function countlines(file)
return tonumber(io.popen("wc -l < " .. file):read('*a'))
end
function readGCodeArg(argi)
local gcodeFile = arg[argi]
return io.open(gcodeFile):read('*a')
end
if table.getn(arg) >= 5 then
startCode = readGCodeArg(4)
endCode = readGCodeArg(5)
end
if startCode ~= nil then
log("appending start gcode")
printer:appendGcode(startCode)
end
while(not finished)
do
local f = io.popen("wget -qO - " .. gcodeServer .. "/fetch/" .. id .. "/" .. current_line)
local line = f:read()
while line ~= nil do
printer:appendGcode(line, total_lines, { seq_number = -1, seq_total = -1, source = id })
current_line = current_line + 1
line = f:read()
end
if not started then
started = true
print("send print start command")
printer:startPrint()
end
if current_line >= total_lines then
log("finished fetching gcode")
if endCode ~= nil then
log("appending end gcode")
printer:appendGcode(endCode, total_lines, { seq_number = -1, seq_total = -1, source = id })
end
finished = true
break
end
local accepts_new_gcode = false
while (not accepts_new_gcode)
do
local current,buffer,total,bufferSize,maxBufferSize = printer:getProgress()
local percentageBufferSize = bufferSize / maxBufferSize
if percentageBufferSize < 0.8 then
print("buffer below 80% capacity, sending new gcode")
accepts_new_gcode = true
else
print("buffer above 80% capacity")
os.execute("sleep 10")
end
end
end

View File

@ -1,12 +0,0 @@
#!/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

View File

@ -10,4 +10,3 @@ config settings 'system'
config settings 'general'
option printer_type 'ultimaker'
option gcode_server 'http://gcodeserver.doodle3d.com'

View File

@ -17,7 +17,6 @@ local SUPPORTED_PRINTERS = {
ultimaker = "Ultimaker",
ultimaker2 = "Ultimaker 2",
ultimaker2go = "Ultimaker 2 Go",
ultimaker_original_plus = "Ultimaker Original Plus",
makerbot_replicator2 = "MakerBot Replicator2",
makerbot_replicator2x = "MakerBot Replicator2x",
makerbot_thingomatic = "MakerBot Thing-o-matic",
@ -63,8 +62,7 @@ local SUPPORTED_PRINTERS = {
colido_x3045 = "ColiDo X3045",
colido_compact = "ColiDo Compact",
colido_diy = "ColiDo DIY",
craftbot_plus = "CraftBot PLUS",
renkforce_rf100 = "Renkforce RF100"
craftbot_plus = "CraftBot PLUS"
}
local SUPPORTED_BAUDRATES = {
["115200"] = "115200 bps",