1212depth_sensor = dev .first_depth_sensor ()
1313dp_device = dev .as_debug_protocol ()
1414
15-
15+ is_projector_option_supported = True
1616######################################## HELPERS ##########################################
1717
1818def get_temperatures_from_xu ():
19+ global is_projector_option_supported
1920 pvt_temp = - 10
2021 ohm_temp = - 10
2122 proj_temp = - 10
2223
2324 test .check (depth_sensor .supports (rs .option .soc_pvt_temperature ))
2425 test .check (depth_sensor .supports (rs .option .ohm_temperature ))
25- test . check ( depth_sensor .supports (rs .option .projector_temperature ) )
26+ is_projector_option_supported = depth_sensor .supports (rs .option .projector_temperature )
2627
2728 pvt_temp = depth_sensor .get_option (rs .option .soc_pvt_temperature )
2829 ohm_temp = depth_sensor .get_option (rs .option .ohm_temperature )
29- proj_temp = depth_sensor .get_option (rs .option .projector_temperature )
30+ if is_projector_option_supported :
31+ proj_temp = depth_sensor .get_option (rs .option .projector_temperature )
3032
3133 return pvt_temp , ohm_temp , proj_temp
3234
@@ -79,8 +81,10 @@ def get_temperatures_from_hwm():
7981 ohm_temp = all_temp_list [ohm_temp_index - 1 ]
8082
8183 # get projector temperature
82- proj_temp_index = 1
83- proj_temp = all_temp_list [proj_temp_index - 1 ]
84+ proj_temp = - 10
85+ if is_projector_option_supported :
86+ proj_temp_index = 1
87+ proj_temp = all_temp_list [proj_temp_index - 1 ]
8488
8589 return pvt_temp , ohm_temp , proj_temp
8690
@@ -97,7 +101,8 @@ def get_temperatures_from_hwm():
97101tolerance = 3.0
98102test .check_approx_abs (pvt_temp_xu , pvt_temp_hwm , tolerance )
99103test .check_approx_abs (ohm_temp_xu , ohm_temp_hwm , tolerance )
100- test .check_approx_abs (projector_temp_xu , projector_temp_xu , tolerance )
104+ if is_projector_option_supported :
105+ test .check_approx_abs (projector_temp_xu , projector_temp_xu , tolerance )
101106
102107test .finish ()
103108#############################################################################################
0 commit comments