Commit Graph

39 Commits

Author SHA1 Message Date
Kevin O'Connor 04eb72dcd5 virtual_sdcard: Fix merge error
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2022-06-03 14:23:56 -04:00
Troy Jacobson 2e04be4451 virtual_sdcard: Add reset_file event
Signed-off-by: Troy Jacobson <troy.d.jacobson@gmail.com>
Co-authored-by: Franklyn Tackitt <git@frank.af>
2022-06-03 14:12:04 -04:00
Pedro Lamas c16eab212e virtual_sdcard: Adds on_error_gcode
Signed-off-by: Pedro Lamas <pedrolamas@gmail.com>
2022-06-03 11:26:34 -04:00
Justin Schuh 1390b4d600 virtual_sdcard: Allow spaces in file path for M23
Also makes M23 work normally with rename_existing.

Signed-off-by: Justin Schuh <code@justinschuh.com>
2022-03-18 11:44:33 -04:00
Kevin O'Connor b3a39bebd4 virtual_sdcard: Convert to Python3 string encoding
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2021-10-01 19:22:13 -04:00
Kamil Trzcinski f1091a484b virtual_sdcard: add `file_path` and `file_size` to `status`
This provides a comprehensive information if currently
we have a file loaded.

Signed-off-by: Kamil Trzcinski <ayufan@ayufan.eu>
2021-06-22 15:15:03 -04:00
Kamil Trzciński 46f51b2bb0
print_stats: add `cancelled` when `CANCEL_PRINT` used (#4366)
Before this change, a `CANCEL_PRINT` set a `print_stats` to `paused`
that would later be workaround-ed with `fluidd`/`mainsail` to re-define
`CANCEL_PRINT`.

This sets a proper canceled state, but additionally closes a file
from a `virtual_sdcard` context for `canceled`/`error`, as this is no longer
resumable from this point.

Signed-off-by: Kamil Trzcinski <ayufan@ayufan.eu>
2021-06-14 15:09:55 -04:00
Jason S. McMullan 913649de2e loop_sdcard: Add loopable SD card file sections
To support continuous belt printing, add nestable repeat
loop support via an `[sdcard_loop]` module.

Supported G-Code:
  - SDCARD_LOOP_BEGIN COUNT=n  ; Loop for N times, or infinitely if N is 0
  - SDCARD_LOOP_END            ; End of loop
  - SDCARD_LOOP_DESIST         ; Complete all loops without iterating

Marlin M808 compatibility example in `config/sample-macros.cfg`:
  - M808 Ln        ; Loop for N times, or infinitely if N is 0
  - M808           ; End of loop
  - M808 K         ; Complete all loops without iterating

Added unit tests in test/klippy/sdcard_loop.test

See https://reprap.org/wiki/G-code#M808:_Set_or_Goto_Repeat_Marker

Signed-off-by: Jason S. McMullan <jason.mcmullan@gmail.com>
2021-05-26 11:57:57 -04:00
Arksine dc71b64c0a virtual_sdcard: fix check for case sensitive files
Signed-off-by:  Eric Callahan <arksine.code@gmail.com>
2021-05-11 13:15:56 -04:00
Clifford Roche e2a3217289
palette2: Add support for P2 devices (#4057)
Module which bring support for P2 devices running in connected mode. This enables using a Palette2 directly with Klippy without Octoprint, or without Palette2 plugins for Octoprint which are not functional out of the box with Klipper.

Signed-off-by: Clifford Roche <clifford.roche@gmail.com>
2021-03-26 11:21:10 -04:00
Andre LeBlanc 3fc72da9ae virtual_sdcard: exact filename match before case insensitive one
currently, if there are 2 files on the virtual sd card whose names differ only in
case (eg. MyFile.gcode vs myfile.gcode) the actual file that gets loaded is at
best unpredictable.  this patch checks for an exact match before attempting a
case-insensitive one.

Signed-off-by: Andre LeBlanc <andrepleblanc@gmail.com>
2021-02-26 22:53:35 -05:00
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