Move network services into system

This commit is contained in:
fvanroie 2021-02-17 14:41:18 +01:00
parent 0b2b3fe7a8
commit 215c2645b3
11 changed files with 96 additions and 66 deletions

View File

@ -13,8 +13,8 @@
#include "hasp_debug.h"
#include "hasp_network.h"
#include "../../hasp/hasp.h"
#include "../../svc/hasp_mdns.h"
#include "hasp/hasp.h"
#include "sys/svc/hasp_mdns.h"
#if HASP_USE_ETHERNET > 0 || HASP_USE_WIFI > 0
void networkStart(void)
@ -59,6 +59,30 @@ void networkLoop(void)
#if HASP_USE_WIFI > 0
// wifiLoop();
#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)
@ -76,13 +100,20 @@ bool networkEvery5Seconds(void)
bool networkEverySecond(void)
{
bool connected = false;
#if HASP_USE_ETHERNET > 0
// return ethernetEverySecond();
connected |= ethernetEverySecond();
#endif
#if HASP_USE_WIFI > 0
// return wifiEverySecond();
// connected |= wifiEverySecond();
#endif
#if HASP_USE_OTA > 0
otaEverySecond(); // progressbar
#endif
return true;
}

View File

@ -8,8 +8,8 @@
#include "hasp_debug.h"
#include "hasp_ota.h"
#include "../hasp/hasp_dispatch.h"
#include "../hasp/hasp.h"
#include "../../hasp/hasp_dispatch.h"
#include "../../hasp/hasp.h"
#if defined(ARDUINO_ARCH_ESP8266)
#include <ESP8266HTTPClient.h>

View File

@ -2,7 +2,7 @@
For full license information read the LICENSE file in the project folder */
#include "hasp_conf.h"
#if HASP_USE_TASMOTA_SLAVE > 0
#if HASP_USE_TASMOTA_CLIENT > 0
#include "hasp_slave.h"
#include "ArduinoJson.h"
@ -145,7 +145,7 @@ void TASMO_EVERY_SECOND(void)
void slaveSetup()
{
Serial2.begin(HASP_SLAVE_SPEED);
Serial2.begin(HASP_TASMOTACLIENT_SPEED);
// slave.attach_FUNC_EVERY_SECOND(TASMO_EVERY_SECOND);
slave.attach_FUNC_JSON(TASMO_TELE_JSON);
slave.attach_FUNC_COMMAND_SEND(TASMO_DATA_RECEIVE);

View File

@ -1,12 +1,12 @@
/* MIT License - Copyright (c) 2020 Francis Van Roie
For full license information read the LICENSE file in the project folder */
#ifndef HASP_SLAVE_H
#define HASP_SLAVE_H
#ifndef HASP_TASMOTACLIENT_H
#define HASP_TASMOTACLIENT_H
#include "ArduinoJson.h"
#define HASP_SLAVE_SPEED 57600
#define HASP_TASMOTACLIENT_SPEED 57600
void TASMO_EVERY_SECOND(void);
void TASMO_DATA_RECEIVE(char * data);
@ -18,5 +18,4 @@ void slave_send_statusupdate();
void slaveSetup();
void slaveLoop(void);
#endif