load pixel config from json file

This commit is contained in:
2018-09-02 20:21:59 +02:00
parent 5538cffb20
commit b69a0937a0
5 changed files with 51 additions and 20 deletions

View File

@@ -10,12 +10,26 @@
// TODO move ARRAY_LENGTH to core lib
#define ARRAY_LENGTH(array) sizeof(array)/sizeof(array[0])
struct NeoPixelConfig {
struct NeoPixelConfig : public JsonStruct {
int pin;
int length;
int brightness;
int updateInterval;
int defaultColor;
void mapJsonObject(JsonObject& root) {
root["pin"] = pin;
root["length"] = length;
root["brightness"] = brightness;
root["updateInterval"] = updateInterval;
root["defaultColor"] = defaultColor;
}
void fromJsonObject(JsonObject& json) {
pin = getIntAttrFromJson(json, "pin");
length = getIntAttrFromJson(json, "length");
brightness = getIntAttrFromJson(json, "brightness");
updateInterval = getIntAttrFromJson(json, "updateInterval");
defaultColor = getIntAttrFromJson(json, "defaultColor");
}
};
struct NeoPatternDto : public JsonStruct {