Hanut Vemulapalli opened merge request !253: Resolve "PressureUnits(NameEnum) has multiple names (mbar, bar) associated to the same value 0" at ethz_hvl / hv...

Hanut Vemulapalli
2022-04-04T13:48:58Z

Closes #274

In

def set_display_unit(self, unit: Union[str, PressureUnits]) -> None:
"""
Set the unit in which the measurements are shown on the display.

:raises SerialCommunicationIOError: when communication port is not opened
:raises PfeifferTPGError: if command fails
"""

if not isinstance(unit, self.PressureUnits):
unit = self.PressureUnits(unit)

try:
self.com.send_command(f"UNI,{unit.value}")
logger.info(f"Setting display unit to {unit.name}")
except PfeifferTPGError as e:
logger.error(
f"Setting display unit to {unit.name} failed. "
f"Not all units are available on all TGP models",
exc_info=e,
)
raise

Pass 0 by default instead of using PressureUnits