Auto-Vacuum on CA1 via "Ext. Control"#320
Auto-Vacuum on CA1 via "Ext. Control"#320SergeBakharev wants to merge 1 commit intoCarvera-Community:developfrom
Conversation
This commit adds a new configuration setting to enable the "Ext. Control" switch to function as vacuum control for the CA1 model. enabling auto-vacuum functionality. This commit is still a WIP, as currently the external control switch is activated as soon as the "Auto Vacuum" switch is toggled, and does not deactivate when the job has finished.
| def reload_device_specific_ui(self): | ||
| """ Reloads the device-specific UI elements.""" | ||
| # Initialize device-specific settings | ||
| app = App.get_running_app() | ||
| if app.model == 'CA1': | ||
| self.ca1_ext_control_as_vacuum = self.config.getboolean( | ||
| 'Advanced', 'ca1_ext_control_as_vacuum', fallback=False) | ||
|
|
||
| self.spindle_drop_down = SpindleDropDown() | ||
| self.coord_popup = CoordPopup(self.coord_config) | ||
|
|
||
|
|
There was a problem hiding this comment.
This duplicates the existing Makera.setUIForModel() code. Better to extend the functionality there.
| logging.info("Setting vacuum mode to: {}".format(self.control_list['vacuum_mode'][1])) | ||
| if self.ca1_ext_control_as_vacuum: | ||
| self.controller.setExternalControl(100 if self.control_list['vacuum_mode'][1] else 0) | ||
| else: | ||
| self.controller.setVacuumMode(self.control_list['vacuum_mode'][1]) |
There was a problem hiding this comment.
I see what you mean. Yes, this has the effect of turning on the vacuum whenever the ca1_ext_control_as_vacuum setting is enabled, not based on the job start/stop.
While tempting it's not possible to send M851 / M852 while the machine is playing a gcode file. So doing a conditional on the machine status to send the command isn't the way.
As for
manually interject the external control m-codes (M851 / M852) before/after the job
This is what I would be tempted to do. It's easy to add before the playback of a file via the buffer command ( see how this is used in Makera.play() and Makera.apply()), and running the command immediate after play should queue it to stop after file play back finishes.
However there is potential for edge case issues, for example what happens if you pause gcode playback?
For this reason actually it is probably safest to implement the functionality in the firmware. Basically extend M331 and M332 to read a machine config to see if it should use the Ext Control output to perform the vacuum function.
|
I suggest also writing some code around |
This PR adds a new configuration setting to enable the "Ext. Control" switch to function as vacuum control for the CA1 model. enabling auto-vacuum functionality. As discussed in #286