修复设置舵机信号时长参数后,连续不停开关舵机 可能会造成出错的问题
This commit is contained in:
parent
440010b9cb
commit
bda6839686
@ -76,6 +76,7 @@ class PrinterServo:
|
|||||||
self.signal_duration -= 0.001
|
self.signal_duration -= 0.001
|
||||||
print_time = max(print_time, print_time + self.signal_duration)
|
print_time = max(print_time, print_time + self.signal_duration)
|
||||||
self.mcu_servo.set_pwm(print_time, 0)
|
self.mcu_servo.set_pwm(print_time, 0)
|
||||||
|
self.last_value_time = print_time
|
||||||
def _handle_ready(self):
|
def _handle_ready(self):
|
||||||
print_time = self.printer.lookup_object('toolhead').get_last_move_time()
|
print_time = self.printer.lookup_object('toolhead').get_last_move_time()
|
||||||
self._handle_signal_duration(print_time)
|
self._handle_signal_duration(print_time)
|
||||||
@ -90,6 +91,7 @@ class PrinterServo:
|
|||||||
cmd_SET_SERVO_help = "Set servo angle"
|
cmd_SET_SERVO_help = "Set servo angle"
|
||||||
def cmd_SET_SERVO(self, gcmd):
|
def cmd_SET_SERVO(self, gcmd):
|
||||||
print_time = self.printer.lookup_object('toolhead').get_last_move_time()
|
print_time = self.printer.lookup_object('toolhead').get_last_move_time()
|
||||||
|
print_time = max(print_time, self.last_value_time)
|
||||||
width = gcmd.get_float('WIDTH', None)
|
width = gcmd.get_float('WIDTH', None)
|
||||||
if width is not None:
|
if width is not None:
|
||||||
if self.steps_decomposed:
|
if self.steps_decomposed:
|
||||||
|
Loading…
x
Reference in New Issue
Block a user