Skip to content

Commit

Permalink
Merge pull request #362 from makermelissa/vivid-unit
Browse files Browse the repository at this point in the history
Add Vivid Unit Detection
  • Loading branch information
tannewt authored Jun 17, 2024
2 parents 35da22e + 9563c61 commit 05c1e8d
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 1 deletion.
17 changes: 16 additions & 1 deletion adafruit_platformdetect/board.py
Original file line number Diff line number Diff line change
Expand Up @@ -167,6 +167,7 @@ def id(self) -> Optional[str]:
or self._armbian_id()
or self._diet_pi_id()
or self._asus_tinker_board_id()
or self._vivid_unit_id()
)
elif chip_id == chips.RK3399PRO:
board_id = self._asus_tinker_board_id()
Expand Down Expand Up @@ -712,6 +713,14 @@ def _asus_tinker_board_id(self) -> Optional[str]:

return board

def _vivid_unit_id(self) -> Optional[str]:
"""Check what type of vivid unit."""
board_value = self.detector.get_device_model()
board = None
if board_value and "RK3399 VIVID" in board_value:
board = boards.VIVID_UNIT
return board

def _pcduino_board_id(self) -> Optional[str]:
"""Check on the type of Pcduino"""
board_value = self.detector.get_device_model()
Expand Down Expand Up @@ -1023,7 +1032,7 @@ def any_nxp_navq_board(self) -> bool:

@property
def any_olimex_board(self):
"""Check whether the current board is any Pine64 device."""
"""Check whether the current board is any Olimex device."""
return self.id in boards._OLIMEX_IDS

@property
Expand All @@ -1036,6 +1045,11 @@ def any_luckfox_pico_board(self):
"""Check whether the current board is any Luckfox Pico device."""
return self.id in boards._LUCKFOX_IDS

@property
def any_vivid_unit(self):
"""Check whether the current board is any Vivid Unit device."""
return self.id in boards._VIVID_UNIT_IDS

@property
def os_environ_board(self) -> bool:
"""Check whether the current board is an OS environment variable special case."""
Expand Down Expand Up @@ -1103,6 +1117,7 @@ def lazily_generate_conditions():
yield self.any_repka_board
yield self.any_milkv_board
yield self.any_luckfox_pico_board
yield self.any_vivid_unit

return any(condition for condition in lazily_generate_conditions())

Expand Down
5 changes: 5 additions & 0 deletions adafruit_platformdetect/constants/boards.py
Original file line number Diff line number Diff line change
Expand Up @@ -232,6 +232,11 @@

_KHADAS_40_PIN_IDS = (KHADAS_VIM3,)

# Vivid Unit
VIVID_UNIT = "VIVID_UNIT"

_VIVID_UNIT_IDS = (VIVID_UNIT,)

# Luckfox Pico boards
LUCKFOX_PICO = "LUCKFOX_PICO"
LUCKFOX_PICO_MAX = "LUCKFOX_PICO_MAX"
Expand Down

0 comments on commit 05c1e8d

Please sign in to comment.