@@ -262,12 +262,13 @@ def get_command_by_value_and_number(cmd: str, number: int) -> Optional[str]:
262262 initial_amps = get_initial_range (1 , msgs [2 ]["reply" ])
263263 initial_volts = get_initial_range (3 , msgs [2 ]["reply" ])
264264
265- initial_amps_command = get_command_by_value_and_number ("SR,A" , 3 )
265+ # sometimes the SR,A,Auto comes from 3rd or 4th response
266+ initial_amps_command_3 = get_command_by_value_and_number ("SR,A" , 3 )
267+ initial_amps_command_4 = get_command_by_value_and_number ("SR,A" , 4 )
266268 initial_volts_command = get_command_by_value_and_number ("SR,V" , 3 )
267-
268- assert (
269- initial_amps_command == f"SR,A,{ initial_amps } "
270- ), f"Do not set Amps range as initial. Expected 'SR,A,{ initial_amps } ', got { initial_amps_command !r} ."
269+ assert (initial_amps_command_3 == f"SR,A,{ initial_amps } " ) or (
270+ initial_amps_command_4 == f"SR,A,{ initial_amps } "
271+ ), f"Do not set Amps range as initial. Expected 'SR,A,{ initial_amps } ', got { initial_amps_command_3 !r} and { initial_amps_command_4 !r} ."
271272 assert (
272273 initial_volts_command == f"SR,V,{ initial_volts } "
273274 ), f"Do not set Volts range as initial. Expected 'SR,V,{ initial_volts } ', got { initial_volts_command !r} ."
0 commit comments