all commands implemented, untested.

This commit is contained in:
jpunkt 2021-11-04 12:52:42 +01:00
parent 6eb2282180
commit c54301d14e
1 changed files with 10 additions and 5 deletions

View File

@ -55,8 +55,7 @@ class Scroll:
self.c += self._dir
def _stop(self, pin):
self.a_pin.value(0)
self.b_pin.value(0)
self.speed = 0
@property
def dir(self):
@ -74,10 +73,10 @@ class Scroll:
@speed.setter
def speed(self, speed):
self._speed = speed
self.en_pin.duty_u16(speed * (_PWM_MAX // 100))
self.dir = (1 if speed > 0 else
(-1 if speed < 0 else 0))
self._speed = speed
pwm_bl = PWM(Pin(_PIN_EN_BACKLIGHT))
pwm_bl.freq(_PWM_FREQ)
@ -189,9 +188,14 @@ def recording(timeout):
time.sleep_ms(50)
return 'OK'
def rewind(*opts):
print(f'rewind({opts})')
scroll_h.speed = -100
scroll_v.speed = -100
while (scroll_h.speed + scroll_v.speed) > 0:
time.sleep_ms(10)
scroll_h.c = 0
scroll_v.c = 0
return 'OK'
###############################################################################
@ -201,6 +205,7 @@ choice_map = {
CMD_BL: backlight,
CMD_FL: frontlight,
CMD_UI: user_interaction,
CMD_RC: recording,
CMD_RW: rewind
}