Doodle3D/Doodle3D-cura-plugin

Handle all states

peteruithoven opened this issue · 5 comments

Make a lost of all possible states and make sure we give feedback when appropriate.

  • idle
  • slicing (for the different flavor)
  • buffering
  • heating
  • printing
  • stopping
  • printer not connected
  • connection to box lost
  • ...

Are you sure you've added feedback on that it's (re)slicing?
Are you sure you're disabling the buttons when the connection to the WiFi-Box is lost?

Mzt-t commented

I just remembered that we are going to show feedback by using the slicing progress into the plugins' progress bar. We'll need this signal to detect the starting of a slicing. And this one to give us a percentage between 0 and 100%. I'll look into it. I'll keep this issue open till I've added the signals.

As for the buttons, they are are auto-disabling when the box loses connection with the printer, but turning off the printer would not, because the latter can not get information from /d3dapi/info/status to check the state. I've added a timeout of 5 seconds in the "GET" function. So basically: if we have no answer in 5 seconds after requesting printer info, the plugin will assume the printer is off and it will set the printer state to "disconnected", the buttons will behave accordingly.

Added timeout of 5 seconds @ PrinterConnection.py line. 441
Setting printer state to disconnected @ PrinterConnection.py line. 357

Mzt-t commented

It seems there are two possible ways we can have the disconnect status.
1: When the Wi-Fi box is on but not connected to the printer physically.
2: When the Wi-Fi box was on, but now off. (Printer turned off/No power)

I have them both set to the printer state "disconnected", since there doesn't need to be a distinction (yet). But I do keep them apart: "Box not connected to a printer" and "Lost connection to Wi-Fi box".

I would personally add a separate state, since the interface should show slightly different feedback. Maybe something like "unavailable" or "unknown"?
The benefit would be that you could create a updatePhrase() function that could set all possible phrases according to the different states.

Mzt-t commented

I seperated them into two states: "disconnected" for when the Doodle3D WiFi-Box is not connected to the printer, and "lost" for when the connection with the Doodle3D WiFi-Box is lost.

lost L.354
disconnected L.365