Whole file
alengwenus/pypck
The author described this change as “Fix commands for rt600 and rt1200 (#117)”. It counts as a record because the checks below fail on the code as it stood at 30ee8b389 and pass on 5adc67058, with nothing else changed between the two runs.
Projectalengwenus/pypck
Fix saved2024-08-15
Sharing licenceMIT · LICENSE
Change size+6 −6
What the code was meant to do, written into the code itself as a save note
Fix commands for rt600 and rt1200 (#117)
The change
| 586 | 586 | if state == lcn_defs.MotorStateModifier.UP: | |
| 587 | 587 | if reverse_time in [None, lcn_defs.MotorReverseTime.RT70]: | |
| 588 | 588 | params = (0x01, 0xE4, 0x00) | |
| 589 | + | ret = f"X2{params[0]:03d}{params[1]:03d}{params[2]:03d}" | |
| 589 | 590 | elif reverse_time == lcn_defs.MotorReverseTime.RT600: | |
| 590 | - | params = (0x04, 0xC8, 0x08) | |
| 591 | + | ret = PckGenerator.dim_output(0, 100, 8) | |
| 591 | 592 | elif reverse_time == lcn_defs.MotorReverseTime.RT1200: | |
| 592 | - | params = (0x04, 0xC8, 0x0B) | |
| 593 | + | ret = PckGenerator.dim_output(0, 100, 11) | |
| 593 | 594 | else: | |
| 594 | 595 | raise ValueError("Wrong MotorReverseTime.") | |
| 595 | - | ret = f"X2{params[0]:03d}{params[1]:03d}{params[2]:03d}" | |
| 596 | 596 | ||
| 597 | 597 | elif state == lcn_defs.MotorStateModifier.DOWN: | |
| 598 | 598 | if reverse_time in [None, lcn_defs.MotorReverseTime.RT70]: | |
| 599 | 599 | params = (0x01, 0x00, 0xE4) | |
| 600 | + | ret = f"X2{params[0]:03d}{params[1]:03d}{params[2]:03d}" | |
| 600 | 601 | elif reverse_time == lcn_defs.MotorReverseTime.RT600: | |
| 601 | - | params = (0x05, 0xC8, 0x08) | |
| 602 | + | ret = PckGenerator.dim_output(1, 100, 8) | |
| 602 | 603 | elif reverse_time == lcn_defs.MotorReverseTime.RT1200: | |
| 603 | - | params = (0x05, 0xC8, 0x0B) | |
| 604 | + | ret = PckGenerator.dim_output(1, 100, 11) | |
| 604 | 605 | else: | |
| 605 | 606 | raise ValueError("Wrong MotorReverseTime.") | |
| 606 | - | ret = f"X2{params[0]:03d}{params[1]:03d}{params[2]:03d}" | |
| 607 | 607 | ||
| 608 | 608 | elif state == lcn_defs.MotorStateModifier.STOP: | |
| 609 | 609 | ret = "AY000000" |
The check that tells the two apart
fail→pass·tests/test_commands.py::test_command_generation_single_mod_noack[A1DI100008-command179]
fail→pass·tests/test_commands.py::test_command_generation_single_mod_noack[A1DI100011-command180]
fail→pass·tests/test_commands.py::test_command_generation_single_mod_noack[A2DI100008-command182]
fail→pass·tests/test_commands.py::test_command_generation_single_mod_noack[A2DI100011-command183]
Check file tests/test_commands.py, taken without changes from the fix and copied onto the older code, so the exact same check runs against both versions.
Origin and history
The code before it30ee8b389d38379e27fb705b2f738f76f06186ee
Broken version dated2024-08-14
Modulepypck.pck_commands
Units changedPckGenerator
Fingerprinta1deddb1ec945c8f
Checked2026-08-18 by goldset/0.1
Every field above is generated by our program. None of it is written by hand.