light: the return of i2cdetect to sync messages
This commit is contained in:
parent
cf2f15594d
commit
d9550c777b
|
@ -73,9 +73,7 @@ def setRGB(R, G, B):
|
||||||
bus.write_byte_data(DEVICE_ADDRESS, Register.red, R & 0xFF)
|
bus.write_byte_data(DEVICE_ADDRESS, Register.red, R & 0xFF)
|
||||||
bus.write_byte_data(DEVICE_ADDRESS, Register.green, G & 0xFF)
|
bus.write_byte_data(DEVICE_ADDRESS, Register.green, G & 0xFF)
|
||||||
bus.write_byte_data(DEVICE_ADDRESS, Register.blue, B & 0xFF)
|
bus.write_byte_data(DEVICE_ADDRESS, Register.blue, B & 0xFF)
|
||||||
bus.write_byte_data(DEVICE_ADDRESS, Register.red, R & 0xFF)
|
i2c_update()
|
||||||
bus.write_byte_data(DEVICE_ADDRESS, Register.green, G & 0xFF)
|
|
||||||
bus.write_byte_data(DEVICE_ADDRESS, Register.blue, B & 0xFF)
|
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
logger.exception(f"An Exception has occured in the light library at {e}")
|
logger.exception(f"An Exception has occured in the light library at {e}")
|
||||||
|
|
||||||
|
@ -85,7 +83,7 @@ def setRGBOff():
|
||||||
try:
|
try:
|
||||||
with smbus.SMBus(1) as bus:
|
with smbus.SMBus(1) as bus:
|
||||||
bus.write_byte_data(DEVICE_ADDRESS, Register.rgb_off, 0x00)
|
bus.write_byte_data(DEVICE_ADDRESS, Register.rgb_off, 0x00)
|
||||||
bus.write_byte_data(DEVICE_ADDRESS, Register.rgb_off, 0x00)
|
i2c_update()
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
logger.exception(f"An Exception has occured in the light library at {e}")
|
logger.exception(f"An Exception has occured in the light library at {e}")
|
||||||
|
|
||||||
|
@ -130,72 +128,60 @@ def setRGBColor(bus, color):
|
||||||
|
|
||||||
def ready():
|
def ready():
|
||||||
with smbus.SMBus(1) as bus:
|
with smbus.SMBus(1) as bus:
|
||||||
setRGBColor(bus, EffectColor.Green)
|
setRGBColor(bus, EffectColor.Blue)
|
||||||
setRGBColor(bus, EffectColor.Green)
|
|
||||||
setRGBSpeed(bus, 1)
|
|
||||||
setRGBSpeed(bus, 1)
|
setRGBSpeed(bus, 1)
|
||||||
setRGBEffect(bus, Effect.Breathing)
|
setRGBEffect(bus, Effect.Breathing)
|
||||||
setRGBEffect(bus, Effect.Breathing)
|
i2c_update()
|
||||||
|
|
||||||
|
|
||||||
def error():
|
def error():
|
||||||
with smbus.SMBus(1) as bus:
|
with smbus.SMBus(1) as bus:
|
||||||
setRGBColor(bus, EffectColor.Red)
|
setRGBColor(bus, EffectColor.Red)
|
||||||
setRGBColor(bus, EffectColor.Red)
|
|
||||||
setRGBSpeed(bus, 3)
|
|
||||||
setRGBSpeed(bus, 3)
|
setRGBSpeed(bus, 3)
|
||||||
setRGBEffect(bus, Effect.Water)
|
setRGBEffect(bus, Effect.Water)
|
||||||
setRGBEffect(bus, Effect.Water)
|
i2c_update()
|
||||||
|
|
||||||
|
|
||||||
def interrupted():
|
def interrupted():
|
||||||
with smbus.SMBus(1) as bus:
|
with smbus.SMBus(1) as bus:
|
||||||
setRGBColor(bus, EffectColor.Yellow)
|
setRGBOff()
|
||||||
|
time.sleep(1)
|
||||||
setRGBColor(bus, EffectColor.Yellow)
|
setRGBColor(bus, EffectColor.Yellow)
|
||||||
setRGBSpeed(bus, 3)
|
setRGBSpeed(bus, 3)
|
||||||
setRGBSpeed(bus, 3)
|
|
||||||
setRGBEffect(bus, Effect.Water)
|
|
||||||
setRGBEffect(bus, Effect.Water)
|
setRGBEffect(bus, Effect.Water)
|
||||||
|
i2c_update()
|
||||||
|
|
||||||
|
|
||||||
def pumping():
|
def pumping():
|
||||||
with smbus.SMBus(1) as bus:
|
with smbus.SMBus(1) as bus:
|
||||||
setRGBColor(bus, EffectColor.Blue)
|
setRGBColor(bus, EffectColor.Blue)
|
||||||
setRGBColor(bus, EffectColor.Blue)
|
|
||||||
setRGBSpeed(bus, 3)
|
|
||||||
setRGBSpeed(bus, 3)
|
setRGBSpeed(bus, 3)
|
||||||
setRGBEffect(bus, Effect.Water)
|
setRGBEffect(bus, Effect.Water)
|
||||||
setRGBEffect(bus, Effect.Water)
|
i2c_update()
|
||||||
|
|
||||||
|
|
||||||
def focusing():
|
def focusing():
|
||||||
with smbus.SMBus(1) as bus:
|
with smbus.SMBus(1) as bus:
|
||||||
setRGBColor(bus, EffectColor.Purple)
|
setRGBColor(bus, EffectColor.Purple)
|
||||||
setRGBColor(bus, EffectColor.Purple)
|
|
||||||
setRGBSpeed(bus, 3)
|
|
||||||
setRGBSpeed(bus, 3)
|
setRGBSpeed(bus, 3)
|
||||||
setRGBEffect(bus, Effect.Water)
|
setRGBEffect(bus, Effect.Water)
|
||||||
setRGBEffect(bus, Effect.Water)
|
i2c_update()
|
||||||
|
|
||||||
|
|
||||||
def imaging():
|
def imaging():
|
||||||
with smbus.SMBus(1) as bus:
|
with smbus.SMBus(1) as bus:
|
||||||
setRGBColor(bus, EffectColor.White)
|
setRGBColor(bus, EffectColor.White)
|
||||||
setRGBColor(bus, EffectColor.White)
|
|
||||||
setRGBSpeed(bus, 1)
|
|
||||||
setRGBSpeed(bus, 1)
|
setRGBSpeed(bus, 1)
|
||||||
setRGBEffect(bus, Effect.Breathing)
|
setRGBEffect(bus, Effect.Breathing)
|
||||||
setRGBEffect(bus, Effect.Breathing)
|
i2c_update()
|
||||||
|
|
||||||
|
|
||||||
def segmenting():
|
def segmenting():
|
||||||
with smbus.SMBus(1) as bus:
|
with smbus.SMBus(1) as bus:
|
||||||
setRGBColor(bus, EffectColor.Purple)
|
setRGBColor(bus, EffectColor.Purple)
|
||||||
setRGBColor(bus, EffectColor.Purple)
|
|
||||||
setRGBSpeed(bus, 1)
|
|
||||||
setRGBSpeed(bus, 1)
|
setRGBSpeed(bus, 1)
|
||||||
setRGBEffect(bus, Effect.Breathing)
|
setRGBEffect(bus, Effect.Breathing)
|
||||||
setRGBEffect(bus, Effect.Breathing)
|
i2c_update()
|
||||||
|
|
||||||
|
|
||||||
# This is called if this script is launched directly
|
# This is called if this script is launched directly
|
||||||
|
|
Loading…
Reference in a new issue