Explorar o código

tried to throw an exception if the display is not available

Helmut Pozimski %!s(int64=11) %!d(string=hai) anos
pai
achega
1fc29243d9
Modificáronse 2 ficheiros con 3 adicións e 1 borrados
  1. 1 1
      adafruit_7segment/Adafruit_I2C.py
  2. 2 0
      stdd

+ 1 - 1
adafruit_7segment/Adafruit_I2C.py

@@ -55,7 +55,7 @@ class Adafruit_I2C:
         return val
 
     def errMsg(self):
-        print "Error accessing 0x%02X: Check your I2C address" % self.address
+        raise Exception("cannot connect to device, check hardware address!")
         return -1
 
     def write8(self, reg, value):

+ 2 - 0
stdd

@@ -134,6 +134,8 @@ if options.daemon is True:
 		passwd.close()
 		group.close()
 		daemon.DropPriv(int(uid), int(gid))
+		logger.debug("dropped privileges, now running as " + options.user +
+			" and group" + options.group)
 
 """Initialize the display object"""
 display = SevenSegment(config.hw_address)