Skip to content

Commit

Permalink
Add Option for No Rfid Reader
Browse files Browse the repository at this point in the history
  • Loading branch information
AlvinSchiller committed Nov 13, 2023
1 parent ffddf96 commit 5b77fbb
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 3 deletions.
5 changes: 2 additions & 3 deletions ci/installation/run_installation_tests.sh
Original file line number Diff line number Diff line change
Expand Up @@ -25,13 +25,12 @@ echo 'debconf debconf/frontend select Noninteractive' | sudo debconf-set-selecti
# y build local docs
# n no kiosk mode
# y install node
# 2 MC522 RfidReader
# n dont add more reader
# 0 No RfidReader
# n dont reboot
# 'y\n n\n'


"$local_install_script_path"/install-jukebox.sh <<< $'y\nn\nn\nn\nn\nn\ny\ny\ny\nn\ny\n2\nn\nn\n'
"$local_install_script_path"/install-jukebox.sh <<< $'y\nn\nn\nn\nn\nn\ny\ny\ny\nn\ny\n1\nn\n'
INSTALLATION_EXITCODE=$?

# count abortion due to "not user pi" as success
Expand Down
12 changes: 12 additions & 0 deletions src/jukebox/components/rfid/configure/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -134,10 +134,14 @@ def query_user_for_reader(dependency_install='query') -> dict:
reader_dirs = [*included_readers, *sorted(reader_dirs, key=lambda x: x.casefold())]
logger.debug(f"reader_dirs = {reader_dirs}")

no_rfid_reader="No RFID Reader"
# Try to load the description modules from all valid directories (as this has no dependencies)
# If unavailable, use placeholder description
reader_description_modules = []
reader_descriptions = []

# Add Option to not add RFid Reader
reader_descriptions.append(no_rfid_reader)
for reader_type in reader_dirs:
try:
reader_description_modules.append(importlib.import_module('components.rfid.hardware.' + reader_type
Expand All @@ -156,6 +160,9 @@ def query_user_for_reader(dependency_install='query') -> dict:
f"Spelling error?")
reader_descriptions.append('(No description provided!)')




# Prepare the configuration collector with the base values
config_dict = {'rfid': {'readers': {}}}

Expand All @@ -170,6 +177,11 @@ def query_user_for_reader(dependency_install='query') -> dict:
print("")
reader_id = pyil.input_int("Reader module number?", min=0, max=len(reader_descriptions) - 1,
prompt_color=Colors.lightgreen, prompt_hint=True)

if reader_id == 0:
logger.debug("{no_rfid_reader} selected. skip")
break

# The (short) name of the selected reader module, which is identical to the directory name
reader_select_name.append(reader_dirs[reader_id])

Expand Down

0 comments on commit 5b77fbb

Please sign in to comment.