Priorisierung
Verfasst: Mittwoch 29. August 2018, 16:44
Hallo,
hier noch eine Frage zur Priorisierung. So wie der Skript jetzt ist, kann VideoDetect_2 oder VideoDetect_3 nicht kommen solange VideoDetect_1 aktiv ,
genauso wie VideoDetect_3 nicht über VideoDetect_2 kommt.
Mache ich alles als if geht es zwar, flackert sich aber hin und her...
Gibt es eine Möglichkeit , das der, der zuletzt kommt über geht ???
#Loop
while True:
VideoDetect_1 = GPIO.input(GPIO_VideoDetect_1)
VideoDetect_2 = GPIO.input(GPIO_VideoDetect_2)
VideoDetect_3 = GPIO.input(GPIO_VideoDetect_3)
if VideoDetect_1 == True:
print ("VideoDetect_1")
i2cbus.write_byte_data(DEVICE_ADDR, 0x01, 0x81) #Input 1 to Output 1
i2cbus.write_byte_data(DEVICE_ADDR, 0x03, 0x81) #Input 1 to Output 2
i2cbus.write_byte_data(DEVICE_ADDR, 0x06, 0x87) #Input 4 to Output 3
i2cbus.write_byte_data(DEVICE_ADDR, 0x09, 0x87) #Input 4 to Output 4
i2cbus.write_byte_data(DEVICE_ADDR, 0x07, 0x81) #Input 1 to OSD In
i2cbus.write_byte_data(DEVICE_ADDR, 0x01, 0x86) #Input OSD to Output 1
i2cbus.write_byte_data(DEVICE_ADDR, 0x03, 0x86) #Input OSD to Output 2
max7456.printStr(14,1, "CQ 10.420GHz ", enable = True)
flashleds (1)
elif VideoDetect_2 == True:
print ("VideoDetect_2")
i2cbus.write_byte_data(DEVICE_ADDR, 0x01, 0x83) #Input 2 to Output 1
i2cbus.write_byte_data(DEVICE_ADDR, 0x03, 0x83) #Input 2 to Output 2
i2cbus.write_byte_data(DEVICE_ADDR, 0x06, 0x89) #Input 5 to Output 3
i2cbus.write_byte_data(DEVICE_ADDR, 0x09, 0x89) #Input 5 to Output 4
i2cbus.write_byte_data(DEVICE_ADDR, 0x07, 0x83) #Input 2 to OSD In
i2cbus.write_byte_data(DEVICE_ADDR, 0x01, 0x86) #Input OSD to Output 1
i2cbus.write_byte_data(DEVICE_ADDR, 0x03, 0x86) #Input OSD to Output 2
max7456.printStr(14,1, "CQ 1.251GHz ", enable = True)
flashleds (2)
elif VideoDetect_3 == True:
print ("VideoDetect_3")
i2cbus.write_byte_data(DEVICE_ADDR, 0x01, 0x85) #Input 3 to Output 1
i2cbus.write_byte_data(DEVICE_ADDR, 0x03, 0x85) #Input 3 to Output 2
i2cbus.write_byte_data(DEVICE_ADDR, 0x06, 0x8b) #Input 6 to Output 3
i2cbus.write_byte_data(DEVICE_ADDR, 0x09, 0x8b) #Input 6 to Output 4
i2cbus.write_byte_data(DEVICE_ADDR, 0x07, 0x85) #Input 3 to OSD In
i2cbus.write_byte_data(DEVICE_ADDR, 0x01, 0x86) #Input OSD to Output 1
i2cbus.write_byte_data(DEVICE_ADDR, 0x03, 0x86) #Input OSD to Output 2
max7456.printStr(14,1, "Test ", enable = True)
flashleds (3)
else:
print ("Pi")
i2cbus.write_byte_data(DEVICE_ADDR, 0x01, 0x8c) #Input Pi-V to Output 1
i2cbus.write_byte_data(DEVICE_ADDR, 0x03, 0x8c) #Input Pi-V to Output 2
i2cbus.write_byte_data(DEVICE_ADDR, 0x06, 0x89) #Input 5 to Output 3
i2cbus.write_byte_data(DEVICE_ADDR, 0x09, 0x8b) #Input 6 to Output 4
i2cbus.write_byte_data(DEVICE_ADDR, 0x07, 0x8c) #Input Pi-V to OSD In
i2cbus.write_byte_data(DEVICE_ADDR, 0x01, 0x86) #Input OSD to Output 1
i2cbus.write_byte_data(DEVICE_ADDR, 0x03, 0x86) #Input OSD to Output 2
max7456.printStr(14,1, datetime.datetime.now().strftime(dateString), enable = True)
max7456.printStr(14,9, ", Pi Temp C", enable = True)
file = open("/home/pi/1.txt","r")
max7456.printStr(14,19, file.readline(4), enable = True)
file.close()
flashleds (0)
hier noch eine Frage zur Priorisierung. So wie der Skript jetzt ist, kann VideoDetect_2 oder VideoDetect_3 nicht kommen solange VideoDetect_1 aktiv ,
genauso wie VideoDetect_3 nicht über VideoDetect_2 kommt.
Mache ich alles als if geht es zwar, flackert sich aber hin und her...
Gibt es eine Möglichkeit , das der, der zuletzt kommt über geht ???
#Loop
while True:
VideoDetect_1 = GPIO.input(GPIO_VideoDetect_1)
VideoDetect_2 = GPIO.input(GPIO_VideoDetect_2)
VideoDetect_3 = GPIO.input(GPIO_VideoDetect_3)
if VideoDetect_1 == True:
print ("VideoDetect_1")
i2cbus.write_byte_data(DEVICE_ADDR, 0x01, 0x81) #Input 1 to Output 1
i2cbus.write_byte_data(DEVICE_ADDR, 0x03, 0x81) #Input 1 to Output 2
i2cbus.write_byte_data(DEVICE_ADDR, 0x06, 0x87) #Input 4 to Output 3
i2cbus.write_byte_data(DEVICE_ADDR, 0x09, 0x87) #Input 4 to Output 4
i2cbus.write_byte_data(DEVICE_ADDR, 0x07, 0x81) #Input 1 to OSD In
i2cbus.write_byte_data(DEVICE_ADDR, 0x01, 0x86) #Input OSD to Output 1
i2cbus.write_byte_data(DEVICE_ADDR, 0x03, 0x86) #Input OSD to Output 2
max7456.printStr(14,1, "CQ 10.420GHz ", enable = True)
flashleds (1)
elif VideoDetect_2 == True:
print ("VideoDetect_2")
i2cbus.write_byte_data(DEVICE_ADDR, 0x01, 0x83) #Input 2 to Output 1
i2cbus.write_byte_data(DEVICE_ADDR, 0x03, 0x83) #Input 2 to Output 2
i2cbus.write_byte_data(DEVICE_ADDR, 0x06, 0x89) #Input 5 to Output 3
i2cbus.write_byte_data(DEVICE_ADDR, 0x09, 0x89) #Input 5 to Output 4
i2cbus.write_byte_data(DEVICE_ADDR, 0x07, 0x83) #Input 2 to OSD In
i2cbus.write_byte_data(DEVICE_ADDR, 0x01, 0x86) #Input OSD to Output 1
i2cbus.write_byte_data(DEVICE_ADDR, 0x03, 0x86) #Input OSD to Output 2
max7456.printStr(14,1, "CQ 1.251GHz ", enable = True)
flashleds (2)
elif VideoDetect_3 == True:
print ("VideoDetect_3")
i2cbus.write_byte_data(DEVICE_ADDR, 0x01, 0x85) #Input 3 to Output 1
i2cbus.write_byte_data(DEVICE_ADDR, 0x03, 0x85) #Input 3 to Output 2
i2cbus.write_byte_data(DEVICE_ADDR, 0x06, 0x8b) #Input 6 to Output 3
i2cbus.write_byte_data(DEVICE_ADDR, 0x09, 0x8b) #Input 6 to Output 4
i2cbus.write_byte_data(DEVICE_ADDR, 0x07, 0x85) #Input 3 to OSD In
i2cbus.write_byte_data(DEVICE_ADDR, 0x01, 0x86) #Input OSD to Output 1
i2cbus.write_byte_data(DEVICE_ADDR, 0x03, 0x86) #Input OSD to Output 2
max7456.printStr(14,1, "Test ", enable = True)
flashleds (3)
else:
print ("Pi")
i2cbus.write_byte_data(DEVICE_ADDR, 0x01, 0x8c) #Input Pi-V to Output 1
i2cbus.write_byte_data(DEVICE_ADDR, 0x03, 0x8c) #Input Pi-V to Output 2
i2cbus.write_byte_data(DEVICE_ADDR, 0x06, 0x89) #Input 5 to Output 3
i2cbus.write_byte_data(DEVICE_ADDR, 0x09, 0x8b) #Input 6 to Output 4
i2cbus.write_byte_data(DEVICE_ADDR, 0x07, 0x8c) #Input Pi-V to OSD In
i2cbus.write_byte_data(DEVICE_ADDR, 0x01, 0x86) #Input OSD to Output 1
i2cbus.write_byte_data(DEVICE_ADDR, 0x03, 0x86) #Input OSD to Output 2
max7456.printStr(14,1, datetime.datetime.now().strftime(dateString), enable = True)
max7456.printStr(14,9, ", Pi Temp C", enable = True)
file = open("/home/pi/1.txt","r")
max7456.printStr(14,19, file.readline(4), enable = True)
file.close()
flashleds (0)