23#if defined(ARDUINO_ARCH_ESP8266)
24# include <ESP8266WiFi.h>
25# include <ESPAsyncTCP.h>
26# include <ESPAsyncUDP.h>
27#elif defined(ARDUINO_ARCH_ESP32)
32# error "Unsupported CPU type"
36# error "PSRAM is not supported by ESPixelStick"
39#define ARDUINOJSON_USE_LONG_LONG 1
40#define ARDUINOJSON_DEFAULT_NESTING_LIMIT 15
43#include <ArduinoJson.h>
50#define REBOOT_DELAY 100
51#define LOG_PORT Serial
52#define CLIENT_TIMEOUT 15
55#define MilliSecondsInASecond 1000
56#define MicroSecondsInAmilliSecond 1000
57#define MicroSecondsInASecond (MicroSecondsInAmilliSecond * MilliSecondsInASecond)
58#define NanoSecondsInAMicroSecond 1000
59#define NanoSecondsInASecond (MicroSecondsInASecond * NanoSecondsInAMicroSecond)
60#define NanoSecondsInAMilliSecond (NanoSecondsInAMicroSecond * MicroSecondsInAmilliSecond)
62#define CPU_ClockTimeNS ((1.0 / float(F_CPU)) * float(NanoSecondsInASecond))
65#define STRINGIFY(X) #X
66#define STRING(X) STRINGIFY(X)
68extern void RequestReboot(uint32_t LoopDelay,
bool SkipDisable =
false);
91extern void PrettyPrint (JsonObject& jsonStuff, String Name);
92extern void PrettyPrint (JsonArray& jsonStuff, String Name);
93extern void PrettyPrint(JsonDocument &jsonStuff, String Name);
95template <
typename T,
typename N>
98 bool HasBeenModified =
false;
100 if (Json[(
char*)Name].
template is<T>())
102 T temp = Json[(
char*)Name];
103 if (temp != OutValue)
106 HasBeenModified =
true;
111 DEBUG_V(String(
"Could not find field '") + Name +
"' in the json record");
115 return HasBeenModified;
118template <
typename T,
typename N>
121 bool HasBeenModified =
false;
123 if (Json[(
char*)Name].
template is<T>())
125 T temp = Json[(
char*)Name];
126 if (temp != OutValue)
129 HasBeenModified =
true;
134 DEBUG_V(String(
"Could not find field '") + Name +
"' in the json record");
138 return HasBeenModified;
141#if defined(ARDUINO_ARCH_ESP8266)
142# define JsonWrite(j, n, v) (j)[String(n)] = (v)
143void inline ResetGpio(
const gpio_num_t pinId)
145 if(gpio_num_t(33) > pinId)
147 pinMode(pinId, INPUT);
151# define JsonWrite(j, n, v) (j)[(char*)(n)] = (v)
154 if(GPIO_IS_VALID_OUTPUT_GPIO(pinId))
156 pinMatrixOutDetach(pinId,
false,
false);
157 gpio_reset_pin(pinId);
158 pinMode(pinId, INPUT);
167 GetDriverName (DN); \
168 extern void _logcon (String & DriverName, String Message); \
176#define LOAD_CONFIG_DELAY 4
bool deserializeCore(JsonObject &json)
Definition main.cpp:304
bool dsNetwork(JsonObject &json)
void deserializeCoreHandler(JsonDocument &jsonDoc)
Definition main.cpp:385
config_t config
Definition main.cpp:93
void RequestReboot(uint32_t LoopDelay, bool SkipDisable=false)
Definition main.cpp:576
void PrettyPrint(JsonObject &jsonStuff, String Name)
Definition WebMgr.cpp:70
String serializeCore(bool pretty=false)
Definition main.cpp:469
uint32_t DiscardedRxData
Definition main.cpp:102
bool ResetWiFi
Definition main.cpp:97
const uint8_t CurrentConfigVersion
Definition main.cpp:91
bool setFromJSON(T &OutValue, JsonObject &Json, N Name)
Definition ESPixelStick.h:96
void ResetGpio(const gpio_num_t pinId)
Definition ESPixelStick.h:152
bool IsBooting
Definition main.cpp:98
void FeedWDT()
Definition main.cpp:610
bool dsDevice(JsonObject &json)
Deserialize device configuration JSON to config structure - returns true if config change detected.
Definition main.cpp:262
bool ConfigSaveNeeded
Definition main.cpp:100
bool RebootInProgress()
Definition main.cpp:571
const String ConfigFileName
Definition main.cpp:89
bool ConsoleUartIsActive
Definition main.cpp:588
#define DEBUG_V(v)
Definition memdebug.h:18
Core configuration structure.
Definition ESPixelStick.h:73
String id
Definition ESPixelStick.h:75
uint32_t BlankDelay
Definition ESPixelStick.h:76