Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

FIX: Add READY status to saturn_printer.py #8

Open
TehDizzy opened this issue Jan 4, 2024 · 0 comments
Open

FIX: Add READY status to saturn_printer.py #8

TehDizzy opened this issue Jan 4, 2024 · 0 comments

Comments

@TehDizzy
Copy link

TehDizzy commented Jan 4, 2024

Couple of recommended tweaks:

1: No active prints return the following when "cassini.py status" is executed:

E:\Programs\Python Scripts\cassini-main>python cassini.py status
192.168.xxx.xxx:
    Saturn3Ultra (ELEGOO Saturn 3 Ultra)
    Machine Status: READY
Traceback (most recent call last):
  File "E:\Programs\Python Scripts\cassini-main\cassini.py", line 188, in <module>
    main()
  File "E:\Programs\Python Scripts\cassini-main\cassini.py", line 171, in main
    do_status(printers)
  File "E:\Programs\Python Scripts\cassini-main\cassini.py", line 61, in do_status
    print(f"    Print Status: {PrintInfoStatus(print_info['Status']).name}")
                               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Program Files\WindowsApps\PythonSoftwareFoundation.Python.3.12_3.12.496.0_x64__qbz5n2kfra8p0\Lib\enum.py", line 744, in __call__
    return cls.__new__(cls, value)
           ^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Program Files\WindowsApps\PythonSoftwareFoundation.Python.3.12_3.12.496.0_x64__qbz5n2kfra8p0\Lib\enum.py", line 1158, in __new__
    raise ve_exc
ValueError: 0 is not a valid PrintInfoStatus

The fix is to add "READY = 0" to the class PrintInfoStatus:

# Status field inside PrintInfo
class PrintInfoStatus(Enum):
    # TODO: double check these
    READY = 0
    EXPOSURE = 2 
    RETRACTING = 3
    LOWERING = 4
    COMPLETE = 16 # pretty sure this is correct

As shown below:

E:\Programs\Python Scripts\cassini-main>python cassini.py status
192.168.xxx.xxx:
    Saturn3Ultra (ELEGOO Saturn 3 Ultra)
    Machine Status: READY
    Print Status: READY
    Layers: 0/0
    File:
    File Transfer Status: IDLE

2: File Transfer Status shows ERROR when no print is active:

E:\Programs\Python Scripts\cassini-main>python cassini.py status
192.168.xxx.xxx:
    Saturn3Ultra (ELEGOO Saturn 3 Ultra)
    Machine Status: READY
    Print Status: IDLE
    Layers: 0/0
    File:
    File Transfer Status: ERROR

The fix is to rename "ERROR = 3" to "IDLE = 3" in the class FileStatus in saturn_printer.py to more accurately describe the printer's state:

# Status field inside FileTransferInfo
class FileStatus(Enum):
    NONE = 0
    DONE = 2
    IDLE = 3

As shown below:

E:\Programs\Python Scripts\cassini-main>python cassini.py status
192.168.xxx.xxx:
    Saturn3Ultra (ELEGOO Saturn 3 Ultra)
    Machine Status: READY
    Print Status: READY
    Layers: 0/0
    File:
    File Transfer Status: IDLE
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant