paneldue: register "paneldue_beep" remote method
Signed-off-by: Eric Callahan <arksine.code@gmail.com>
This commit is contained in:
parent
ba78a82a26
commit
6464bbfc3c
|
@ -158,7 +158,6 @@ class PanelDue:
|
||||||
# Set up macros
|
# Set up macros
|
||||||
self.confirmed_gcode = ""
|
self.confirmed_gcode = ""
|
||||||
self.mbox_sequence = 0
|
self.mbox_sequence = 0
|
||||||
self.beep_sequence = 0
|
|
||||||
self.available_macros = {}
|
self.available_macros = {}
|
||||||
self.confirmed_macros = {
|
self.confirmed_macros = {
|
||||||
"RESTART": "RESTART",
|
"RESTART": "RESTART",
|
||||||
|
@ -193,6 +192,9 @@ class PanelDue:
|
||||||
self.server.register_event_handler(
|
self.server.register_event_handler(
|
||||||
"server:gcode_response", self.handle_gcode_response)
|
"server:gcode_response", self.handle_gcode_response)
|
||||||
|
|
||||||
|
self.server.register_remote_method(
|
||||||
|
"paneldue_beep", self.paneldue_beep)
|
||||||
|
|
||||||
# These commands are directly executued on the server and do not to
|
# These commands are directly executued on the server and do not to
|
||||||
# make a request to Klippy
|
# make a request to Klippy
|
||||||
self.direct_gcodes = {
|
self.direct_gcodes = {
|
||||||
|
@ -289,22 +291,12 @@ class PanelDue:
|
||||||
self.printer_state[obj].update(items)
|
self.printer_state[obj].update(items)
|
||||||
else:
|
else:
|
||||||
self.printer_state[obj] = items
|
self.printer_state[obj] = items
|
||||||
if "gcode_macro PANELDUE_BEEP" in status:
|
|
||||||
# This only processes a paneldue beep when the macro's
|
|
||||||
# variables have changed
|
|
||||||
params = self.printer_state["gcode_macro PANELDUE_BEEP"]
|
|
||||||
try:
|
|
||||||
self.handle_paneldue_beep(**params)
|
|
||||||
except Exception:
|
|
||||||
logging.exception("Unable to process PANELDUE_BEEP")
|
|
||||||
|
|
||||||
def handle_paneldue_beep(self, sequence, frequency, duration):
|
def paneldue_beep(self, frequency, duration):
|
||||||
if sequence != self.beep_sequence:
|
duration = int(duration * 1000.)
|
||||||
self.beep_sequence = sequence
|
self.ioloop.spawn_callback(
|
||||||
duration = int(duration * 1000.)
|
self.write_response,
|
||||||
self.ioloop.spawn_callback(
|
{'beep_freq': frequency, 'beep_length': duration})
|
||||||
self.write_response,
|
|
||||||
{'beep_freq': frequency, 'beep_length': duration})
|
|
||||||
|
|
||||||
async def process_line(self, line):
|
async def process_line(self, line):
|
||||||
self.debug_queue.append(line)
|
self.debug_queue.append(line)
|
||||||
|
|
Loading…
Reference in New Issue