FIX: Add READY status to saturn_printer.py
Opened this issue · 0 comments
TehDizzy commented
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