Commit Graph

1121 Commits

Author SHA1 Message Date
Eric Callahan 76731b673b moonraker: refactor klipper initialization
The `send_event()` method now returns a future that can be awaited until all callbacks are complete.  All events emitted during Klipper init are now awaited, and a Lock is used to prevent re-entry.  This resolves potential timing issues with commands sent during the init sequence.

Signed-off-by:  Eric Callahan <arksine.code@gmail.com>
2021-11-12 10:11:39 -05:00
Eric Callahan c2bf9bf551 event_loop: add create_future method
Signed-off-by:  Eric Callahan <arksine.code@gmail.com>
2021-11-12 10:11:39 -05:00
Eric Callahan 9854fd36cf power: use component_init for post initialization
Signed-off-by:  Eric Callahan <arksine.code@gmail.com>
2021-11-12 10:11:39 -05:00
Eric Callahan e6bedd1ffe paneldue: use component_init for post initialization
Signed-off-by: Eric Callahan <arksine.code@gmail.com>
2021-11-12 10:11:39 -05:00
Eric Callahan 799e763050 mqtt: use component_init for post initalization
Signed-off-by:  Eric Callahan <arksine.code@gmail.com>
2021-11-12 10:11:39 -05:00
Eric Callahan fd59ace4f8 machine: use component_init for post initialization
Signed-off-by:  Eric Callahan <arksine.code@gmail.com>
2021-11-12 10:11:39 -05:00
Eric Callahan 15d99be9f0 update_manager: use component_init method for post initialzation
Clean up retry functionality to use for loops rather than while loops.

Signed-off-by:  Eric Callahan <arksine.code@gmail.com>
2021-11-12 10:11:39 -05:00
Eric Callahan cbdbe83bbd moonraker: refactor component initialization
Components may call a "component_init" method for initialization that requires async calls.  This allows moonraker to track init progress and guarantee init order.

Signed-off-by:  Eric Callahan <arksine.code@gmail.com>
2021-11-12 10:11:39 -05:00
Eric Callahan 7a8aeae673 file_manager: use the job queue to start gcode uploads
If a print cannot be started then it will be queued.

Signed-off-by:  Eric Callahan <arksine.code@gmail.com>
2021-11-12 10:11:39 -05:00
Eric Callahan b135f48867 moonraker: add job queue to core components
Signed-off-by:  Eric Callahan <arksine.code@gmail.com>
2021-11-12 10:11:39 -05:00
Eric Callahan 0f1aea8df8 moonraker: refactor component loading
Remove the "load_component_multi" method as it is not
necessary.  Components are responsible for loading
"child" sections as required.  Core components can
now have their own config section.

Signed-off-by:  Eric Callahan <arksine.code@gmail.com>
2021-11-12 10:11:39 -05:00
Eric Callahan ec12a187fc job_queue: initial implementation
Add support for holding multiple printer jobs in a queue.
When a job successfully completes Moonraker will load
the next job in the queue.

Signed-off-by:  Eric Callahan <arksine.code@gmail.com>
2021-11-12 10:11:39 -05:00
Eric Callahan 358fe9733f history: implement reset totals endpoint
This allows clients to request that job totals are reset to 0.

Signed-off-by:  Eric Callahan <arksine.code@gmail.com>
2021-11-12 10:11:39 -05:00
Eric Callahan 21ee446509 history: use the job_state module to manage job events
Signed-off-by:  Eric Callahan <arksine.code@gmail.com>
2021-11-12 10:11:39 -05:00
Eric Callahan d0c104aceb job_state: initial implementation
This module adds a helper to track Klippy's "print_stats" module.  It
stores the current stats and emits events for changes in job state.

Signed-off-by:  Eric Callahan <arksine.code@gmail.com>
2021-11-12 10:11:39 -05:00
Eric Callahan 53291f6887 power: use the default_vals keyword to init gpios
The "default_val" keyword argument is not available in libgpiod version 1.2.

Signed-off-by:  Eric Callahan <arksine.code@gmail.com>
2021-11-11 19:35:34 -05:00
Pedro Lamas a3ba4b4169 power: improves GPIO initial_state handling
Signed-off-by: Pedro Lamas <pedrolamas@gmail.com>
2021-11-11 19:09:06 -05:00
Pedro Lamas 7ff126a56e docs: updates to new Fluidd repo address
Signed-off-by: Pedro Lamas <pedrolamas@gmail.com>
2021-11-07 07:00:12 -05:00
Eric Callahan 4e567d72a9 readme: add links for Docker Images
Signed-off-by: Eric Callahan <arksine.code@gmail.com>
2021-11-05 15:35:54 -04:00
Eric Callahan 78af774413 readme: add links for Pi images
Signed-off-by: Eric Callahan <arksine.code@gmail.com>
2021-11-05 15:26:41 -04:00
Eric Callahan 800816055e readme: add a clients header
Also update the link to Fluidd.

Signed-off-by:  Eric Callahan <arksine.code@gmail.com>
2021-11-05 15:21:18 -04:00
Eric Callahan 61fab42281 moonraker: log unix socket permission errors
Signed-off-by:  Eric Callahan <arksine.code@gmail.com>
2021-11-04 11:03:53 -04:00
FrY Sennberg 780279d261 docs: fix typo
Signed-off-by: Christoph Frei <fryakatkop@gmail.com>
2021-11-04 08:40:14 -04:00
Eric Callahan 105858b0c7 machine: fix perfomance regression
The `update_service_status()` method could result in the creation of multiple subprocesses for each update, resulting in a performance hit as subprocesses are inherently expensive.

Fetch the state for all detected services in a single subprocess.

Signed-off-by:  Eric Callahan <arksine.code@gmail.com>
2021-11-03 09:10:12 -04:00
Eric Callahan 6a39bbd0c3 mqtt: don't publish status updates when disconnected
Signed-off-by:  Eric Callahan <arksine.code@gmail.com>
2021-11-03 08:49:40 -04:00
FrY Sennberg eec60a760b
git_deploy: report git repository name
Signed-off-by: Christoph Frei <fryakatkop@gmail.com>
2021-11-01 19:10:35 -04:00
Eric Callahan 9f89b03aa3 docs: update /server/info documentation
Signed-off-by:  Eric Callahan <arksine.code@gmail.com>
2021-11-01 11:24:31 -04:00
Eric Callahan 86ac019572 moonraker: report software version in server.info
Signed-off-by:  Eric Callahan <arksine.code@gmail.com>
2021-11-01 11:24:31 -04:00
Eric Callahan 4f43cf3a9f shell_command: handle ProcessLookupError when cancelling
This suggests that the process has previously exited.

Signed-off-by:  Eric Callahan <arksine.code@gmail.com>
2021-11-01 08:25:28 -04:00
Eric Callahan e71e723f89 confighelper: attempt to clarify unparsed config warnings
Signed-off-by:  Eric Callahan <arksine.code@gmail.com>
2021-10-31 19:17:25 -04:00
Eric Callahan 8e33698e23 power: improve logging when the gpiod module fails to load
Log all import errors other than ModuleNotFound errors.  Add a server warning if a gpio type is configured and the gpiod module is not loaded.

Signed-off-by:  Eric Callahan <arksine.code@gmail.com>
2021-10-31 19:12:20 -04:00
Eric Callahan 2addf845d3 machine: add PNY to the list of known SD manufacturers
Signed-off-by:  Eric Callahan <arksine.code@gmail.com>
2021-10-31 19:12:00 -04:00
Eric Callahan f9372f3638 scripts: remove Klipper check in install script
Moonraker no longer requires that Klipper be installed and started prior to launch.

Signed-off-by:  Eric Callahan <arksine.code@gmail.com>
2021-10-31 06:11:06 -04:00
Eric Callahan 21305853ce scripts: add liblmdb-dev and libjpeg-dev to dependencies
These packages can be required on systems that need to build python wheels.

Signed-off-by:  Eric Callahan <arksine.code@gmail.com>
2021-10-31 06:03:56 -04:00
Eric Callahan 504d87831d docs: document "root_info" filed reported by get_directory
Signed-off-by:  Eric Callahan <arksine.code@gmail.com>
2021-10-30 17:06:14 -04:00
Eric Callahan b55b21921a file_manager: report additional info in response to get_directory
Include the root's name and its permissions.

Signed-off-by:  Eric Callahan <arksine.code@gmail.com>
2021-10-30 16:49:41 -04:00
Eric Callahan e9b06472c1 file_manager: minor refactoring in _list_directory method
Signed-off-by:  Eric Callahan <arksine.code@gmail.com>
2021-10-30 16:46:40 -04:00
Eric Callahan aa608b4c29 metadata: support extracting thumbnails from footer
Signed-off-by:  Eric Callahan <arksine.code@gmail.com>
2021-10-30 11:01:27 -04:00
Eric Callahan 4e262dfa14 file_manager: remove redundant code in delete_file method
Signed-off-by:  Eric Callahan <arksine.code@gmail.com>
2021-10-30 07:34:40 -04:00
Eric Callahan 538c68fc8b file_manager: normalize path requests
This resolves an issue where a path is containter two slashes as a separator reports as outside of the root.

Signed-off-by:  Eric Callahan <arksine.code@gmail.com>
2021-10-30 07:28:55 -04:00
Eric Callahan 28c8bf61da machine: add a more robust container check
Most containers do not have access to systemd, so using
systemd-detect-virt will fail.  We can check the cgroup
and sched files of the first process to reliably determine
if Moonraker is running within a container.

Signed-off-by:  Eric Callahan <arksine.code@gmail.com>
2021-10-28 19:38:15 -04:00
Eric Callahan 179e9428c5 docs: add 'virtualization' to the return value of system_info
Signed-off-by:  Eric Callahan <arksine.code@gmail.com>
2021-10-28 11:45:13 -04:00
Eric Callahan f35bceb309 machine: detect virtualized envronment
It isn't valid to run some commands from within containers.  Use systmd-detect-virt to detect a virtualized environment and report the type and id via the system_info endpoint.

If Moonraker is running from within a container do not allow access to the reboot and shutdown endpoints.

Signed-off-by:  Eric Callahan <arksine.code@gmail.com>
2021-10-28 11:45:13 -04:00
Eric Callahan 7890753d9f docs: update documentation to reflect api changes
The file list and directory list endpoints now report file
permissions.

Signed-off-by:  Eric Callahan <arksine.code@gmail.com>
2021-10-27 12:02:06 -04:00
Eric Callahan de8c0fc871 file_manager: fix inotify symlink handling
When a symbolic link is created there is no completion event, so immediately fire the notification.

Signed-off-by:  Eric Callahan <arksine.code@gmail.com>
2021-10-27 11:24:57 -04:00
Eric Callahan e33962fdd4 file_manager: check write permissions for uploads
If the specified path is a symbolic link do not proceed with the upload, raise an exception.

Signed-off-by:  Eric Callahan <arksine.code@gmail.com>
2021-10-27 08:55:44 -04:00
Eric Callahan 734f295822 file_manager: allow registration of full access directories
Signed-off-by:  Eric Callahan <arksine.code@gmail.com>
2021-10-27 08:55:44 -04:00
Eric Callahan 4c42b8d072 file_manager: report file and directory permissions
Signed-off-by: Eric Callahan <arksine.code@gmail.com>

fix
2021-10-27 08:55:19 -04:00
Eric Callahan 1dd89bac4b docs: bump mkdocs requirement to 1.2.3
Signed-off-by:  Eric Callahan <arksine.code@gmail.com>
2021-10-24 12:46:56 -04:00
Eric Callahan f086f75c07 docs: Add documentation for new service and power features
Signed-off-by:  Eric Callahan <arksine.code@gmail.com>
2021-10-24 12:46:56 -04:00