瀏覽代碼

Default to join an existing WiFi network, more common at least for my own testing

Marcos Kirsch 8 年之前
父節點
當前提交
0e4b515514
共有 1 個文件被更改,包括 7 次插入4 次删除
  1. 7 4
      init.lua

+ 7 - 4
init.lua

@@ -2,15 +2,18 @@
 
 local wifiConfig = {}
 
--- wifi.STATION         -- station: join a WiFi network
--- wifi.AP              -- access point: create a WiFi network
--- wifi.wifi.STATIONAP  -- both station and access point
-wifiConfig.mode = wifi.STATIONAP  -- both station and access point
+-- Uncomment the WiFi mode you want.
+wifiConfig.mode = wifi.STATION         -- station: join a WiFi network
+-- wifiConfig.mode = wifi.AP              -- access point: create a WiFi network
+-- wifiConfig.mode = wifi.STATIONAP       -- both station and access point
 
 wifiConfig.accessPointConfig = {}
 wifiConfig.accessPointConfig.ssid = "ESP-"..node.chipid()   -- Name of the SSID you want to create
 wifiConfig.accessPointConfig.pwd = "ESP-"..node.chipid()    -- WiFi password - at least 8 characters
 
+-- Configure fixed IP address
+wifi.sta.setip({ip="10.0.7.111q", netmask="255.255.224.0", gateway="24.55.0.1"})
+
 wifiConfig.stationPointConfig = {}
 wifiConfig.stationPointConfig.ssid = "Internet"        -- Name of the WiFi network you want to join
 wifiConfig.stationPointConfig.pwd =  ""                -- Password for the WiFi network