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 125 of file screenmap.cpp.

126 {
127
128#if !FASTLED_ENABLE_JSON
129 return;
130#else
131 auto &doc = *_doc;
132 auto map = doc["map"].to<FLArduinoJson::JsonObject>();
133 for (auto kv : segmentMaps) {
134 auto segment = map[kv.first].to<FLArduinoJson::JsonObject>();
135 auto x_array = segment["x"].to<FLArduinoJson::JsonArray>();
136 auto y_array = segment["y"].to<FLArduinoJson::JsonArray>();
137 for (uint16_t i = 0; i < kv.second.getLength(); i++) {
138 const vec2f &xy = kv.second[i];
139 x_array.add(xy.x);
140 y_array.add(xy.y);
141 }
142 float diameter = kv.second.getDiameter();
143 if (diameter < 0.0f) {
144 diameter = .5f; // 5mm.
145 }
146 if (diameter > 0.0f) {
147 segment["diameter"] = diameter;
148 }
149 }
150#endif
151}
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)
vec2< float > vec2f
Definition geometry.h:301

References xy().

Referenced by toJsonStr().

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