0
0
mirror of https://github.com/Doodle3D/doodle3d-firmware.git synced 2024-11-16 18:47:57 +01:00

Compare commits

...

69 Commits

Author SHA1 Message Date
Rick Companje
924285b51e update version information and releasenotes to stable 2017-07-12 10:01:53 +02:00
Rick Companje
d453818455 updated version information 2017-07-10 13:33:24 +02:00
peteruithoven
550e151153 Also closing file descriptor after removing current print file 2017-07-07 09:59:27 +02:00
Simon Voordouw
2ee6b05e61 Merge branch 'develop' of github.com:Doodle3D/Doodle3D-firmware into develop 2017-07-06 18:15:44 +02:00
Simon Voordouw
c3e4ec88a8 log fetch g-code file id and stopFetch 2017-07-06 18:14:23 +02:00
Simon Voordouw
59c71a34ba move removing current-print file to stopFetch 2017-07-06 18:14:04 +02:00
Simon Voordouw
e5de852087 close popen filehandles 2017-07-06 18:10:31 +02:00
Rick Companje
02fc0ea91b updated version and releasenotes 2017-07-06 16:09:15 +02:00
Simon Voordouw
634465fdd6 move deleting start/endgcode files to stopFetch 2017-07-06 15:31:57 +02:00
Simon Voordouw
1bbb327178 remove semicolon 2017-07-06 15:06:19 +02:00
Simon Voordouw
fdbc07b377 use accessManager.hasControl. Fixes issue #75 2017-07-06 14:39:28 +02:00
Simon Voordouw
c536fe3221 consistent formatting in print-fetch. Fixes issue #77 2017-07-06 14:24:59 +02:00
Simon Voordouw
db259bbfc6 return "printer not idle" as fail. Fixes issue #76 2017-07-06 14:24:59 +02:00
Simon Voordouw
22b6abfd8b stop fetch program in printer/{fetch,print}. Fixes issue #74 2017-07-06 14:24:55 +02:00
Simon Voordouw
2883a066ef add currentPrint get/setter. Fix issue #78 2017-07-06 13:59:45 +02:00
Simon Voordouw
8adc74876e use current-print 2017-06-27 17:45:56 +02:00
Simon Voordouw
753672e164 Merge branch 'develop' of github.com:Doodle3D/Doodle3D-firmware into develop 2017-06-27 17:45:05 +02:00
Simon Voordouw
0acc20f498 stop print-fetch before stopping print 2017-06-27 17:42:19 +02:00
Rick Companje
01cc6770f6 Update ReleaseNotes.md 2017-06-23 17:35:45 +02:00
Rick Companje
c15b1bd592 Update ReleaseNotes.md 2017-06-23 17:29:28 +02:00
Rick Companje
07d4316a7f fixed typo in filename /tmp/currentprint 2017-06-23 15:34:07 +02:00
Rick Companje
18271618f7 set default printing temperature to 210 instead of 230 degrees 2017-06-23 15:06:23 +02:00
Rick Companje
a5f3ff92cf replace preheatTemp and preheatBedTemp by 0 in default encode for safety 2017-06-23 11:11:53 +02:00
Rick Companje
752bd144cf add \n to default_deltabot_endcode 2017-06-23 11:08:35 +02:00
Rick Companje
9b9513c278 disable heatup and set heatup temperature to 0 by default 2017-06-23 11:07:21 +02:00
Simon Voordouw
d9e84308dd append end G-code correctly 2017-06-22 16:17:38 +02:00
Simon Voordouw
ae46535275 exit if gcode file info could not be retrieved 2017-06-22 14:31:32 +02:00
Simon Voordouw
9571af19ac check if file is opened 2017-06-21 11:50:50 +02:00
Simon Voordouw
6729af7064 rename remote to gcodeServer for clarity 2017-06-20 15:18:36 +02:00
Simon Voordouw
8eb83ac6a0 save print id and add it to the progres api 2017-06-20 15:17:29 +02:00
Rick Companje
3b6b9618cc updated default startcode (moved G91 after G1 Z15)
See https://github.com/Doodle3D/WiFi-Box/issues/21
2017-06-20 14:19:36 +02:00
Simon Voordouw
28e131f8de kill fetch program on print stop 2017-06-20 14:13:49 +02:00
Rick Companje
2b0f6287d7 Update ReleaseNotes.md 2017-06-20 12:16:27 +02:00
Simon Voordouw
a9c2f6096c check if printer is idle before fetching 2017-06-19 16:13:07 +02:00
Rick Companje
a5bf23c95c Update ReleaseNotes.md 2017-06-19 15:39:25 +02:00
Rick Companje
ca3016bbe8 Update FIRMWARE-VERSION 2017-06-19 15:33:42 +02:00
Rick Companje
257d59b33e Merge pull request #71 from Doodle3D/feature/add-renkforce-printer
Adding support for Renkforce RF100
2017-06-19 14:47:07 +02:00
Rick Companje
54cb428987 Merge pull request #72 from Doodle3D/feature/add-renkforce-printer-1
Adding support for Renkforce RF100
2017-06-19 14:46:58 +02:00
Rick Companje
c1eb99b91b Adding support for Renkforce RF100
Adding support for Renkforce RF100 in printer.lua: Doodle3D/WiFi-Box#20
2017-06-19 14:41:11 +02:00
Rick Companje
bafc05deb0 Update printer.lua 2017-06-19 14:33:25 +02:00
Simon Voordouw
ade1b2793b Merge pull request #70 from Doodle3D/feature/print-fetch
Feature/print fetch
2017-06-19 14:32:38 +02:00
Simon Voordouw
3fe6ff3bfe change default gcode server to gcodeserver.doodle3d.com 2017-06-19 14:17:19 +02:00
Simon Voordouw
1676ca5703 use gcode id as source 2017-06-19 13:20:13 +02:00
Simon Voordouw
f2e77d9529 submit total lines when fetching print 2017-06-19 11:28:39 +02:00
Simon Voordouw
6b4e4e934c remove total lines 2017-06-13 14:40:20 +02:00
Simon Voordouw
aec8343bc0 add more error handling 2017-06-13 13:22:59 +02:00
Simon Voordouw
0d955b48ea WiFi-box can't handle https 2017-06-13 13:09:46 +02:00
Simon Voordouw
97fb6609ea call print start before finishing fetch loop 2017-06-13 13:04:09 +02:00
Simon Voordouw
533988a409 add gcode_server to default settings 2017-06-13 12:30:47 +02:00
Simon Voordouw
211c2f1abb copy print-fetch script to install dir 2017-06-13 11:47:16 +02:00
Simon Voordouw
fbb536f4ad use correct lua not equal 2017-06-13 11:10:50 +02:00
Simon Voordouw
5607ab96ad add end and start-gcode parameters to printer/fetch API 2017-06-12 17:49:46 +02:00
Simon Voordouw
b2590e4142 add options to pass start and end-gcode to print-fetch 2017-06-12 17:20:29 +02:00
Simon Voordouw
9c6bd6cdea gcode file is done when current_line is higher or equal than total_lines 2017-06-12 15:37:43 +02:00
Simon Voordouw
2f91065ff7 add check for control and clear gcode on print fetch start 2017-06-12 12:06:27 +02:00
Simon Voordouw
82d4179bc3 add logging, parameter checking to print-fetch script 2017-06-12 12:05:57 +02:00
Simon Voordouw
02b198d773 return success response 2017-05-18 15:01:27 +02:00
Simon Voordouw
25aba526b4 fetch specific file id from server 2017-04-11 17:04:57 +02:00
Simon Voordouw
fe5b2ec306 get gcode-server url from config 2017-04-11 12:50:49 +02:00
Simon Voordouw
a3468b85ce add fetch-from-server api endpoint 2017-04-11 12:00:34 +02:00
unknown
ff9b8f3077 Merged develop into master 2017-01-13 13:05:05 +01:00
Unknown
909f6e89bd 0.10.12 version & release notes 2017-01-13 11:54:15 +01:00
Unknown
2c01bcbe07 0.10.12-b version & release notes 2017-01-12 15:33:00 +01:00
Unknown
624756cdcf post install update to config for changes in 0.10.10
See: https://github.com/Doodle3D/print3d/issues/48
2017-01-12 15:21:26 +01:00
peteruithoven
32bf0db636 Merged branch develop into master 2016-06-15 14:21:32 +02:00
peteruithoven
89748e11aa Merge branch 'develop'
Conflicts:
	README.md
2016-05-11 15:23:18 +02:00
Olaf van der Kruk
05ec47f8a5 Update README.md
Fixed nice makeup
2016-04-12 11:46:03 +02:00
Olaf van der Kruk
777a6a01dc Update README.md 2016-04-12 11:45:14 +02:00
Olaf van der Kruk
198a7024f9 Update README.md
Added small readme of the command line interface
2016-04-12 11:44:50 +02:00
10 changed files with 298 additions and 24 deletions

View File

@ -126,6 +126,10 @@ define Package/wifibox/install
$(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

@ -12,6 +12,18 @@ Make sure the 'ldoc' program is installed on your machine and the LDOC variable
On OSX, this can be accomplished by installing it through luarocks (run `sudo luarocks install ldoc`). Luarocks can be installed using [MacPorts](http://www.macports.org/). After installing that, the command would be `sudo port install luarocks`.
Command line interface
----------------------
The Doodle3D API can be called using a terminal:
```d3dapi p=/network/scan r=GET```
Where the p parameter is the module you want to call and r is the method.
Post request can be send using the same method:
```d3dapi p=/printer/print r=POST```
Parameters: TODO
Debugging Lua
-------------

View File

@ -1,4 +1,25 @@
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

View File

@ -138,6 +138,11 @@ 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.10.12-a
0.11.0

View File

@ -128,6 +128,7 @@ 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,
@ -148,6 +149,7 @@ 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,
@ -164,6 +166,7 @@ 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,
@ -194,6 +197,7 @@ 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',
@ -207,7 +211,7 @@ local default_deltabot_startcode = ';Generated with Doodle3D (deltabot)\nM109 S{
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)'
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 = ';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_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',
@ -225,14 +229,14 @@ M.printer_startcode = {
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 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 = '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'
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'
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 = '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_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 S35 T0\nM104 S180 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 S0 T0\nM104 S0 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,
@ -241,7 +245,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 S{preheatTemp}\n{if heatedBed}M140 S{preheatBedTemp}\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 S0\n{if heatedBed}M140 S0\nM117 Done ;display message (20 characters to clear whole screen)',
type = 'string',
subSection = 'printer_type',
description = ''
@ -258,7 +262,7 @@ M.printer_baudrate = {
}
M.printer_temperature = {
default = 230,
default = 210,
type = 'int',
description = 'printing temperature',
min = 0
@ -330,19 +334,19 @@ M.printer_bottomEnableTraveling = {
}
M.printer_heatup_enabled = {
default = true,
default = false,
type = 'bool',
description = ''
}
M.printer_heatup_temperature = {
default = 180,
default = 0,
type = 'int',
description = ''
}
M.printer_heatup_bed_temperature = {
default = 70,
default = 0,
type = 'int',
description = ''
}
@ -418,4 +422,10 @@ M.doodle3d_update_baseUrl = {
description = ''
}
M.gcode_server = {
default = 'http://gcodeserver.doodle3d.com',
type = 'string',
description =''
}
return M

View File

@ -48,6 +48,36 @@ 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)
@ -56,7 +86,13 @@ 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)
@ -156,11 +192,14 @@ 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()
@ -185,6 +224,81 @@ 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)
@ -197,20 +311,12 @@ 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)
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
if not accessManager.hasControl(request.remoteAddress) 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"))
@ -226,6 +332,8 @@ 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

112
src/script/print-fetch.lua Executable file
View File

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

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

View File

@ -63,7 +63,8 @@ local SUPPORTED_PRINTERS = {
colido_x3045 = "ColiDo X3045",
colido_compact = "ColiDo Compact",
colido_diy = "ColiDo DIY",
craftbot_plus = "CraftBot PLUS"
craftbot_plus = "CraftBot PLUS",
renkforce_rf100 = "Renkforce RF100"
}
local SUPPORTED_BAUDRATES = {
["115200"] = "115200 bps",