mpm: ZBX: Allow reading top and bottom temperature sensors

ZBX already exposed a temperature sensor: `temperature` which
returns the mean value of the top and bottom temperature sensors.

Add sensors `temperature_top` and `temperature_bottom` for
reading the values of the temperature sensors separately.
This commit is contained in:
Volkan Öz 2025-03-18 13:49:02 +01:00 committed by Jörg Hofrichter
parent 2f5136c9e9
commit 3eb6f3597b
2 changed files with 35 additions and 9 deletions

View File

@ -142,10 +142,12 @@ sensors. Unlike the (analog) synthesizers on the daughterboard, the NCO "unlock"
is not used to signify a loss of reference lock, but to signal that the NCO is
still in reset.
Additionally, the ZBX has a temperature sensor: `temperature`. While the UHD
API allows addressing a sensor based on direction (RX/TX) and channel (0/1),
there is only one physical temperature sensor, and it will return the same value
regardless of which channel or direction is selected.
Additionally, the ZBX has a temperature sensor: `temperature` which returns
the mean value of the top and bottom temperature sensor. Top and bottom sensors
can be accessed with `temperature_top` and `temperature_bottom`. While the UHD
API allows addressing a sensor based on direction (RX/TX) and channel (0/1),
the returned value will be the same regardless of which channel or direction
is selected.
The following API calls can be used to enumerate available sensors, and query
their values:

View File

@ -30,11 +30,15 @@ class ZBX(X4xxDbMixin, DboardManagerBase):
#########################################################################
pids = [0x4002]
rx_sensor_callback_map = {
'temperature': 'get_rf_temp_sensor',
'temperature': 'get_rf_temp_sensor_average',
'temperature_top': 'get_rf_temp_sensor_top',
'temperature_bottom': 'get_rf_temp_sensor_bottom',
'rfdc_rate': 'get_rfdc_rate_sensor',
}
tx_sensor_callback_map = {
'temperature': 'get_rf_temp_sensor',
'temperature': 'get_rf_temp_sensor_average',
'temperature_top': 'get_rf_temp_sensor_top',
'temperature_bottom': 'get_rf_temp_sensor_bottom',
'rfdc_rate': 'get_rfdc_rate_sensor',
}
has_db_flash = True
@ -395,11 +399,31 @@ class ZBX(X4xxDbMixin, DboardManagerBase):
###########################################################################
# Sensors
###########################################################################
def get_rf_temp_sensor(self, _):
def get_rf_temp_sensor_top(self, _):
"""
Return the RF temperature sensor value
Return the RF temperature sensor value of the top side of the PCB
"""
self.log.trace("Reading RF daughterboard temperature.")
self.log.trace("Reading RF daughterboard top temperature.")
sensor_names = [
f"TMP112 DB{self.slot_idx} Top",
]
return get_temp_sensor(sensor_names, log=self.log)
def get_rf_temp_sensor_bottom(self, _):
"""
Return the RF temperature sensor value of the bottom side of the PCB
"""
self.log.trace("Reading RF daughterboard bottom temperature.")
sensor_names = [
f"TMP112 DB{self.slot_idx} Bottom",
]
return get_temp_sensor(sensor_names, log=self.log)
def get_rf_temp_sensor_average(self, _):
"""
Return the RF temperature sensor value of the average of the top and bottom side of the PCB
"""
self.log.trace("Reading RF daughterboard average temperature.")
sensor_names = [
f"TMP112 DB{self.slot_idx} Top",
f"TMP112 DB{self.slot_idx} Bottom",