FastLED 3.9.15
Loading...
Searching...
No Matches

◆ toJson()

void fl::ScreenMap::toJson ( const FixedMap< Str, ScreenMap, 16 > & segmentMaps,
JsonDocument * doc )
static

Definition at line 111 of file screenmap.cpp.

112 {
113
114#if !FASTLED_ENABLE_JSON
115 return;
116#else
117 auto &doc = *_doc;
118 auto map = doc["map"].to<FLArduinoJson::JsonObject>();
119 for (auto kv : segmentMaps) {
120 auto segment = map[kv.first].to<FLArduinoJson::JsonObject>();
121 auto x_array = segment["x"].to<FLArduinoJson::JsonArray>();
122 auto y_array = segment["y"].to<FLArduinoJson::JsonArray>();
123 for (uint16_t i = 0; i < kv.second.getLength(); i++) {
124 const pair_xy_float &xy = kv.second[i];
125 x_array.add(xy.x);
126 y_array.add(xy.y);
127 }
128 float diameter = kv.second.getDiameter();
129 if (diameter < 0.0f) {
130 diameter = .5f; // 5mm.
131 }
132 if (diameter > 0.0f) {
133 segment["diameter"] = diameter;
134 }
135 }
136#endif
137}
unsigned int xy(unsigned int x, unsigned int y)
long map(long x, long in_min, long in_max, long out_min, long out_max)
pair_xy< float > pair_xy_float
Definition lut.h:24

References xy().

Referenced by toJsonStr().

+ Here is the call graph for this function:
+ Here is the caller graph for this function: