Prior to refactoring includes and forward definitions.

This commit is contained in:
Travis J Dean 2020-03-25 04:36:55 -04:00
parent 594c0b8550
commit 12131764d1
15 changed files with 59 additions and 17 deletions

View File

@ -1,6 +1,6 @@
#ifndef EspalexaDevice_h #ifndef EspalexaDevice_h
#define EspalexaDevice_h #define EspalexaDevice_h
#include <functional>
#include "Arduino.h" #include "Arduino.h"
typedef class EspalexaDevice; typedef class EspalexaDevice;

View File

@ -1,4 +1,18 @@
#include "wled.h" #include "wled.h"
#include "wled_led.h"
#include "wled_ir.h"
#include "wled_notify.h"
#include "wled_alexa.h"
#include "wled_overlay.h"
#include "wled_file.h"
#include "wled_button.h"
#include "wled_ntp.h"
#include "wled_usermod.h"
#include "wled_blynk.h"
#include "wled_hue.h"
#include "wled_mqtt.h"
#include "wled_eeprom.h"
#include "wled_server.h"
WLED::WLED() { WLED::WLED() {
@ -251,7 +265,7 @@ void WLED::beginStrip()
#endif #endif
} }
void WLED::initAP(bool resetAP = false) void WLED::initAP(bool resetAP)
{ {
if (apBehavior == AP_BEHAVIOR_BUTTON_ONLY && !resetAP) if (apBehavior == AP_BEHAVIOR_BUTTON_ONLY && !resetAP)
return; return;
@ -483,7 +497,7 @@ void WLED::handleConnection()
} }
//by https://github.com/tzapu/WiFiManager/blob/master/WiFiManager.cpp //by https://github.com/tzapu/WiFiManager/blob/master/WiFiManager.cpp
int WLED::getSignalQuality(int rssi) int getSignalQuality(int rssi)
{ {
int quality = 0; int quality = 0;

View File

@ -491,6 +491,7 @@ int loops = 0;
bool oappend(const char *txt); bool oappend(const char *txt);
//append new number to temp buffer efficiently //append new number to temp buffer efficiently
bool oappendi(int i); bool oappendi(int i);
int getSignalQuality(int rssi);
class WLED class WLED
{ {
@ -503,8 +504,6 @@ public:
WLED(); WLED();
void wledInit();
void reset(); void reset();
void loop(); void loop();
@ -515,8 +514,6 @@ public:
wledInit(); wledInit();
} }
void loop();
private: private:
void wledInit(); void wledInit();
void beginStrip(); void beginStrip();

View File

@ -3,11 +3,11 @@
*/ */
#include "wled.h" #include "wled.h"
WLED wled;
void setup() { void setup() {
//auto& wled = Wled(); wled.instance(); // Force creation of static instance
} }
void loop() { void loop() {
wled.loop();
} }

View File

@ -1,6 +1,7 @@
#include "wled_alexa.h" #include "wled_alexa.h"
#include "wled.h" #include "wled.h"
#include "src/dependencies/espalexa/EspalexaDevice.h" #include "src/dependencies/espalexa/EspalexaDevice.h"
#include "const.h"
#ifndef WLED_DISABLE_ALEXA #ifndef WLED_DISABLE_ALEXA
void onAlexaChange(EspalexaDevice* dev); void onAlexaChange(EspalexaDevice* dev);

View File

@ -7,10 +7,11 @@
* https://github.com/kakopappa/arduino-esp8266-alexa-wemo-switch * https://github.com/kakopappa/arduino-esp8266-alexa-wemo-switch
* https://github.com/probonopd/ESP8266HueEmulator * https://github.com/probonopd/ESP8266HueEmulator
*/ */
class EspalexaDevice; #include "src/dependencies/espalexa/EspalexaDevice.h"
void onAlexaChange(EspalexaDevice* dev); void onAlexaChange(EspalexaDevice* dev);
void alexaInit(); void alexaInit();
void handleAlexa(); void handleAlexa();
void onAlexaChange(EspalexaDevice* dev); void onAlexaChange(EspalexaDevice* dev);
#define WLED_ALEXA_H #endif // WLED_ALEXA_H

View File

@ -1,7 +1,10 @@
#include "wled_eeprom.h" #include "wled_eeprom.h"
#include "wled.h" #include "wled.h"
#include "wled_cronixie.h"
#include "wled_ntp.h"
#include "wled_set.h"
#include "wled_led.h"
#define EEPSIZE 2560 //Maximum is 4096
//eeprom Version code, enables default settings instead of 0 init on update //eeprom Version code, enables default settings instead of 0 init on update
#define EEPVER 18 #define EEPVER 18

View File

@ -5,6 +5,7 @@
* Methods to handle saving and loading to non-volatile memory * Methods to handle saving and loading to non-volatile memory
* EEPROM Map: https://github.com/Aircoookie/WLED/wiki/EEPROM-Map * EEPROM Map: https://github.com/Aircoookie/WLED/wiki/EEPROM-Map
*/ */
#define EEPSIZE 2560 //Maximum is 4096
void commit(); void commit();
void clearEEPROM(); void clearEEPROM();

View File

@ -1,5 +1,8 @@
#include "wled_file.h" #include "wled_file.h"
#include "wled.h" #include "wled.h"
#include "wled_led.h"
#include "wled_notify.h"
//filesystem //filesystem
#ifndef WLED_DISABLE_FILESYSTEM #ifndef WLED_DISABLE_FILESYSTEM
#include <FS.h> #include <FS.h>
@ -21,6 +24,7 @@ enum class AdaState {
Data_Blue Data_Blue
}; };
// Maybe Adalight should not be in filehandling? TODO
void handleSerial() void handleSerial()
{ {
#ifdef WLED_ENABLE_ADALIGHT #ifdef WLED_ENABLE_ADALIGHT

View File

@ -1,5 +1,10 @@
#include "wled_server.h" #include "wled_server.h"
#include "wled.h" #include "wled.h"
#include "wled_file.h"
#include "wled_set.h"
#include "wled_json.h"
#include "wled_xml.h"
//Is this an IP? //Is this an IP?
bool isIp(String str) { bool isIp(String str) {

View File

@ -1,5 +1,6 @@
#ifndef WLED_SERVER_H #ifndef WLED_SERVER_H
#define WLED_SERVER_H #define WLED_SERVER_H
#include <Arduino.h>
/* /*
* Server page declarations * Server page declarations
*/ */

View File

@ -1,10 +1,13 @@
#include "wled_set.h" #include "wled_set.h"
#include "wled.h" #include "wled.h"
#include "wled_hue.h"
#include "wled_colors.h" #include "wled_colors.h"
/* #include "wled_hue.h"
* Receives client input #include "wled_led.h"
*/ #include "wled_blynk.h"
#include "wled_eeprom.h"
#include "wled_alexa.h"
#include "wled_cronixie.h"
#include "wled_xml.h"
void _setRandomColor(bool _sec,bool fromButton=false) void _setRandomColor(bool _sec,bool fromButton=false)
{ {

View File

@ -2,10 +2,14 @@
#define WLED_SET_H #define WLED_SET_H
#include <Arduino.h> #include <Arduino.h>
#include <ESPAsyncWebServer.h> #include <ESPAsyncWebServer.h>
/*
* Receives client input
*/
void _setRandomColor(bool _sec,bool fromButton=false); void _setRandomColor(bool _sec,bool fromButton=false);
bool isAsterisksOnly(const char* str, byte maxLen); bool isAsterisksOnly(const char* str, byte maxLen);
void handleSettingsSet(AsyncWebServerRequest *request, byte subPage); void handleSettingsSet(AsyncWebServerRequest *request, byte subPage);
bool handleSet(AsyncWebServerRequest *request, const String& req);
int getNumVal(const String* req, uint16_t pos); int getNumVal(const String* req, uint16_t pos);
bool updateVal(const String* req, const char* key, byte* val, byte minv=0, byte maxv=255); bool updateVal(const String* req, const char* key, byte* val, byte minv=0, byte maxv=255);

8
wled00/wled_usermod.h Normal file
View File

@ -0,0 +1,8 @@
#ifndef WLED_USERMOD_H
#define WLED_USERMOD_H
void userSetup();
void userConnected();
void userLoop();
#endif // WLED_USERMOD_H