@@ -482,30 +482,29 @@ def _read(self, register: int, length: int) -> bytearray:
482
482
def _write (self , register : int , values : bytearray ) -> None :
483
483
raise NotImplementedError ()
484
484
485
- # garberw added begin ===========================
486
485
def set_gas_heater (self , heater_temp : UINT16 , heater_time : UINT16 ) -> bool :
487
486
"""
488
- * @brief Enable and configure gas reading + heater
487
+ * @brief Enable and configure gas reading + heater (None disables)
489
488
* @param heater_temp
490
489
* Desired temperature in degrees Centigrade
491
490
* @param heater_time
492
491
* Time to keep heater on in milliseconds
493
492
* @return True on success, False on failure
494
493
"""
495
- if (heater_temp == 0 ) or (heater_time == 0 ):
496
- return False
497
- # enable = BME68X_ENABLE
498
494
try :
499
- self ._set_heatr_conf (heater_temp , heater_time )
495
+ if (heater_temp is None ) or (heater_time is None ):
496
+ self ._set_heatr_conf (heater_temp or 0 , heater_time or 0 , enable = False )
497
+ else :
498
+ self ._set_heatr_conf (heater_temp , heater_time )
500
499
except GasHeaterException :
501
500
return False
502
501
return True
503
502
504
- def _set_heatr_conf (self , heater_temp : UINT16 , heater_time : UINT16 ) -> None :
503
+ def _set_heatr_conf (
504
+ self , heater_temp : UINT16 , heater_time : UINT16 , enable : bool = True
505
+ ) -> None :
505
506
# restrict to BME68X_FORCED_MODE
506
507
op_mode : UINT8 = _BME68X_FORCED_MODE
507
- # restrict to enable = True
508
- enable : bool = True
509
508
nb_conv : UINT8 = 0
510
509
hctrl : UINT8 = _BME68X_ENABLE_HEATER
511
510
run_gas : UINT8 = 0
0 commit comments