|
5 | 5 | import re |
6 | 6 | import struct |
7 | 7 | from dataclasses import dataclass, field |
8 | | -from typing import TYPE_CHECKING, Annotated, Dict, List, Literal, Optional |
| 8 | +from typing import TYPE_CHECKING, Annotated, Dict, List, Literal |
9 | 9 |
|
10 | 10 | import numpy as np |
11 | 11 |
|
@@ -397,7 +397,7 @@ def get_hardware_id(self, module:int=0) -> str: |
397 | 397 | logger.error("Unexpected error during process: %s", e) |
398 | 398 | raise # Re-raise the exception for the caller to handle |
399 | 399 |
|
400 | | - def read_config(self, module:int=0) -> Optional[LifuUserConfig]: |
| 400 | + def read_config(self, module:int=0) -> LifuUserConfig | None: |
401 | 401 | """ |
402 | 402 | Read the user configuration from device flash. |
403 | 403 |
|
@@ -450,7 +450,7 @@ def read_config(self, module:int=0) -> Optional[LifuUserConfig]: |
450 | 450 | logger.exception("Unexpected error reading config") |
451 | 451 | raise |
452 | 452 |
|
453 | | - def write_config(self, config: LifuUserConfig, module:int=0) -> Optional[LifuUserConfig]: |
| 453 | + def write_config(self, config: LifuUserConfig, module:int=0) -> LifuUserConfig | None: |
454 | 454 | """ |
455 | 455 | Write user configuration to device flash. |
456 | 456 |
|
@@ -517,7 +517,7 @@ def write_config(self, config: LifuUserConfig, module:int=0) -> Optional[LifuUse |
517 | 517 | logger.exception("Unexpected error writing config") |
518 | 518 | raise |
519 | 519 |
|
520 | | - def write_config_json(self, json_str: str, module:int=0) -> Optional[LifuUserConfig]: |
| 520 | + def write_config_json(self, json_str: str, module:int=0) -> LifuUserConfig | None: |
521 | 521 | """ |
522 | 522 | Write user configuration from a JSON string. |
523 | 523 |
|
@@ -982,7 +982,7 @@ def async_mode(self, enable: bool | None = None) -> bool: |
982 | 982 | else: |
983 | 983 | payload = None |
984 | 984 |
|
985 | | - r = self.uart.send_packet(id=None, packetType=OW_CONTROLLER, command=OW_CMD_ASYNC, addr=0, data=payload) |
| 985 | + r = self.uart.send_packet(id=None, packetType=OW_CMD, command=OW_CMD_ASYNC, addr=0, data=payload) |
986 | 986 | self.uart.clear_buffer() |
987 | 987 | # r.print_packet() |
988 | 988 | if r.packet_type == OW_ERROR: |
@@ -1332,7 +1332,7 @@ def write_block(self, identifier: int, start_address: int, reg_values: List[int] |
1332 | 1332 | logger.error("Unexpected error in write_block: %s", e) |
1333 | 1333 | raise # Re-raise the exception for the caller to handle |
1334 | 1334 |
|
1335 | | - def read_block(self, identifier: int, start_address: int, count: int) -> Optional[List[int]]: |
| 1335 | + def read_block(self, identifier: int, start_address: int, count: int) -> List[int] | None: |
1336 | 1336 | """ |
1337 | 1337 | Read a block of consecutive register values from the TX device. |
1338 | 1338 |
|
|
0 commit comments