Hey there,
I implemented the callback and use it from a pushbutton to print ALL presetNames to a file on my SD. That way I can update the file manually.
It works, but with my code it kinda doesn't work.
When requesting all presetNames, the code stops at the activePreset say preset 50
The program will update all presetNames until 49, then it loads preset 50 again.
When activePreset is 1023 the program will update all presetNames until 1022 and loads 1023
Have made long hours on this one, but havnt found a solution.
Any help is appreciated
Here is my code. I call printAllPresets(); from a pushbutton.
C++:
int presetNumberNames;
void PresetNameCallback(const PresetNumber presetNumber, const char *presetName, const byte length)
{
//To keep the standard of the Fractal export file "preset names.txt" output, I need to edit the presetnumber and add 3 spaces
//The equalisation of presetNumber == presetNumberNames is because this is the only way the program prints all 1023 presetnames
//All other solutions skipped the first 45 to 150 presets, but did print the rest of the 1023 presetNames
if (presetNumber == presetNumberNames)
{
char formattedNumber[5];
snprintf(formattedNumber, sizeof(formattedNumber), "%04d", presetNumber);
debug("\n");
debug(formattedNumber);
debug(" ");
debug(presetName);
presetNumberNames++;
if (presetNumberNames <= 1023) {
Axe.requestPresetName(presetNumberNames);
}
}
}
void printAllPresets()
{
Axe.registerStalePresetNameCallback(PresetNameCallback);
//start at zero
PresetNumber presetNumberNames = 0;
Axe.requestPresetName(presetNumberNames);
}
Cheers