mirror of
https://github.com/HASwitchPlate/openHASP.git
synced 2025-07-26 20:56:37 +00:00
Move network services into system
This commit is contained in:
parent
0b2b3fe7a8
commit
215c2645b3
@ -13,8 +13,8 @@
|
|||||||
#include "hasp_debug.h"
|
#include "hasp_debug.h"
|
||||||
#include "hasp_network.h"
|
#include "hasp_network.h"
|
||||||
|
|
||||||
#include "../../hasp/hasp.h"
|
#include "hasp/hasp.h"
|
||||||
#include "../../svc/hasp_mdns.h"
|
#include "sys/svc/hasp_mdns.h"
|
||||||
|
|
||||||
#if HASP_USE_ETHERNET > 0 || HASP_USE_WIFI > 0
|
#if HASP_USE_ETHERNET > 0 || HASP_USE_WIFI > 0
|
||||||
void networkStart(void)
|
void networkStart(void)
|
||||||
@ -59,6 +59,30 @@ void networkLoop(void)
|
|||||||
#if HASP_USE_WIFI > 0
|
#if HASP_USE_WIFI > 0
|
||||||
// wifiLoop();
|
// wifiLoop();
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#if HASP_USE_TASMOTA_CLIENT > 0
|
||||||
|
tasmotaclientLoop();
|
||||||
|
#endif // HASP_USE_TASMOTA_CLIENT
|
||||||
|
|
||||||
|
#if HASP_USE_HTTP > 0
|
||||||
|
httpLoop();
|
||||||
|
#endif // HTTP
|
||||||
|
|
||||||
|
#if HASP_USE_GPIO > 0
|
||||||
|
gpioLoop();
|
||||||
|
#endif // GPIO
|
||||||
|
|
||||||
|
#if HASP_USE_OTA > 0
|
||||||
|
otaLoop();
|
||||||
|
#endif // OTA
|
||||||
|
|
||||||
|
#if HASP_USE_MDNS > 0
|
||||||
|
mdnsLoop();
|
||||||
|
#endif // MDNS
|
||||||
|
|
||||||
|
#if HASP_USE_TELNET > 0
|
||||||
|
telnetLoop(); // Console
|
||||||
|
#endif // TELNET
|
||||||
}
|
}
|
||||||
|
|
||||||
bool networkEvery5Seconds(void)
|
bool networkEvery5Seconds(void)
|
||||||
@ -76,13 +100,20 @@ bool networkEvery5Seconds(void)
|
|||||||
|
|
||||||
bool networkEverySecond(void)
|
bool networkEverySecond(void)
|
||||||
{
|
{
|
||||||
|
bool connected = false;
|
||||||
|
|
||||||
#if HASP_USE_ETHERNET > 0
|
#if HASP_USE_ETHERNET > 0
|
||||||
// return ethernetEverySecond();
|
connected |= ethernetEverySecond();
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if HASP_USE_WIFI > 0
|
#if HASP_USE_WIFI > 0
|
||||||
// return wifiEverySecond();
|
// connected |= wifiEverySecond();
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#if HASP_USE_OTA > 0
|
||||||
|
otaEverySecond(); // progressbar
|
||||||
|
#endif
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -8,8 +8,8 @@
|
|||||||
#include "hasp_debug.h"
|
#include "hasp_debug.h"
|
||||||
#include "hasp_ota.h"
|
#include "hasp_ota.h"
|
||||||
|
|
||||||
#include "../hasp/hasp_dispatch.h"
|
#include "../../hasp/hasp_dispatch.h"
|
||||||
#include "../hasp/hasp.h"
|
#include "../../hasp/hasp.h"
|
||||||
|
|
||||||
#if defined(ARDUINO_ARCH_ESP8266)
|
#if defined(ARDUINO_ARCH_ESP8266)
|
||||||
#include <ESP8266HTTPClient.h>
|
#include <ESP8266HTTPClient.h>
|
@ -2,7 +2,7 @@
|
|||||||
For full license information read the LICENSE file in the project folder */
|
For full license information read the LICENSE file in the project folder */
|
||||||
|
|
||||||
#include "hasp_conf.h"
|
#include "hasp_conf.h"
|
||||||
#if HASP_USE_TASMOTA_SLAVE > 0
|
#if HASP_USE_TASMOTA_CLIENT > 0
|
||||||
|
|
||||||
#include "hasp_slave.h"
|
#include "hasp_slave.h"
|
||||||
#include "ArduinoJson.h"
|
#include "ArduinoJson.h"
|
||||||
@ -145,7 +145,7 @@ void TASMO_EVERY_SECOND(void)
|
|||||||
|
|
||||||
void slaveSetup()
|
void slaveSetup()
|
||||||
{
|
{
|
||||||
Serial2.begin(HASP_SLAVE_SPEED);
|
Serial2.begin(HASP_TASMOTACLIENT_SPEED);
|
||||||
// slave.attach_FUNC_EVERY_SECOND(TASMO_EVERY_SECOND);
|
// slave.attach_FUNC_EVERY_SECOND(TASMO_EVERY_SECOND);
|
||||||
slave.attach_FUNC_JSON(TASMO_TELE_JSON);
|
slave.attach_FUNC_JSON(TASMO_TELE_JSON);
|
||||||
slave.attach_FUNC_COMMAND_SEND(TASMO_DATA_RECEIVE);
|
slave.attach_FUNC_COMMAND_SEND(TASMO_DATA_RECEIVE);
|
@ -1,12 +1,12 @@
|
|||||||
/* MIT License - Copyright (c) 2020 Francis Van Roie
|
/* MIT License - Copyright (c) 2020 Francis Van Roie
|
||||||
For full license information read the LICENSE file in the project folder */
|
For full license information read the LICENSE file in the project folder */
|
||||||
|
|
||||||
#ifndef HASP_SLAVE_H
|
#ifndef HASP_TASMOTACLIENT_H
|
||||||
#define HASP_SLAVE_H
|
#define HASP_TASMOTACLIENT_H
|
||||||
|
|
||||||
#include "ArduinoJson.h"
|
#include "ArduinoJson.h"
|
||||||
|
|
||||||
#define HASP_SLAVE_SPEED 57600
|
#define HASP_TASMOTACLIENT_SPEED 57600
|
||||||
|
|
||||||
void TASMO_EVERY_SECOND(void);
|
void TASMO_EVERY_SECOND(void);
|
||||||
void TASMO_DATA_RECEIVE(char * data);
|
void TASMO_DATA_RECEIVE(char * data);
|
||||||
@ -18,5 +18,4 @@ void slave_send_statusupdate();
|
|||||||
void slaveSetup();
|
void slaveSetup();
|
||||||
void slaveLoop(void);
|
void slaveLoop(void);
|
||||||
|
|
||||||
|
|
||||||
#endif
|
#endif
|
Loading…
x
Reference in New Issue
Block a user