Commit Graph

28 Commits

Author SHA1 Message Date
Kevin O'Connor 4c5e93d51d gcode: Split G0/G1 command handling to new gcode_move class
Split up the main GCodeParser class into GCodeDispatch and GCodeMove
classes.  The GCodeMove class is now available using the "gcode_move"
printer object name.  This split simplifies the gcode.py code.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2020-08-20 21:03:22 -04:00
Kevin O'Connor b74a5c5217 webhooks: Remove register_static_path()
Use the "info" webhook to pass critical process information back to
the caller.  The remaining users of register_static_path() can get the
required information via get_status() calls.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2020-08-16 13:20:25 -04:00
Arksine e4f3f60ea6 virtual_sdcard: register sd static path
Signed-off-by:  Eric Callahan <arksine.code@gmail.com>
2020-08-11 10:47:04 -04:00
Arksine b9f48e634e print_stats: Add virtual_sdcard state tracking
Signed-off-by:  Eric Callahan <arksine.code@gmail.com>
2020-08-05 13:46:24 -04:00
Arksine 6b1ad715aa print_stats: stat tracking for virtual sdcard prints in progress
Signed-off-by: Eric Callahan <arksine.code@gmail.com>
2020-08-05 13:46:24 -04:00
Arksine 463194b1a3 virtual_sdcard: update get_status method
Do not reset progress to zero while paused.  Report 'is_active' and 'file_position'.

Signed-off-by:  Eric Callahan <arksine.code@gmail.com>
2020-08-05 13:46:24 -04:00
Arksine 963d7c247b virtual_sdcard: add SDCARD_PRINT_FILE gcode
SDCARD_PRINT_FILE allows Klipper to load and start the print for any
gcode file within the virtual_sdcard path, including subdirectories.

Signed-off-by:  Eric Callahan <arksine.code@gmail.com>
2020-08-05 13:46:24 -04:00
Arksine af39a209f3 virtual_sdcard: add SDCARD_RESET_FILE gcode
This allows the user to close a currently loaded file and reset the virtual_sdcard's state.

Signed-off-by:  Eric Callahan <arksine.code@gmail.com>
2020-08-05 13:46:24 -04:00
Kevin O'Connor b0d9a82718 virtual_sdcard: Use new GCodeCommand wrappers
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2020-05-05 11:08:11 -04:00
Kevin O'Connor 64031ab3d7 gcode: Rename respond() to respond_raw()
Rename the method to make it more clear that it is a low-level call
that should be rarely used.

Also, change gcode_button.py, hall_filament_width_sensor.py, and
tsl1401cl_filament_width_sensor.py to use respond_info() instead of
respond_raw().

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2020-04-24 15:54:18 -04:00
Kevin O'Connor 568a0da50e virtual_sdcard: No need to call gcode.respond_error() on disk error
Report low-level disk errors via the log and use the normal sdcard
mechanism to report end of sdcard print to gcode users.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2020-04-24 14:54:13 -04:00
Kevin O'Connor 05472bb8a3 virtual_sdcard: Don't wait for M25 in an SD gcode file
If an M25 is in a gcode file that is being printed from virtual SD, it
would cause a permanent hang.  Detect that case and don't wait for
those M25 commands.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2019-11-24 14:30:26 -05:00
Kevin O'Connor 430ad0b658 virtual_sdcard: Only return from M25 after print confirmed paused
Wait in the M25 command handler until the work_handler() background
timer fully exits.  This ensures that subsequent g-code commands (such
as M27 or M24) will correctly report a paused state.

Reported by @foosel.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2019-10-31 11:36:35 -04:00
Kevin O'Connor 30d2ae8f9f gcode: Eliminate the process_batch() method
Allow the callers of process_batch() to directly inspect the gcode
mutex.  Those callers can then directly invoke run_script().

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2019-06-09 18:44:44 -04:00
Trevor Jones 9cb21de68e virtual_sdcard: consistent sorting (#1387)
Signed-off-by: Trevor Jones <trevorjones141@gmail.com>
2019-04-14 11:34:22 -04:00
Arksine 3cd1f9676d pause_resume: Implement send_pause_command()
This allows for pausing from inside a reactor callback.

Signed-off-by:  Eric Callahan <arksine.code@gmail.com>
2019-03-01 00:45:51 -05:00
Kevin O'Connor f1c804907c virtual_sdcard: Don't list files starting with a '.'
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2019-02-08 11:48:53 -05:00
Arksine e69742df8f virtual_sdcard: prepare for pause_resume implementation
- Add is_active() member function to return the active printing status of the virtual sdcard
- M27 now reports current file position when file has been opened. See http://marlinfw.org/docs/gcode/M027.html

Signed-off-by:  Eric Callahan <arksine.code@gmail.com>
2019-01-28 11:23:52 -05:00
Kevin O'Connor fb7fe282c8 klippy: Convert printer_state("shutdown") to an event handler
Convert all users of the printer_state("shutdown") handler to register
a "klippy:shutdown" event handler instead.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2019-01-08 10:59:43 -05:00
Kevin O'Connor a5e55c2acc gcode: process_batch() should execute commands atomically
Update the process_batch() method so that it will not interleave
commands read from the input fd with the batched commands.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2018-10-28 18:39:45 -04:00
Kevin O'Connor 82738955d2 virtual_sdcard: Check if other events need to run after each file read
Periodically check if other events need to run - this prevents the
virtual_sdcard processing from starving other events.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2018-08-02 20:27:34 -04:00
Kevin O'Connor 33c2c8f1bd gcode: Raise an error if a duplicate command is registered
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2018-05-20 13:08:22 -04:00
Kevin O'Connor 76bafadb71 virtual_sdcard: Add logging on start, stop, stats, and shutdown
Add additional logging to the virtual_sdcard support.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2018-04-23 18:35:15 -04:00
Kevin O'Connor d5dc6b785d gcode: Add minval/maxval/above/below options to get_X parsers
Add value checking to gcode parameter parsing code.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2018-04-20 22:24:36 -04:00
Kevin O'Connor 3a1cdc7d70 virtual_sdcard: Fix typo in seek error handling
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2018-03-12 22:36:39 -04:00
Kevin O'Connor 08a5f8a5ff display: Add initial support for LCD screens attached to an MCU
Add support for displaying basic status information on ST7920 and
HD44780 based LCDs that are attached directly to a micro-controller.

Signed-off-by: Marcio Teixeira <marcio@alephobjects.com>
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2018-03-06 11:30:46 -05:00
Kevin O'Connor fc60bda4d1 virtual_sdcard: Remove trailing '*' checksum indicator from M23 command
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2018-03-02 11:58:00 -05:00
Kevin O'Connor 08a1183a01 virtual_sdcard: Initial support for virtual sdcard
Add support for directly printing from a local file on the host.  This
may be useful if the host cpu is not fast enough to run OctoPrint
well.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2018-02-11 14:13:12 -05:00