mirror of
https://github.com/IoTManagerProject/IoTManager.git
synced 2026-03-30 03:49:13 +03:00
используем везде isNetworkActive()
This commit is contained in:
@@ -5,7 +5,7 @@ void mqttInit() {
|
|||||||
ts.add(
|
ts.add(
|
||||||
WIFI_MQTT_CONNECTION_CHECK, MQTT_RECONNECT_INTERVAL,
|
WIFI_MQTT_CONNECTION_CHECK, MQTT_RECONNECT_INTERVAL,
|
||||||
[&](void*) {
|
[&](void*) {
|
||||||
if (WiFi.status() == WL_CONNECTED) {
|
if (isNetworkActive()) {
|
||||||
SerialPrint("i", F("WIFI"), "http://" + jsonReadStr(settingsFlashJson, F("ip")));
|
SerialPrint("i", F("WIFI"), "http://" + jsonReadStr(settingsFlashJson, F("ip")));
|
||||||
wifiUptimeCalc();
|
wifiUptimeCalc();
|
||||||
if (mqtt.connected()) {
|
if (mqtt.connected()) {
|
||||||
|
|||||||
@@ -10,7 +10,7 @@ public:
|
|||||||
|
|
||||||
void sendHttpPOST(String url, String msg)
|
void sendHttpPOST(String url, String msg)
|
||||||
{
|
{
|
||||||
if (WiFi.status() == WL_CONNECTED)
|
if (isNetworkActive())
|
||||||
{
|
{
|
||||||
|
|
||||||
WiFiClient client;
|
WiFiClient client;
|
||||||
|
|||||||
@@ -13,7 +13,7 @@ class TelegramLT : public IoTItem {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void sendTelegramMsg(bool often, String msg) {
|
void sendTelegramMsg(bool often, String msg) {
|
||||||
if (WiFi.status() == WL_CONNECTED && (often || !often && _prevMsg != msg)) {
|
if (isNetworkActive() && (often || !often && _prevMsg != msg)) {
|
||||||
WiFiClient client;
|
WiFiClient client;
|
||||||
HTTPClient http;
|
HTTPClient http;
|
||||||
http.begin(client, "http://live-control.com/iotm/telegram.php");
|
http.begin(client, "http://live-control.com/iotm/telegram.php");
|
||||||
|
|||||||
@@ -31,7 +31,7 @@ public:
|
|||||||
|
|
||||||
void doByInterval()
|
void doByInterval()
|
||||||
{
|
{
|
||||||
if (WiFi.status() == WL_CONNECTED)
|
if (isNetworkActive())
|
||||||
{
|
{
|
||||||
String value = getItemValue(logid);
|
String value = getItemValue(logid);
|
||||||
if (value != "")
|
if (value != "")
|
||||||
@@ -55,7 +55,7 @@ public:
|
|||||||
|
|
||||||
IoTValue execute(String command, std::vector<IoTValue> ¶m)
|
IoTValue execute(String command, std::vector<IoTValue> ¶m)
|
||||||
{
|
{
|
||||||
if (WiFi.status() == WL_CONNECTED)
|
if (isNetworkActive())
|
||||||
{
|
{
|
||||||
if (command == F("logGoogle"))
|
if (command == F("logGoogle"))
|
||||||
{ // Логирование определенного элемента по его идентификатору в GoogleSheet
|
{ // Логирование определенного элемента по его идентификатору в GoogleSheet
|
||||||
|
|||||||
@@ -26,7 +26,7 @@ public:
|
|||||||
{
|
{
|
||||||
String ret;
|
String ret;
|
||||||
|
|
||||||
if (WiFi.status() == WL_CONNECTED)
|
if (isNetworkActive())
|
||||||
{
|
{
|
||||||
// char c;
|
// char c;
|
||||||
String payload;
|
String payload;
|
||||||
|
|||||||
@@ -20,7 +20,7 @@ void updateDeviceStatus() {
|
|||||||
// jsonRead(settingsFlashJson, F("serverip"), serverIP);
|
// jsonRead(settingsFlashJson, F("serverip"), serverIP);
|
||||||
String url = serverIP + F("/projects/esprebootstat.php");
|
String url = serverIP + F("/projects/esprebootstat.php");
|
||||||
// SerialPrint("i", "Stat", "url " + url);
|
// SerialPrint("i", "Stat", "url " + url);
|
||||||
if ((WiFi.status() == WL_CONNECTED)) {
|
if ((isNetworkActive())) {
|
||||||
WiFiClient client;
|
WiFiClient client;
|
||||||
HTTPClient http;
|
HTTPClient http;
|
||||||
http.begin(client, url);
|
http.begin(client, url);
|
||||||
|
|||||||
@@ -121,7 +121,7 @@ boolean RouterFind(String ssid) {
|
|||||||
|
|
||||||
uint8_t RSSIquality() {
|
uint8_t RSSIquality() {
|
||||||
uint8_t res = 0;
|
uint8_t res = 0;
|
||||||
if (WiFi.status() == WL_CONNECTED) {
|
if (isNetworkActive()) {
|
||||||
int rssi = WiFi.RSSI();
|
int rssi = WiFi.RSSI();
|
||||||
if (rssi >= -50) {
|
if (rssi >= -50) {
|
||||||
res = 6; //"Excellent";
|
res = 6; //"Excellent";
|
||||||
|
|||||||
Reference in New Issue
Block a user