def runSubMenu3(): print "************************" print " 1: Reboot" print " 2: Shutdown" print " 3: Exit" print "************************" ssd1327.clearCanvas() ssd1327.putCursorandTextwithoutRefresh(0, "1: Reboot") ssd1327.putTextwithoutRefresh(1, "2: Shutdown") ssd1327.putTextwithoutRefresh(2, "3: Exit") ssd1327.displayCanvas() count = 0 itemNum = 0 while True: if button.checkButton0State(Move_Button_Pin): count += 1 itemNum = count % 3 if itemNum == 0: ssd1327.putTextwithRefresh(2, "3: Exit") ssd1327.putCursorandTextwithRefresh(0, "1: Reboot") elif itemNum == 1: ssd1327.putTextwithRefresh(0, "1: Reboot") ssd1327.putCursorandTextwithRefresh(1, "2: Shutdown") else: ssd1327.putTextwithRefresh(1, "2: Shutdown") ssd1327.putCursorandTextwithRefresh(2, "3: Exit") if button.checkButton0State(Enter_Exit_Button_Pin): if itemNum == 0: reboot() elif itemNum == 1: exit() else: break time.sleep(0.1)
def runSubMenu1(): print "************************" print " 1: Start Monitoring" print " 2: Exit" print "************************" ssd1327.clearCanvas() ssd1327.putCursorandTextwithoutRefresh(0, "1: Start Monitoring") ssd1327.putTextwithoutRefresh(1, "2: Exit") ssd1327.displayCanvas() count = 0 itemNum = 0 while True: if button.checkButton0State(Move_Button_Pin): count += 1 itemNum = count % 2 if itemNum == 0: ssd1327.putTextwithRefresh(1, "2: Exit") ssd1327.putCursorandTextwithRefresh(0, "1: Start Monitoring") else: ssd1327.putTextwithRefresh(0, "1: Start Monitoring") ssd1327.putCursorandTextwithRefresh(1, "2: Exit") if button.checkButton0State(Enter_Exit_Button_Pin): if itemNum == 0: sensing_app.displaySensingResult() sensing_app.performSensing(10) # Seconds while sensing_app.getEventDetectFlag() == False: time.sleep(0.1) pass sensing_app.removeEventDetect(Enter_Exit_Button_Pin) sensing_app.clearEventDetectFlag() break else: break time.sleep(0.1)
def runMainMenu(): print "************************" print " 1: Monitoring" print " 2: Wireless setup" print " 3: Shutdown" print "************************" # Main menu ssd1327.clearCanvas() ssd1327.putCursorandTextwithoutRefresh(0, "1: Monitoring") ssd1327.putTextwithoutRefresh(1, "2: Wireless setup") ssd1327.putTextwithoutRefresh(2, "3: Shutdown") ssd1327.displayCanvas() count = 0 itemNum = 0 while True: if button.checkButton0State(Move_Button_Pin): count += 1 itemNum = count % 3 if itemNum == 0: ssd1327.putTextwithRefresh(2, "3: Shutdown") ssd1327.putCursorandTextwithRefresh(0, "1: Monitoring") elif itemNum == 1: ssd1327.putTextwithRefresh(0, "1: Monitoring") ssd1327.putCursorandTextwithRefresh(1, "2: Wireless setup") else: ssd1327.putTextwithRefresh(1, "2: Wireless setup") ssd1327.putCursorandTextwithRefresh(2, "3: Shutdown") if button.checkButton0State(Enter_Exit_Button_Pin): if itemNum == 0: runSubMenu1() break elif itemNum == 1: runSubMenu2() break else: runSubMenu3() break time.sleep(0.1)
def runSubMenu2(): print "************************" print " 1: BT pairing" print " 2: Wi-Fi provisioning" print " 3: Exit" print "************************" ssd1327.clearCanvas() ssd1327.putCursorandTextwithoutRefresh(0, "1: BT pairing") ssd1327.putTextwithoutRefresh(1, "2: Wi-Fi provisioning") ssd1327.putTextwithoutRefresh(2, "3: Exit") ssd1327.displayCanvas() count = 0 itemNum = 0 while True: if button.checkButton0State(Move_Button_Pin): count += 1 itemNum = count % 3 if itemNum == 0: ssd1327.putTextwithRefresh(2, "3: Exit") ssd1327.putCursorandTextwithRefresh(0, "1: BT pairing") elif itemNum == 1: ssd1327.putTextwithRefresh(0, "1: BT pairing") ssd1327.putCursorandTextwithRefresh(1, "2: Wi-Fi provisioning") else: ssd1327.putTextwithRefresh(1, "2: Wi-Fi provisioning") ssd1327.putCursorandTextwithRefresh(2, "3: Exit") if button.checkButton0State(Enter_Exit_Button_Pin): if itemNum == 0: wifi_provisioning_app.bluetoothPairing(60) # Seconds break elif itemNum == 1: wifi_provisioning_app.wifiProvisioning() break else: break time.sleep(0.1)
def clearSensingStopNotice(): ssd1327.putTextwithRefresh(7, " ", "FreeSans.ttf", 11) ssd1327.putTextwithRefresh(8, " ", "FreeSans.ttf", 11)
def displaySensingStopNotice(): ssd1327.putTextwithRefresh(7, "Please, push the exit ", "FreeSans.ttf", 11) ssd1327.putTextwithRefresh(8, "button to stop sensing", "FreeSans.ttf", 11)