Skip to content

Commit

Permalink
Colormatch should just disable if smbus is missing
Browse files Browse the repository at this point in the history
Still prints an error but this way, it's easier to run
if you don't have the special hardware.
  • Loading branch information
mrworf committed Jun 26, 2021
1 parent a11139f commit 9b8c855
Showing 1 changed file with 9 additions and 3 deletions.
12 changes: 9 additions & 3 deletions modules/colormatch.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,12 +13,17 @@
# You should have received a copy of the GNU General Public License
# along with photoframe. If not, see <http://www.gnu.org/licenses/>.
#
import logging
from threading import Thread
import smbus
try:
import smbus
COLORMATCH_DISABLE = False
except ImportError:
logging.warning('smbus module not available, colormatch will not work')
COLORMATCH_DISABLE = True
import time
import os
import subprocess
import logging

class colormatch(Thread):
def __init__(self, script, min = None, max = None):
Expand All @@ -38,7 +43,8 @@ def __init__(self, script, min = None, max = None):
else:
self.hasScript = False

self.start()
if not COLORMATCH_DISABLE:
self.start()

def setLimits(self, min, max):
self.min = min
Expand Down

0 comments on commit 9b8c855

Please sign in to comment.