Splitted Center into its own value... ugly solution
This commit is contained in:
parent
cf9a3d7c93
commit
528ca5da5b
@ -21,14 +21,14 @@ def sectionInitializer():
|
|||||||
|
|
||||||
def sectionSerializer(section):
|
def sectionSerializer(section):
|
||||||
result = sectionInitializer()
|
result = sectionInitializer()
|
||||||
sectionResult = LampArray["Center"] + LampArray[section]
|
sectionResult = LampArray[section]
|
||||||
for pos in sectionResult:
|
for pos in sectionResult:
|
||||||
result[pos] = 1
|
result[pos] = 1
|
||||||
return result
|
return result
|
||||||
|
|
||||||
def posColorByte(pos, section, color):
|
def posColorByte(pos, section, color):
|
||||||
intColor = int(color, 16)
|
intColor = int(color, 16)
|
||||||
result = intColor * section[pos]
|
result = int(intColor * section[pos])
|
||||||
print(result)
|
print(result)
|
||||||
return result.to_bytes(3)
|
return result.to_bytes(3)
|
||||||
|
|
||||||
@ -36,10 +36,13 @@ async def setOnUserInput(client, chars):
|
|||||||
while True:
|
while True:
|
||||||
configZone = input("Input Zone [Up, Down, Left, Right, Inner, Outer]: ")
|
configZone = input("Input Zone [Up, Down, Left, Right, Inner, Outer]: ")
|
||||||
configColor = input("Input Color [000000]: ")
|
configColor = input("Input Color [000000]: ")
|
||||||
await setLampToColor(client, chars, configZone, configColor)
|
configColorCenter = input("Input Color for Center Lamp [000000]: ")
|
||||||
|
await setLampToColor(client, chars, configZone, configColor, configColorCenter)
|
||||||
|
|
||||||
async def setLampToColor(bleClient, bleChars, section, color):
|
async def setLampToColor(bleClient, bleChars, section, color, colorCenter):
|
||||||
sectionSerial = sectionSerializer(section)
|
sectionSerial = sectionSerializer(section)
|
||||||
|
colorCenterFactor = int(colorCenter, 16)/int(color,16)
|
||||||
|
sectionSerial[0] = colorCenterFactor
|
||||||
for char in bleChars:
|
for char in bleChars:
|
||||||
lampPos = bleChars.index(char)
|
lampPos = bleChars.index(char)
|
||||||
print(f"Setting Lamp number {lampPos}")
|
print(f"Setting Lamp number {lampPos}")
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user