@@ -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} ."
@@ -706,33 +707,33 @@ def check_ptd_config(server_sd: SessionDescriptor) -> None:
706707 """
707708 ptd_config = server_sd .json_object ["ptd_config" ]
708709
709- dev_num = ptd_config [ "device_type" ]
710- assert (
711- dev_num in SUPPORTED_MODEL .values ()
712- ), f"Device number { dev_num } is not supported. Supported numbers are " + ", " . join (
713- [str (i ) for i in set (SUPPORTED_MODEL .values ())]
714- )
710+ for analyzer in ptd_config :
711+ dev_num = analyzer [ "device_type" ]
712+ assert dev_num in SUPPORTED_MODEL .values (), (
713+ f"Device number { dev_num } is not supported. Supported numbers are "
714+ + ", " . join ( [str (i ) for i in set (SUPPORTED_MODEL .values ())])
715+ )
715716
716- if dev_num == 77 :
717- channels = ""
718- command = ptd_config ["command" ]
717+ if dev_num == 77 :
718+ channels = ""
719+ command = analyzer ["command" ]
719720
720- for i in range (len (command )):
721- if command [i ] == "-c" :
722- channels = command [i + 1 ]
723- break
721+ for i in range (len (command )):
722+ if command [i ] == "-c" :
723+ channels = command [i + 1 ]
724+ break
724725
725- dev_name = ""
726- for name , num in SUPPORTED_MODEL .items ():
727- if num == dev_num :
728- dev_name = name
729- break
726+ dev_name = ""
727+ for name , num in SUPPORTED_MODEL .items ():
728+ if num == dev_num :
729+ dev_name = name
730+ break
730731
731- assert (
732- len (channels .split ("," )) == 2
733- and ptd_config ["channel" ]
734- and len (ptd_config ["channel" ]) == 2
735- ), f"Expected multichannel mode for { dev_name } , but got 1-channel."
732+ assert (
733+ len (channels .split ("," )) == 2
734+ and analyzer ["channel" ]
735+ and len (analyzer ["channel" ]) == 2
736+ ), f"Expected multichannel mode for { dev_name } , but got 1-channel."
736737
737738
738739def debug_check (server_sd : SessionDescriptor ) -> None :
0 commit comments