restore MM functionality to not reset segments if 2D settings change!!!

customeffects.js:
- rename downloadCEFile to downloadGHFile
- downloadGHFile: add GH ledmaps folder

FX_fcn.cpp and set.cpp:
- change makeAutoSegments with resetSegments(true)
This commit is contained in:
Ewoud
2023-03-13 21:35:48 +01:00
parent 2f274399f3
commit a0576ba591
5 changed files with 817 additions and 811 deletions

View File

@@ -98,17 +98,18 @@ function populateCEEditor(name, segID)
<textarea class="ceTextarea" id="ceProgramArea">${text}</textarea><br>
<button class="btn infobtn" onclick="toggleCEEditor()">Close</button>
<button class="btn infobtn" onclick="saveCE('${name}.wled', ${segID})">Save and Run</button><br>
<button class="btn infobtn" onclick="downloadCEFile('CE','${name}.wled')">Download ${name}.wled</button>
<button class="btn infobtn" onclick="downloadGHFile('CE','${name}.wled')">Download ${name}.wled</button>
<button class="btn infobtn" onclick="loadCETemplate('${name}')">Load template</button><br>
<button class="btn infobtn" onclick="downloadCEFile('CE','wledv033.json')">Download wled json</button>
<button class="btn infobtn" onclick="downloadCEFile('CE','presets.json')">Download presets.json</button><br>
<button class="btn infobtn" onclick="downloadGHFile('CE','wledv033.json',true,true)">Download wled json</button>
<button class="btn infobtn" onclick="downloadGHFile('CE','presets.json',true,true)">Download presets.json</button><br>
<button class="btn infobtn" onclick="location.href='https://github.com/MoonModules/WLED-Effects/tree/master/CustomEffects/wled'" type="button">Custom Effects Library</button>
<button class="btn infobtn btn-xs" onclick="location.href='https://mm.kno.wled.ge/moonmodules/custom-effects'" type="button">?</button><br>
<br><i>Compile and Run Log</i><br>
<textarea class="ceTextarea" id="ceLogArea"></textarea><br>
<i>Run log > 3 seconds is send to Serial Ouput.</i><br>
<a href="#" onclick="downloadCEFile('HBB','presets.json');return false;" title="Download HBaas Base presets">🥚</a>
<a href="#" onclick="downloadCEFile('HBE','presets.json');return false;" title="Download HBaas Effects presets">🥚</a>`;
<a href="#" onclick="downloadGHFile('HBB','presets.json',true,true);return false;" title="Download HBaas Base presets">🥚</a>
<a href="#" onclick="downloadGHFile('HBE','presets.json',true,true);return false;" title="Download HBaas Effects presets">🥚</a>
<a href="#" onclick="downloadGHFile('LM','presets.json',true,true);return false;" title="Download Ledmap presets">🥚</a>`;
d.getElementById('kceEditor').innerHTML = cn;
@@ -122,14 +123,15 @@ function populateCEEditor(name, segID)
});
}
function downloadCEFile(url, name) {
function downloadGHFile(url, name, save=false, warn=false) { //Githubfile
if (url == "CE") url = "https://raw.githubusercontent.com/MoonModules/WLED-Effects/master/CustomEffects/wled/";
if (url == "HBB") url = "https://raw.githubusercontent.com/MoonModules/WLED-Effects/master/Presets/HB_PresetPack210808_32x32_16seg/Base%20pack/";
if (url == "HBE") url = "https://raw.githubusercontent.com/MoonModules/WLED-Effects/master/Presets/HB_PresetPack210808_32x32_16seg/Effects%20pack/";
if (url == "LM") url = "https://raw.githubusercontent.com/MoonModules/WLED-Effects/master/Ledmaps/";
fetchAndExecute(url, name, function(text) {
if (name == "wledv033.json" || name == "presets.json") {
if (!confirm('Are you sure to download/overwrite ' + name + '?'))
if (save) {
if (warn && !confirm('Are you sure to download/overwrite ' + name + '?'))
return;
uploadFileWithText("/" + name, text);
}
@@ -140,7 +142,7 @@ function downloadCEFile(url, name) {
}
}, function(error){
showToast(error);
console.log(error);
console.log(url + name,error);
});
return;