Fixed some errors with my dectalk protocol implementation. Thanks Codex. :)

This commit is contained in:
Storm Dragon
2026-07-26 20:59:14 -04:00
parent 9ac2e9e844
commit 11a4244cc3
3 changed files with 3 additions and 3 deletions
@@ -23,7 +23,7 @@ class driver(hardware_serial_driver):
return self._setting_command("dv ap", self._scale(pitch, 50, 350)) return self._setting_command("dv ap", self._scale(pitch, 50, 350))
def _volume_command(self, volume): def _volume_command(self, volume):
return self._setting_command("vo", self._scale(volume, 0, 100)) return self._setting_command("dv g5", self._scale(volume, 60, 86))
def _setting_command(self, command, value): def _setting_command(self, command, value):
return f"[:{command} {value}]".encode("ascii") return f"[:{command} {value}]".encode("ascii")
+1 -1
View File
@@ -141,7 +141,7 @@ def test_dectalk_usb_driver_writes_commands_and_speech(monkeypatch):
assert device.writes == [ assert device.writes == [
(0x02, b"[:ra 650]", 1000), (0x02, b"[:ra 650]", 1000),
(0x02, b"[:dv ap 350]", 1000), (0x02, b"[:dv ap 350]", 1000),
(0x02, b"[:vo 50]", 1000), (0x02, b"[:dv g5 73]", 1000),
(0x02, b"Hello world\x0b", 1000), (0x02, b"Hello world\x0b", 1000),
] ]
finally: finally:
+1 -1
View File
@@ -77,7 +77,7 @@ def test_dectalk_driver_writes_settings_and_cancel(serial_pair):
speech_driver.set_pitch(1.0) speech_driver.set_pitch(1.0)
speech_driver.set_volume(0.5) speech_driver.set_volume(0.5)
speech_driver.cancel() speech_driver.cancel()
expected = b"[:ra 650][:dv ap 350][:vo 50]\x03" expected = b"[:ra 650][:dv ap 350][:dv g5 73]\x03"
assert read_available(master_fd, len(expected)) == expected assert read_available(master_fd, len(expected)) == expected
finally: finally:
speech_driver.shutdown() speech_driver.shutdown()