Renamed rewrote, and wrote tests for the conversion functions for readability and reusability.
Function name changes that might break something in uncommitted code:
to_hex -> bits_to_hexto_arduino_string -> bits_to_arduino_stringto_data_timings -> bits_to_run_lengths_microsecondsto_levels -> bits_to_run_lengths_pulses
Also, the way an exception is raised when trying to send a bit pattern with >9 bits to the arduino has changed. Instead of an exception when attempting to access a non-existent key in the "logic_level_to_data_num" dict, a ValueError is raised in bits_to_arduino_string. For example, I made a change in serial_brute_forcer_class.py to make it work, but this change might cause issues anywhere you're validating some set of bits before sending it to the arduino. The bit_flipirs still work and appropriately check for errors.
With that different error checking in mind, logic_levels_to_data_nums can be achieved with a list comprehension multiplying each element by cfg.PULSE_LENGTH.
Renamed rewrote, and wrote tests for the conversion functions for readability and reusability.
Function name changes that might break something in uncommitted code:
to_hex
->bits_to_hex
to_arduino_string
->bits_to_arduino_string
to_data_timings
->bits_to_run_lengths_microseconds
to_levels
->bits_to_run_lengths_pulses
Also, the way an exception is raised when trying to send a bit pattern with >9 bits to the arduino has changed. Instead of an exception when attempting to access a non-existent key in the "logic_level_to_data_num" dict, a ValueError is raised in bits_to_arduino_string. For example, I made a change in
serial_brute_forcer_class.py
to make it work, but this change might cause issues anywhere you're validating some set of bits before sending it to the arduino. Thebit_flipir
s still work and appropriately check for errors.With that different error checking in mind,
logic_levels_to_data_nums
can be achieved with a list comprehension multiplying each element bycfg.PULSE_LENGTH
.