Add ledmap names
Bugfix - reset segments upon 2D ledmap allocation error - fix invlid 2D segments
This commit is contained in:
parent
a7cded21f7
commit
92d2be3f5e
@ -147,6 +147,7 @@ void WS2812FX::setUpMatrix() {
|
||||
panel.clear();
|
||||
Segment::maxWidth = _length;
|
||||
Segment::maxHeight = 1;
|
||||
resetSegments();
|
||||
}
|
||||
}
|
||||
#else
|
||||
|
@ -758,7 +758,7 @@ void Segment::refreshLightCapabilities() {
|
||||
if (bus->getStart() >= stop) continue;
|
||||
if (bus->getStart() + bus->getLength() <= start) continue;
|
||||
|
||||
uint8_t type = bus->getType();
|
||||
//uint8_t type = bus->getType();
|
||||
if (bus->hasRGB() || (cctFromRgb && bus->hasCCT())) capabilities |= SEG_CAPABILITY_RGB;
|
||||
if (!cctFromRgb && bus->hasCCT()) capabilities |= SEG_CAPABILITY_CCT;
|
||||
if (correctWB && (bus->hasRGB() || bus->hasCCT())) capabilities |= SEG_CAPABILITY_CCT; //white balance correction (CCT slider)
|
||||
@ -1472,8 +1472,16 @@ void WS2812FX::makeAutoSegments(bool forceReset) {
|
||||
void WS2812FX::fixInvalidSegments() {
|
||||
//make sure no segment is longer than total (sanity check)
|
||||
for (size_t i = getSegmentsNum()-1; i > 0; i--) {
|
||||
if (_segments[i].start >= _length) { _segments.erase(_segments.begin()+i); continue; }
|
||||
if (_segments[i].stop > _length) _segments[i].stop = _length;
|
||||
if (isMatrix) {
|
||||
#ifndef WLED_DISABLE_2D
|
||||
if (_segments[i].start >= Segment::maxWidth || _segments[i].startY >= Segment::maxHeight) { _segments.erase(_segments.begin()+i); continue; }
|
||||
if (_segments[i].stop > Segment::maxWidth) _segments[i].stop = Segment::maxWidth;
|
||||
if (_segments[i].stopY > Segment::maxHeight) _segments[i].stopY = Segment::maxHeight;
|
||||
#endif
|
||||
} else {
|
||||
if (_segments[i].start >= _length) { _segments.erase(_segments.begin()+i); continue; }
|
||||
if (_segments[i].stop > _length) _segments[i].stop = _length;
|
||||
}
|
||||
// this is always called as the last step after finalizeInit(), update covered bus types
|
||||
_segments[i].refreshLightCapabilities();
|
||||
}
|
||||
|
@ -79,6 +79,17 @@
|
||||
#define WLED_MAX_COLOR_ORDER_MAPPINGS 10
|
||||
#endif
|
||||
|
||||
#if defined(WLED_MAX_LEDMAPS) && (WLED_MAX_LEDMAPS > 32 || WLED_MAX_LEDMAPS < 10)
|
||||
#undef WLED_MAX_LEDMAPS
|
||||
#endif
|
||||
#ifndef WLED_MAX_LEDMAPS
|
||||
#ifdef ESP8266
|
||||
#define WLED_MAX_LEDMAPS 10
|
||||
#else
|
||||
#define WLED_MAX_LEDMAPS 16
|
||||
#endif
|
||||
#endif
|
||||
|
||||
//Usermod IDs
|
||||
#define USERMOD_ID_RESERVED 0 //Unused. Might indicate no usermod present
|
||||
#define USERMOD_ID_UNSPECIFIED 1 //Default value for a general user mod that does not specify a custom ID
|
||||
|
@ -810,7 +810,7 @@ function populateSegments(s)
|
||||
|
||||
if (Array.isArray(li.maps) && li.maps.length>1) {
|
||||
let cont = `Ledmap: <select class="sel-sg" onchange="requestJson({'ledmap':parseInt(this.value)})"><option value="" selected>Unchanged</option>`;
|
||||
for (const k of (li.maps||[])) cont += `<option value="${k}">${k==0?'Default':'ledmap'+k+'.json'}</option>`;
|
||||
for (const k of (li.maps||[])) cont += `<option value="${k.id}">${k.id==0?'Default':(k.n?k.n:'ledmap'+k.id+'.json')}</option>`;
|
||||
cont += "</select></div>";
|
||||
gId("ledmap").innerHTML = cont;
|
||||
gId("ledmap").classList.remove('hide');
|
||||
@ -1877,7 +1877,7 @@ ${makePlSel(plJson[i].end?plJson[i].end:0, true)}
|
||||
</label>`;
|
||||
if (Array.isArray(lastinfo.maps) && lastinfo.maps.length>1) {
|
||||
content += `<div class="lbl-l">Ledmap: <div class="sel-p"><select class="sel-p" id="p${i}lmp"><option value="">Unchanged</option>`;
|
||||
for (const k of (lastinfo.maps||[])) content += `<option value="${k}"${(i>0 && pJson[i].ledmap==k)?" selected":""}>${k==0?'Default':'ledmap'+k+'.json'}</option>`;
|
||||
for (const k of (lastinfo.maps||[])) content += `<option value="${k.id}"${(i>0 && pJson[i].ledmap==k.id)?" selected":""}>${k.id==0?'Default':(k.n?k.n:'ledmap'+k.id+'.json')}</option>`;
|
||||
content += "</select></div></div>";
|
||||
}
|
||||
}
|
||||
|
1498
wled00/html_other.h
1498
wled00/html_other.h
File diff suppressed because it is too large
Load Diff
@ -8,7 +8,7 @@
|
||||
// Autogenerated from wled00/data/style.css, do not edit!!
|
||||
const uint16_t PAGE_settingsCss_length = 847;
|
||||
const uint8_t PAGE_settingsCss[] PROGMEM = {
|
||||
0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0x0a, 0xad, 0x55, 0xc1, 0x8e, 0x9b, 0x30,
|
||||
0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0x13, 0xad, 0x55, 0xc1, 0x8e, 0x9b, 0x30,
|
||||
0x10, 0xfd, 0x15, 0xaa, 0x68, 0xa5, 0xad, 0x14, 0x10, 0x10, 0xc8, 0xa6, 0x46, 0x95, 0xaa, 0xde,
|
||||
0x7b, 0xab, 0xaa, 0x4a, 0xd5, 0x1e, 0x0c, 0x1e, 0x82, 0x15, 0x63, 0x23, 0xdb, 0x74, 0x49, 0x11,
|
||||
0xff, 0x5e, 0xdb, 0xc0, 0x42, 0xb2, 0x68, 0x7b, 0xa9, 0xa2, 0x44, 0xc4, 0x63, 0xc6, 0x6f, 0xde,
|
||||
@ -67,7 +67,7 @@ const uint8_t PAGE_settingsCss[] PROGMEM = {
|
||||
// Autogenerated from wled00/data/settings.htm, do not edit!!
|
||||
const uint16_t PAGE_settings_length = 992;
|
||||
const uint8_t PAGE_settings[] PROGMEM = {
|
||||
0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0x0a, 0xad, 0x56, 0x6d, 0x6f, 0xdb, 0x36,
|
||||
0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0x13, 0xad, 0x56, 0x6d, 0x6f, 0xdb, 0x36,
|
||||
0x10, 0xfe, 0xee, 0x5f, 0xc1, 0xb0, 0x58, 0x23, 0xa1, 0xb2, 0xec, 0x38, 0xc3, 0xb0, 0xc9, 0x96,
|
||||
0x8b, 0x35, 0x2f, 0x9b, 0x87, 0x04, 0x0d, 0x90, 0xa4, 0xdd, 0x80, 0x7d, 0xa1, 0xc9, 0x93, 0xcc,
|
||||
0x46, 0x22, 0x05, 0xf2, 0xe4, 0xc4, 0x73, 0xf3, 0xdf, 0x77, 0x94, 0x9d, 0xb7, 0x26, 0x18, 0x86,
|
||||
@ -135,7 +135,7 @@ const uint8_t PAGE_settings[] PROGMEM = {
|
||||
// Autogenerated from wled00/data/settings_wifi.htm, do not edit!!
|
||||
const uint16_t PAGE_settings_wifi_length = 2098;
|
||||
const uint8_t PAGE_settings_wifi[] PROGMEM = {
|
||||
0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0x0a, 0xb5, 0x58, 0x6b, 0x6f, 0xdb, 0xca,
|
||||
0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0x13, 0xb5, 0x58, 0x6b, 0x6f, 0xdb, 0xca,
|
||||
0x11, 0xfd, 0xae, 0x5f, 0xb1, 0xde, 0x16, 0x06, 0x09, 0xd3, 0x94, 0x64, 0x35, 0x69, 0x60, 0x8b,
|
||||
0x4a, 0xfd, 0xd0, 0x8d, 0xdd, 0x3a, 0x8e, 0x0a, 0x19, 0xd7, 0x28, 0xd2, 0xe0, 0x5e, 0x9a, 0x1c,
|
||||
0x49, 0x1b, 0x93, 0xbb, 0xbc, 0xdc, 0xa5, 0x64, 0xc3, 0xd6, 0x7f, 0xef, 0xcc, 0x2e, 0xf5, 0xb4,
|
||||
@ -273,7 +273,7 @@ const uint8_t PAGE_settings_wifi[] PROGMEM = {
|
||||
// Autogenerated from wled00/data/settings_leds.htm, do not edit!!
|
||||
const uint16_t PAGE_settings_leds_length = 7500;
|
||||
const uint8_t PAGE_settings_leds[] PROGMEM = {
|
||||
0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0x0a, 0xdd, 0x3c, 0xed, 0x76, 0xda, 0xc8,
|
||||
0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0x13, 0xdd, 0x3c, 0xed, 0x76, 0xda, 0xc8,
|
||||
0x92, 0xff, 0x79, 0x8a, 0x76, 0xcf, 0x8c, 0x23, 0x5d, 0x64, 0x90, 0xf8, 0xc8, 0x38, 0x80, 0xf0,
|
||||
0x1a, 0xc7, 0xc9, 0xf8, 0x5e, 0x7b, 0xe2, 0x63, 0x3c, 0xc9, 0xbd, 0x27, 0x93, 0x93, 0x08, 0xd1,
|
||||
0x80, 0x62, 0x21, 0x71, 0x25, 0x61, 0x9b, 0xb5, 0xd9, 0x67, 0xda, 0x67, 0xd8, 0x27, 0xdb, 0xaa,
|
||||
@ -748,7 +748,7 @@ const uint8_t PAGE_settings_leds[] PROGMEM = {
|
||||
// Autogenerated from wled00/data/settings_dmx.htm, do not edit!!
|
||||
const uint16_t PAGE_settings_dmx_length = 1612;
|
||||
const uint8_t PAGE_settings_dmx[] PROGMEM = {
|
||||
0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0x0a, 0x95, 0x57, 0xdb, 0x72, 0xdb, 0x36,
|
||||
0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0x13, 0x95, 0x57, 0xdb, 0x72, 0xdb, 0x36,
|
||||
0x10, 0x7d, 0xd7, 0x57, 0x20, 0x78, 0x88, 0xc9, 0x31, 0x43, 0x4a, 0x4e, 0x95, 0x36, 0x32, 0x49,
|
||||
0x37, 0x56, 0x5c, 0xdb, 0x1d, 0xdb, 0xf5, 0x44, 0x49, 0xd3, 0x4e, 0xd3, 0xe9, 0x40, 0xe4, 0x4a,
|
||||
0x44, 0x4c, 0x02, 0x2c, 0x00, 0x4a, 0x76, 0x2e, 0xff, 0xde, 0x05, 0x48, 0x5d, 0xec, 0xd8, 0x69,
|
||||
@ -855,7 +855,7 @@ const uint8_t PAGE_settings_dmx[] PROGMEM = {
|
||||
// Autogenerated from wled00/data/settings_ui.htm, do not edit!!
|
||||
const uint16_t PAGE_settings_ui_length = 3181;
|
||||
const uint8_t PAGE_settings_ui[] PROGMEM = {
|
||||
0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0x0a, 0xad, 0x59, 0x6d, 0x77, 0xda, 0x38,
|
||||
0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0x13, 0xad, 0x59, 0x6d, 0x77, 0xda, 0x38,
|
||||
0x16, 0xfe, 0xce, 0xaf, 0x50, 0xd5, 0x39, 0x19, 0x38, 0x71, 0x81, 0xb4, 0xb3, 0x67, 0x5b, 0xc0,
|
||||
0x64, 0x9b, 0x34, 0xd3, 0x66, 0x4e, 0x3a, 0xed, 0x96, 0x74, 0x3b, 0x73, 0xba, 0x3d, 0x19, 0x63,
|
||||
0x0b, 0x50, 0x63, 0x5b, 0x1e, 0x4b, 0x0e, 0xc9, 0x52, 0xfe, 0xfb, 0x3e, 0x57, 0xb2, 0xc1, 0x90,
|
||||
@ -1060,7 +1060,7 @@ const uint8_t PAGE_settings_ui[] PROGMEM = {
|
||||
// Autogenerated from wled00/data/settings_sync.htm, do not edit!!
|
||||
const uint16_t PAGE_settings_sync_length = 3403;
|
||||
const uint8_t PAGE_settings_sync[] PROGMEM = {
|
||||
0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0x0a, 0xad, 0x5a, 0x6d, 0x73, 0xda, 0x48,
|
||||
0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0x13, 0xad, 0x5a, 0x6d, 0x73, 0xda, 0x48,
|
||||
0x12, 0xfe, 0xae, 0x5f, 0x31, 0xd6, 0x56, 0xe5, 0x60, 0x8d, 0x41, 0x80, 0x71, 0x1c, 0x1b, 0x29,
|
||||
0x67, 0x6c, 0xc7, 0xe6, 0x36, 0x4e, 0x08, 0xd8, 0x9b, 0x6c, 0xd5, 0x55, 0x6d, 0x0d, 0xd2, 0x00,
|
||||
0xb2, 0x25, 0x8d, 0x56, 0x33, 0xf2, 0x4b, 0x65, 0xf3, 0xdf, 0xaf, 0x7b, 0x46, 0x12, 0x20, 0xf3,
|
||||
@ -1279,7 +1279,7 @@ const uint8_t PAGE_settings_sync[] PROGMEM = {
|
||||
// Autogenerated from wled00/data/settings_time.htm, do not edit!!
|
||||
const uint16_t PAGE_settings_time_length = 3313;
|
||||
const uint8_t PAGE_settings_time[] PROGMEM = {
|
||||
0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0x0a, 0xd5, 0x1a, 0x6b, 0x57, 0xdb, 0x38,
|
||||
0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0x13, 0xd5, 0x1a, 0x6b, 0x57, 0xdb, 0x38,
|
||||
0xf6, 0x7b, 0x7e, 0x85, 0x50, 0x7b, 0x98, 0x78, 0x70, 0x9e, 0x90, 0x16, 0x92, 0xd8, 0xdd, 0x10,
|
||||
0xd2, 0x42, 0x4b, 0x02, 0x67, 0x92, 0x0e, 0xbb, 0xd3, 0xf6, 0x4c, 0x15, 0x5b, 0x49, 0x0c, 0x8e,
|
||||
0xe4, 0xb5, 0x65, 0x02, 0x4b, 0xf9, 0xef, 0x7b, 0x25, 0x39, 0xce, 0xd3, 0xd0, 0x76, 0x66, 0x3f,
|
||||
@ -1493,7 +1493,7 @@ const uint8_t PAGE_settings_time[] PROGMEM = {
|
||||
// Autogenerated from wled00/data/settings_sec.htm, do not edit!!
|
||||
const uint16_t PAGE_settings_sec_length = 2407;
|
||||
const uint8_t PAGE_settings_sec[] PROGMEM = {
|
||||
0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0x0a, 0xa5, 0x58, 0x6d, 0x53, 0xdb, 0x48,
|
||||
0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0x13, 0xa5, 0x58, 0x6d, 0x53, 0xdb, 0x48,
|
||||
0x12, 0xfe, 0xee, 0x5f, 0x31, 0x9e, 0x54, 0xb1, 0xd6, 0x45, 0x58, 0x40, 0x72, 0x5b, 0x09, 0x58,
|
||||
0xce, 0x41, 0x20, 0x1b, 0xae, 0x20, 0x50, 0xd8, 0x6c, 0xee, 0x2a, 0x97, 0x4a, 0x8d, 0xa5, 0xb1,
|
||||
0x35, 0xb1, 0xac, 0xd1, 0xce, 0x8c, 0x70, 0x7c, 0xd9, 0xfd, 0xef, 0xf7, 0xf4, 0x48, 0x32, 0x86,
|
||||
@ -1650,7 +1650,7 @@ const uint8_t PAGE_settings_sec[] PROGMEM = {
|
||||
// Autogenerated from wled00/data/settings_um.htm, do not edit!!
|
||||
const uint16_t PAGE_settings_um_length = 2786;
|
||||
const uint8_t PAGE_settings_um[] PROGMEM = {
|
||||
0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0x0a, 0xcd, 0x59, 0x6d, 0x73, 0xdb, 0x36,
|
||||
0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0x13, 0xcd, 0x59, 0x6d, 0x73, 0xdb, 0x36,
|
||||
0x12, 0xfe, 0xee, 0x5f, 0x41, 0x23, 0x1e, 0x9b, 0x1c, 0xd1, 0x94, 0x9c, 0xb4, 0x33, 0xa9, 0x24,
|
||||
0xd2, 0x97, 0x38, 0x69, 0xa3, 0xcb, 0x8b, 0x3d, 0xe3, 0xb4, 0x9d, 0x1b, 0xc7, 0x17, 0x53, 0x22,
|
||||
0x24, 0x21, 0xa6, 0x00, 0x16, 0x04, 0xfd, 0x72, 0xb2, 0xfe, 0xfb, 0x3d, 0x0b, 0xbe, 0x88, 0x72,
|
||||
@ -1831,7 +1831,7 @@ const uint8_t PAGE_settings_um[] PROGMEM = {
|
||||
// Autogenerated from wled00/data/settings_2D.htm, do not edit!!
|
||||
const uint16_t PAGE_settings_2D_length = 3161;
|
||||
const uint8_t PAGE_settings_2D[] PROGMEM = {
|
||||
0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0x0a, 0xc5, 0x59, 0x5b, 0x77, 0xdb, 0x36,
|
||||
0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0x13, 0xc5, 0x59, 0x5b, 0x77, 0xdb, 0x36,
|
||||
0x12, 0x7e, 0xd7, 0xaf, 0x80, 0xd1, 0xae, 0x4b, 0x5a, 0xd4, 0xcd, 0x4d, 0x7a, 0x5a, 0x49, 0xa4,
|
||||
0x36, 0x8e, 0xd3, 0xd8, 0x7b, 0xe2, 0x44, 0xc7, 0x72, 0xed, 0xe4, 0xb4, 0x3d, 0x2d, 0x4d, 0x42,
|
||||
0x12, 0x12, 0x0a, 0x60, 0x49, 0x50, 0xb6, 0xeb, 0xf8, 0xbf, 0xef, 0x0c, 0xc0, 0x9b, 0x28, 0xd9,
|
||||
@ -2035,7 +2035,7 @@ const uint8_t PAGE_settings_2D[] PROGMEM = {
|
||||
// Autogenerated from wled00/data/settings_pin.htm, do not edit!!
|
||||
const uint16_t PAGE_settings_pin_length = 471;
|
||||
const uint8_t PAGE_settings_pin[] PROGMEM = {
|
||||
0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0x0a, 0x5d, 0x52, 0x4d, 0x6f, 0x13, 0x31,
|
||||
0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0x13, 0x5d, 0x52, 0x4d, 0x6f, 0x13, 0x31,
|
||||
0x10, 0xbd, 0xef, 0xaf, 0x30, 0x73, 0x69, 0x82, 0x92, 0x6c, 0xa8, 0xa8, 0x04, 0xaa, 0xbd, 0x42,
|
||||
0x81, 0x1e, 0xb8, 0x94, 0x48, 0xe5, 0x52, 0x55, 0x55, 0xe5, 0xd8, 0xb3, 0x89, 0x55, 0x7f, 0x2c,
|
||||
0xb6, 0x37, 0x21, 0x54, 0xfc, 0x77, 0xc6, 0xbb, 0xa1, 0xa0, 0x5c, 0xd6, 0x7e, 0x33, 0xe3, 0x37,
|
||||
|
2241
wled00/html_simple.h
2241
wled00/html_simple.h
File diff suppressed because it is too large
Load Diff
1907
wled00/html_ui.h
1907
wled00/html_ui.h
File diff suppressed because it is too large
Load Diff
@ -643,8 +643,14 @@ void serializeInfo(JsonObject root)
|
||||
root[F("cpalcount")] = strip.customPalettes.size(); //number of custom palettes
|
||||
|
||||
JsonArray ledmaps = root.createNestedArray(F("maps"));
|
||||
for (size_t i=0; i<10; i++) {
|
||||
if ((ledMaps>>i) & 0x0001) ledmaps.add(i);
|
||||
for (size_t i=0; i<WLED_MAX_LEDMAPS; i++) {
|
||||
if ((ledMaps>>i) & 0x00000001U) {
|
||||
JsonObject ledmaps0 = ledmaps.createNestedObject();
|
||||
ledmaps0["id"] = i;
|
||||
#ifndef ESP8266
|
||||
if (ledmapNames[i]) ledmaps0["n"] = ledmapNames[i];
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
||||
JsonObject wifi_info = root.createNestedObject("wifi");
|
||||
|
@ -503,12 +503,49 @@ um_data_t* simulateSound(uint8_t simulationId)
|
||||
}
|
||||
|
||||
|
||||
// enumerate all ledmapX.json files on FS and extract ledmap names if existing
|
||||
void enumerateLedmaps() {
|
||||
ledMaps = 1;
|
||||
for (size_t i=1; i<10; i++) {
|
||||
char fileName[16];
|
||||
for (size_t i=1; i<WLED_MAX_LEDMAPS; i++) {
|
||||
char fileName[33];
|
||||
sprintf_P(fileName, PSTR("/ledmap%d.json"), i);
|
||||
bool isFile = WLED_FS.exists(fileName);
|
||||
if (isFile) ledMaps |= 1 << i;
|
||||
|
||||
#ifndef ESP8266
|
||||
if (ledmapNames[i-1]) { //clear old name
|
||||
delete[] ledmapNames[i-1];
|
||||
ledmapNames[i-1] = nullptr;
|
||||
}
|
||||
#endif
|
||||
|
||||
if (isFile) {
|
||||
ledMaps |= 1 << i;
|
||||
|
||||
#ifndef ESP8266
|
||||
if (requestJSONBufferLock(21)) {
|
||||
if (readObjectFromFile(fileName, nullptr, &doc)) {
|
||||
size_t len = 0;
|
||||
if (!doc["n"].isNull()) {
|
||||
// name field exists
|
||||
const char *name = doc["n"].as<const char*>();
|
||||
if (name != nullptr) len = strlen(name);
|
||||
if (len > 0 && len < 33) {
|
||||
ledmapNames[i-1] = new char[len+1];
|
||||
if (ledmapNames[i-1]) strlcpy(ledmapNames[i-1], name, 33);
|
||||
}
|
||||
}
|
||||
if (!ledmapNames[i-1]) {
|
||||
char tmp[33];
|
||||
snprintf_P(tmp, 32, PSTR("ledmap%d.json"), i);
|
||||
len = strlen(tmp);
|
||||
ledmapNames[i-1] = new char[len+1];
|
||||
if (ledmapNames[i-1]) strlcpy(ledmapNames[i-1], tmp, 33);
|
||||
}
|
||||
}
|
||||
releaseJSONBufferLock();
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
}
|
||||
}
|
@ -678,7 +678,14 @@ WLED_GLOBAL WS2812FX strip _INIT(WS2812FX());
|
||||
WLED_GLOBAL BusConfig* busConfigs[WLED_MAX_BUSSES+WLED_MIN_VIRTUAL_BUSSES] _INIT({nullptr}); //temporary, to remember values from network callback until after
|
||||
WLED_GLOBAL bool doInitBusses _INIT(false);
|
||||
WLED_GLOBAL int8_t loadLedmap _INIT(-1);
|
||||
#ifndef ESP8266
|
||||
WLED_GLOBAL char *ledmapNames[WLED_MAX_LEDMAPS-1] _INIT_N(({nullptr}));
|
||||
#endif
|
||||
#if WLED_MAX_LEDMAPS>16
|
||||
WLED_GLOBAL uint32_t ledMaps _INIT(0); // bitfield representation of available ledmaps
|
||||
#else
|
||||
WLED_GLOBAL uint16_t ledMaps _INIT(0); // bitfield representation of available ledmaps
|
||||
#endif
|
||||
|
||||
// Usermod manager
|
||||
WLED_GLOBAL UsermodManager usermods _INIT(UsermodManager());
|
||||
|
Loading…
Reference in New Issue
Block a user