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(String & Reason, uint32_t LoopDelay,
bool SkipDisable =
false);
89 const char Version[32];
90 const char BuildDate[32];
91 const char ConfigFileName[32];
92 const uint8_t CurrentConfigVersion;
102extern void PrettyPrint (JsonObject& jsonStuff, String Name);
103extern void PrettyPrint (JsonArray& jsonStuff, String Name);
104extern void PrettyPrint(JsonDocument &jsonStuff, String Name);
106template <
typename T,
typename N>
109 bool HasBeenModified =
false;
111 if (Json[(
char*)Name].
template is<T>())
113 T temp = Json[(
char*)Name];
114 if (temp != OutValue)
117 HasBeenModified =
true;
122 DEBUG_V(String(
"Could not find field '") + Name +
"' in the json record");
126 return HasBeenModified;
129template <
typename N,
size_t S>
132 bool HasBeenModified =
false;
134 if (Json[(
char*)Name].
template is<String>())
136 String temp = Json[(
char*)Name];
137 if (!temp.equals(String(OutValue)))
139 strncpy(OutValue, temp.c_str(), S);
140 HasBeenModified =
true;
145 DEBUG_V(String(
"Could not find field '") + Name +
"' in the json record");
149 return HasBeenModified;
152template <
typename T,
typename N>
155 bool HasBeenModified =
false;
157 if (Json[(
char*)Name].
template is<T>())
159 T temp = Json[(
char*)Name];
160 if (temp != OutValue)
163 HasBeenModified =
true;
168 DEBUG_V(String(
"Could not find field '") + Name +
"' in the json record");
172 return HasBeenModified;
175#if defined(ARDUINO_ARCH_ESP8266)
176# define JsonWrite(j, n, v) (j)[String(n)] = (v)
177void inline ResetGpio(
const gpio_num_t pinId)
179 if(gpio_num_t(33) > pinId)
181 pinMode(pinId, INPUT);
185# define JsonWrite(j, n, v) (j)[(char*)(n)] = (v)
188 if(GPIO_IS_VALID_OUTPUT_GPIO(pinId))
190 pinMatrixOutDetach(pinId,
false,
false);
191 gpio_reset_pin(pinId);
192 pinMode(pinId, INPUT);
201 GetDriverName (DN); \
202 extern void _logcon (String & DriverName, String Message); \
209#define LOAD_CONFIG_DELAY 4
bool deserializeCore(JsonObject &json)
Definition main.cpp:323
bool dsNetwork(JsonObject &json)
void deserializeCoreHandler(JsonDocument &jsonDoc)
Definition main.cpp:404
config_t config
Definition main.cpp:98
void DelayReboot(uint32_t MinDelay)
Definition main.cpp:517
void PrettyPrint(JsonObject &jsonStuff, String Name)
Definition WebMgr.cpp:74
String serializeCore(bool pretty=false)
Definition main.cpp:488
uint32_t DiscardedRxData
Definition main.cpp:107
bool ResetWiFi
Definition main.cpp:102
bool setFromJSON(T &OutValue, JsonObject &Json, N Name)
Definition ESPixelStick.h:107
void ResetGpio(const gpio_num_t pinId)
Definition ESPixelStick.h:186
void RequestReboot(String &Reason, uint32_t LoopDelay, bool SkipDisable=false)
Definition main.cpp:611
bool IsBooting
Definition main.cpp:103
ConstConfig_t ConstConfig
Definition main.cpp:83
void FeedWDT()
Definition main.cpp:645
bool dsDevice(JsonObject &json)
Deserialize device configuration JSON to config structure - returns true if config change detected.
Definition main.cpp:281
bool ConfigSaveNeeded
Definition main.cpp:105
bool RebootInProgress()
Definition main.cpp:606
bool ConsoleUartIsActive
Definition main.cpp:623
struct FSEQParsedRangeEntry __attribute__
#define DEBUG_V(v)
Definition memdebug.h:18
Core configuration structure.
Definition ESPixelStick.h:74
uint32_t BlankDelay
Definition ESPixelStick.h:77