Can use bssid and channel to save power
It's much faster to connect to wifi, so less power hungry
This commit is contained in:
parent
b19406af98
commit
27145540e1
@ -37,6 +37,8 @@ Adafruit_MQTT_Publish *mqtt_voltage;
|
||||
|
||||
const char *ssid = "XXXXX";
|
||||
const char *password = "XXXXX";
|
||||
uint8_t bssid[6] = {0x14, 0x0C, 0x76, 0xB1, 0x37, 0x32};
|
||||
int32_t channel = 11; //0 for Auto
|
||||
|
||||
ADC_MODE(ADC_VCC);
|
||||
void setup()
|
||||
@ -135,11 +137,15 @@ int doMeasure()
|
||||
IPAddress gateway(192, 168, 0, 254);
|
||||
IPAddress subnet(255, 255, 255, 0);
|
||||
WiFi.config(ip, gateway, subnet);
|
||||
WiFi.begin(ssid, password);
|
||||
WiFi.begin(ssid, password, channel, bssid);
|
||||
|
||||
int retry = 10;
|
||||
while (WiFi.status() != WL_CONNECTED) {
|
||||
delay(100);
|
||||
Serial.print(".");
|
||||
if (retry < 0)
|
||||
continue;
|
||||
retry --;
|
||||
}
|
||||
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user