Exemplo n.º 1
0
def wifi_setup_start(obj):  # BLOCK~
    lcd.image(0, 0, 'img/4-1.jpg', type=lcd.JPG)
    ssid_name = "M5GO-" + node_id[-4:]
    lcd.font(lcd.FONT_Comic, transparent=True)
    lcd.print(ssid_name, 135, 180, lcd.RED)
    wlan_ap = network.WLAN(network.AP_IF)
    # wlan_ap.eventCB(wlan_ap_cb)
    import wificonfig
    wificonfig.webserver_start()
Exemplo n.º 2
0
def auto_connect():
    try:
        if not wlan_sta.isconnected():
            with open("modeconfig.json") as f:
                jdata = ujson.loads(f.read())
                ssid = jdata['wifi']['ssid']
                passwd = jdata['wifi']['password']
                if ssid == '' and passwd == '':
                    raise OSError
            if do_connect(ssid, passwd):
                return (True)
            print('connect fail!')

            if not wlan_sta.isconnected():
                import wificonfig
                wificonfig.webserver_start()
        else:
            return (True)
    except OSError:
        # Web server for connection manager
        import wificonfig
        wificonfig.webserver_start()
Exemplo n.º 3
0
if ShowWifi:
    # Enable  (if supported)
    try:
        network.WLANcallback(wifi_cb)
    except:
        pass

if ShowDebug:
    #enable system wide verbose information messages
    import machine
    machine.loglevel('*', machine.LOG_VERBOSE)
    machine.loglevel('[modnetwork]', machine.LOG_DEBUG)
    machine.loglevel('wifi', machine.LOG_DEBUG)
    machine.loglevel('tcpip_adapter', machine.LOG_DEBUG)
    machine.loglevel('event', machine.LOG_DEBUG)

#----------------------------------------------

# Auto Connect to the network, starts autoconfig if needed
import wifisetup

wifisetup.auto_connect()

#Note this section is not normally run,
# but is provided as an example of how to force the autoconfiguration
if False:
    #force new network connection
    import wificonfig
    wificonfig.webserver_start()