mirror of
https://gitlab.com/zwirbel/illucat.git
synced 2025-12-16 10:04:30 +01:00
uncouple generic web stuff into api plugin
This commit is contained in:
@@ -11,11 +11,12 @@
|
||||
#define ARRAY_LENGTH(array) sizeof(array)/sizeof(array[0])
|
||||
|
||||
struct NeoPixelConfig : public JsonStruct {
|
||||
int pin;
|
||||
int length;
|
||||
int brightness;
|
||||
int updateInterval;
|
||||
int defaultColor;
|
||||
// FIXME constants!
|
||||
int pin = 4;
|
||||
int length = 8;
|
||||
int brightness = 100;
|
||||
int updateInterval = 100;
|
||||
int defaultColor = 100; // FIXME remove unused
|
||||
void mapJsonObject(JsonObject& root) {
|
||||
root["pin"] = pin;
|
||||
root["length"] = length;
|
||||
@@ -24,11 +25,11 @@ struct NeoPixelConfig : public JsonStruct {
|
||||
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");
|
||||
pin = getIntAttrFromJson(json, "pin", pin);
|
||||
length = getIntAttrFromJson(json, "length", length);
|
||||
brightness = getIntAttrFromJson(json, "brightness", brightness);
|
||||
updateInterval = getIntAttrFromJson(json, "updateInterval", updateInterval);
|
||||
defaultColor = getIntAttrFromJson(json, "defaultColor", defaultColor);
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user