Skip to content

Commit

Permalink
Update OLED_ENABLED logic to try import
Browse files Browse the repository at this point in the history
Instead of depending on a hardcoded path, try to import the module and
disable oled if that fails
  • Loading branch information
techhazard committed Feb 21, 2024
1 parent 89541d2 commit 38f5056
Showing 1 changed file with 8 additions and 7 deletions.
15 changes: 8 additions & 7 deletions argoneon/argononed.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@
import sys
import os
import time
import datetime

from threading import Thread
from queue import Queue
Expand All @@ -46,16 +47,16 @@
else:
bus=smbus.SMBus(0)

CONFIG_FILE='/etc/argoneon.conf'
OLED_ENABLED=False

#
# Enable logging
# Enable OLED if available
#
if os.path.exists("/etc/argon/argoneonoled.py"):
import datetime
from argoeon.argoneonoled import *
try:
from argoneon.argoneonoled import *
OLED_ENABLED=True
except ModuleNotFoundError:
print("OLED is disabled because python module argoneon.argoneonoled could not be imported", file=sys.stderr)
OLED_ENABLED=False


#
# Enable debug logging if requested
Expand Down

0 comments on commit 38f5056

Please sign in to comment.