Skip to content

Commit 8af0f9e

Browse files
committed
add support for M355 command to control chamber light, #67
1 parent ca30e0f commit 8af0f9e

File tree

3 files changed

+23
-2
lines changed

3 files changed

+23
-2
lines changed

octoprint_bambu_printer/printer/bambu_virtual_printer.py

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -596,6 +596,17 @@ def _pause_print(self):
596596
self._current_state.pause_print()
597597
return True
598598

599+
@gcode_executor.register("M355")
600+
def _case_lights(self, data: str) -> bool:
601+
if data == "M355 S1":
602+
light_command = commands.CHAMBER_LIGHT_ON
603+
elif data == "M355 S0":
604+
light_command = commands.CHAMBER_LIGHT_OFF
605+
else:
606+
return False
607+
608+
return self.bambu_client.publish(light_command)
609+
599610
@gcode_executor.register("M524")
600611
def _cancel_print(self):
601612
self._current_state.cancel_print()

octoprint_bambu_printer/static/js/bambu_printer.js

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,16 @@ $(function () {
4848
return output_list;
4949
};
5050

51+
self.getAdditionalControls = function() {
52+
var buttons = [
53+
{ name: "Bambu", type: "section", layout: "horizontal", children: [
54+
{type: "command", name: "Light On", enabled: "true", command: "M355 S1"},
55+
{type: "command", name: "Light Off", enabled: "true", command: "M355 S0"}
56+
]}
57+
];
58+
return buttons;
59+
};
60+
5161
self.getAuthToken = function (data) {
5262
self.settingsViewModel.settings.plugins.bambu_printer.auth_token("");
5363
self.auth_type("");
@@ -133,7 +143,7 @@ $(function () {
133143
};
134144

135145
self.onAfterBinding = function () {
136-
console.log(self.ams_mapping_computed());
146+
// console.log(self.ams_mapping_computed());
137147
};
138148

139149
self.showTimelapseThumbnail = function(data) {

setup.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
plugin_name = "OctoPrint-BambuPrinter"
1515

1616
# The plugin's version. Can be overwritten within OctoPrint's internal data via __plugin_version__ in the plugin module
17-
plugin_version = "0.1.8rc14"
17+
plugin_version = "0.1.8rc15"
1818

1919
# The plugin's description. Can be overwritten within OctoPrint's internal data via __plugin_description__ in the plugin
2020
# module

0 commit comments

Comments
 (0)