Bigroom WiFi multi
This commit is contained in:
@@ -5,6 +5,8 @@
|
|||||||
//#include <ArduinoOTA.h>
|
//#include <ArduinoOTA.h>
|
||||||
#include <Ticker.h>
|
#include <Ticker.h>
|
||||||
#include <WiFi.h>
|
#include <WiFi.h>
|
||||||
|
#include <WiFiMulti.h>
|
||||||
|
|
||||||
extern "C" {
|
extern "C" {
|
||||||
#include "freertos/FreeRTOS.h"
|
#include "freertos/FreeRTOS.h"
|
||||||
#include "freertos/timers.h"
|
#include "freertos/timers.h"
|
||||||
@@ -42,6 +44,9 @@ extern "C" {
|
|||||||
|
|
||||||
#define TOPIC "home/bigroom/"
|
#define TOPIC "home/bigroom/"
|
||||||
|
|
||||||
|
WiFiMulti wifiMulti;
|
||||||
|
const uint32_t connectTimeoutMs = 5000;
|
||||||
|
|
||||||
byte periodMotion;
|
byte periodMotion;
|
||||||
int8_t curDelay;
|
int8_t curDelay;
|
||||||
uint16_t spLight, dbLight;
|
uint16_t spLight, dbLight;
|
||||||
|
|||||||
@@ -10,8 +10,10 @@ TimerHandle_t wifiReconnectTimer;
|
|||||||
|
|
||||||
//const char* ssid = "wf-home";
|
//const char* ssid = "wf-home";
|
||||||
//const char* password = "0ndthnrf";
|
//const char* password = "0ndthnrf";
|
||||||
const char* ssid = "wf-home";
|
const char* ssid1 = "wf-home";
|
||||||
const char* password = "0ndthnrf";
|
const char* password1 = "0ndthnrf";
|
||||||
|
const char* ssid2 = "BR";
|
||||||
|
const char* password2 = "499727479o";
|
||||||
const char* mqtt_server = "192.168.1.111";
|
const char* mqtt_server = "192.168.1.111";
|
||||||
|
|
||||||
|
|
||||||
@@ -33,6 +35,8 @@ void setup() {
|
|||||||
Serial.println("Booting"); // "Загрузка"
|
Serial.println("Booting"); // "Загрузка"
|
||||||
WiFi.mode(WIFI_STA);
|
WiFi.mode(WIFI_STA);
|
||||||
WiFi.hostname("BigRoom");
|
WiFi.hostname("BigRoom");
|
||||||
|
wifiMulti.addAP(ssid1, password1);
|
||||||
|
wifiMulti.addAP(ssid2, password2);
|
||||||
// ArduinoOTA.onStart([]() {
|
// ArduinoOTA.onStart([]() {
|
||||||
// // Serial.println("Start"); // "Начало OTA-апдейта"
|
// // Serial.println("Start"); // "Начало OTA-апдейта"
|
||||||
// });
|
// });
|
||||||
@@ -319,7 +323,8 @@ void loop() {
|
|||||||
|
|
||||||
void connectToWifi() {
|
void connectToWifi() {
|
||||||
Serial.println("Connecting to Wi-Fi...");
|
Serial.println("Connecting to Wi-Fi...");
|
||||||
WiFi.begin(ssid, password);
|
wifiMulti.run(connectTimeoutMs);
|
||||||
|
//WiFi.begin(ssid, password);
|
||||||
}
|
}
|
||||||
|
|
||||||
void connectToMqtt() {
|
void connectToMqtt() {
|
||||||
|
|||||||
Reference in New Issue
Block a user