diff --git a/docs/TestPlan.md b/docs/TestPlan.md index b80fe405..2e28d399 100644 --- a/docs/TestPlan.md +++ b/docs/TestPlan.md @@ -152,14 +152,6 @@ Writes a known byte to a scratch register on a known I2C device. Reads it back. **`test_i2c_read_bad_address`** Calls `read_i2c_packet` with a non-existent I2C address. Asserts that `CommandError` or `ValueError` is raised (graceful error propagation). -### 2.5 GPIO and ADC - -**`test_read_gpio`** -Calls `read_gpio_value()`. Asserts the returned value is a float. - -**`test_read_adc`** -Calls `read_adc_value()`. Asserts the returned float is in [0.0, 3.3]. - ### 2.6 Fan control **`test_fan_set_and_get`** diff --git a/omotion/MotionConsole.py b/omotion/MotionConsole.py index 069a2797..e4b018bd 100644 --- a/omotion/MotionConsole.py +++ b/omotion/MotionConsole.py @@ -64,8 +64,6 @@ OW_CTRL_I2C_STATUS, OW_CTRL_I2C_WR, OW_CTRL_PDUMON, - OW_CTRL_READ_ADC, - OW_CTRL_READ_GPIO, OW_CTRL_SET_IND, OW_CTRL_SET_TRIG, OW_CTRL_START_TRIG, @@ -1643,84 +1641,6 @@ def reset_odometer(self, target: int = 2) -> bool: self._log_command_error("reset_odometer", e) return False - def read_gpio_value(self) -> int: - """ - Read GPIO value. - - Returns: - int: The GPIO register value (4-byte unsigned integer). - - Raises: - ValueError: If the UART is not connected or the firmware returns - an unexpected response. - Exception: If an error occurs during communication. - """ - try: - if self.uart.demo_mode: - return 0 - - if not self.is_connected(): - raise ValueError("Console controller not connected") - - r = self.uart.send_packet( - id=None, packetType=OW_CONTROLLER, command=OW_CTRL_READ_GPIO, data=None - ) - self.uart.clear_buffer() - if r.packetType == OW_ERROR: - raise ValueError("Device returned an error for OW_CTRL_READ_GPIO") - if r.data_len == 4: - return struct.unpack(" float: - """ - Read ADC value. - - Returns: - float: The ADC reading as a 32-bit float. - - Raises: - ValueError: If the UART is not connected or the firmware returns - an unexpected response. - Exception: If an error occurs during communication. - """ - try: - if self.uart.demo_mode: - return 0.0 - - if not self.is_connected(): - raise ValueError("Console controller not connected") - - r = self.uart.send_packet( - id=None, packetType=OW_CONTROLLER, command=OW_CTRL_READ_ADC, data=None - ) - self.uart.clear_buffer() - if r.packetType == OW_ERROR: - raise ValueError("Device returned an error for OW_CTRL_READ_ADC") - if r.data_len == 4: - return struct.unpack(" tuple[float, float, float]: """ Get the current temperatures from the Console device. diff --git a/omotion/config.py b/omotion/config.py index aaf91dde..56fe766f 100644 --- a/omotion/config.py +++ b/omotion/config.py @@ -195,8 +195,6 @@ def is_valid_serial(serial: str) -> bool: OW_CTRL_GET_FSYNC = 0x1B OW_CTRL_GET_LSYNC = 0x1C OW_CTRL_TEC_DAC = 0x1D -OW_CTRL_READ_ADC = 0x1E -OW_CTRL_READ_GPIO = 0x1F OW_CTRL_GET_TEMPS = 0x20 OW_CTRL_TECADC = 0x21 OW_CTRL_TEC_STATUS = 0x22 diff --git a/tests/test_console.py b/tests/test_console.py index 681c8dcc..8186cca4 100644 --- a/tests/test_console.py +++ b/tests/test_console.py @@ -152,25 +152,6 @@ def test_i2c_read_bad_address(console): ) -# =========================================================================== -# 2.5 GPIO and ADC -# =========================================================================== - -@pytest.mark.xfail(reason="Firmware returns 0-byte GPIO payload (console-fw issue)", raises=ValueError) -def test_read_gpio(console): - val = console.read_gpio_value() - # Returns int or float depending on firmware response - assert isinstance(val, (int, float)) - - -@pytest.mark.xfail(reason="Firmware returns 0-byte ADC payload (console-fw issue)", raises=ValueError) -def test_read_adc(console): - val = console.read_adc_value() - assert isinstance(val, (int, float)) - if isinstance(val, float): - assert 0.0 <= val <= 3.3, f"ADC value {val} out of [0, 3.3]" - - # =========================================================================== # 2.6 Fan control # ===========================================================================