Helper function to convert RGB to hex string
| 45 | |
| 46 | // Helper function to convert RGB to hex string |
| 47 | fl::string rgbToHex(u8 r, u8 g, u8 b) { |
| 48 | fl::string hex; |
| 49 | hex.reserve(6); |
| 50 | |
| 51 | auto byteToHex = [](u8 val) -> fl::string { |
| 52 | const char hexChars[] = "0123456789ABCDEF"; |
| 53 | fl::string result; |
| 54 | result.push_back(hexChars[val >> 4]); |
| 55 | result.push_back(hexChars[val & 0x0F]); |
| 56 | return result; |
| 57 | }; |
| 58 | |
| 59 | hex += byteToHex(r); |
| 60 | hex += byteToHex(g); |
| 61 | hex += byteToHex(b); |
| 62 | |
| 63 | return hex; |
| 64 | } |
| 65 | |
| 66 | // Helper function to parse segment fields |
| 67 | void parseSegmentFields(const fl::json& segJson, WLEDSegment& seg) { |