Move Arduino_JSON to AirGradient libries

This commit is contained in:
Phat Nguyen
2024-04-11 09:29:29 +07:00
parent bd1197971f
commit 1d6a0a06c0
24 changed files with 5411 additions and 41 deletions

View File

@ -1,5 +1,6 @@
#include "AgConfigure.h"
#include "EEPROM.h"
#include "Libraries/Arduino_JSON/src/Arduino_JSON.h"
const char *CONFIGURATION_CONTROL_NAME[] = {
[ConfigurationControlLocal] = "local",
@ -12,6 +13,15 @@ const char *LED_BAR_MODE_NAMES[] = {
[LedBarModeCO2] = "co2",
};
static bool jsonTypeInvalid(JSONVar root, String validType) {
String type = JSON.typeof_(root);
if (type == validType || type == "undefined" || type == "unknown" ||
type == "null") {
return false;
}
return true;
}
/**
* @brief Get LedBarMode Name
*
@ -706,14 +716,6 @@ bool Configuration::isUpdated(void) {
return updated;
}
bool Configuration::jsonTypeInvalid(JSONVar root, String validType) {
String type = JSON.typeof_(root);
if (type == validType || type == "undefined" || type == "unknown" || type == "null") {
return false;
}
return true;
}
String Configuration::jsonTypeInvalidMessage(String name, String type) {
return "'" + name + "' type invalid, it's should '" + type + "'";
}