def initSonos(): global vol, sonos_list lcd.fill(0x000000) lcd.print('Connecting', 0, 75, 0xffffff) wifiCfg.screenShow() wifiCfg.autoConnect(lcdShow = True) while not (wifiCfg.wlan_sta.isconnected()): wait_ms(500) wait_ms(1000) lcd.fill(0x000000) lcd.print('Init SONOS', 3, 75, 0xffffff) sonos_list = sum([sum([[s], s.other_players],[]) for s in discovery.discover()], [])
axp.setLcdBrightness(60) pass espnow.recv_cb(recv_cb) def buttonA_wasPressed(): global txt, NPD, counter, POWER, stop_flag if stop_flag == True: counter = 600 stop_flag = False pass btnA.wasPressed(buttonA_wasPressed) wifiCfg.screenShow() wifiCfg.autoConnect(lcdShow = True) setScreenColor(0x000000) lcd.font(lcd.FONT_DejaVu40) POWER = 0 stop_flag = True counter = 0 hat_spk1.setVolume(50) while True: if POWER > 4700: if stop_flag: hat_spk1.tone(1000, 200) wait_ms(100) hat_spk1.tone(1000, 200) wait_ms(700) if counter <= 0:
pageUpdate() pos = len(wifiList[page]) - 1 choose_circle.setPosition(y=pos_y_start + 4 + pos * 15) password.setText(card.keyString) time.sleep_ms(10) wifi_update() ssid.setText(wifiList[0][0]) link_ssid = wifiList[0][0] btnB._event |= 0x01 while True: if btnA.wasPressed(): screenShow() link_pwd = card.keyString if doConnect(link_ssid, link_pwd, True): saveWiFi(link_ssid, link_pwd) import uiflow uiflow.start('flow') uiflow.modeSet('internet') import machine machine.reset() else: setScreenColor(0x000000) show_title() label_ssid.show() ssid.show() rect.show() label_pwd.show()