The client now tries to detect if it's fast enough to process the
state updates usually send every 500ms, and if not notifies the
server to throttle the rate (e.g. to 1/1s, 1/1.5s etc).
Additionally, since the terminal tab of the client turned out to
be quite CPU intense when line number calculation, filtering etc
is enabled, the terminal tab now also falls back into a bit less
fancy mode if it detects its being processed too slow and optionally
even disables logging completely during printing (where a lot
of log messages need to be processed in a minimum amount of
time).
That way the UI should stay responsive even on very low powered
clients (e.g. chromium on a Pi), while printing.
Having the plugin commands on the first level of --help proved to be
a bad idea since it basically kills every chance of lazy loading the (expensive)
plugin context. Using a sub command for anything plugin related allows us
to only fire up the plugin context if a plugin command is expected, saving us
some precious seconds of operation in all other cases.
For conformity reasons the dev sub commands were now restructured
similarly.
This will only style them in a special way and influence sorting. Plugins still need
to ensure that a step is not skipped through the use of the onWizardTabChange callback
in the view model.
"Hello" command sent to printer to trigger initial handshake can now be
configured. Commands that _always_ necessitate to be sent with checksum/
line number (e.g. M110 on Marlin) can be configured as such too.
Also fixed an issue causing the "Hello" command to not be actually enqueued
first thing on opening a connection. Seems to not have caused harm in the
wild, but was unintentional.
Introduced three new events:
* CONNECTING - fired just before starting the connection process
* DISCONNECTING - fired just before starting the (active) disconnection
process
* PRINTER_STATE_CHANGED - fired every time the printer state changes
Also introduced new GCODE script beforePrinterDisconnected, which will
get sent just before the printer gets (actively) disconnected. Also enabled
communication object to wait for the send queue to be emptied before
closing it, in order to allow sending all lines from the disconnect script.
That way plugins don't need to implement the SettingsPlugin mixin in order to access their data folder, which is now an injected property in OctoPrintPlugin. Plugin authors should still always use the getter since that will also make sure the folder actually does exist (lazy creation).
PluginSettings.get_plugin_data_folder has been marked as deprecated.
Added phase specific hooks for queuing, queued, sending and sent phases of a command ("octoprint.comm.protocol.gcode.<phase>"). Removed old queuing phase hook and declared as obsolete hook in plugin manager to prevent plugins that depend on it from being enabled.
Adding those new hooks also necessitated refactoring the whole command processing, made it more modular and added phase specific handler functions that allow handling all blocking commands centrally for example.
This will hopefully prevent conflicting routes between multiple plugins from being registered and also ensures a more consistent behaviour compared to BlueprintPlugin mixins.
Thanks to @Salandora for bringing this up.