Axelman8
Member
Hey there,
I am using the Teensy 4.1 with a peddle-board to control a digital guitar modeler. The board has 18 foot-switches and 15 ST7735 tft screens.
It is working perfectly and blazing fast and now I would like to make use of the SD card sloth.
My question is:
Can I start a function from the SD card and return a value to the program?
WHY?
Because then I would only have to edit the file on the SD card instead of flashing a new version on the Teensy.
Here is an example how it works:
On the modeler there are 1023 preset slots. The "active preset" is between 9 other presets. 0-9, 10-19, 20-29 etc.
To show all 10 preset names that are in the range of the "active preset" on the ST7735 tft screens, I am using a function to get these presetnames from a list.
NOTE: The active preset is called PresetNumb in this function.
Say "activepreset" PresetNumb is 7, then PresetNumb would change to PresetNumb 0, because it is between 0 an 9 in the switch case.
The PresetNumb value of 0 is now passed to another function called preset_Names();
->This function preset_Names(); is the file I would like to switch to the SD card.
The function returns the presetnames for each preset in the range of the PresetNumb to the program.
This works very good because now I am only using/re-using 10 global variables for all 1023 presets (PresetName0 to PresetName9)
The 10 PresetName variables can now be used to print to the tft screens.
It would be a blessing if this function could be started from the SD card.
For any help or advise, thank you in advance!
Cheers
I am using the Teensy 4.1 with a peddle-board to control a digital guitar modeler. The board has 18 foot-switches and 15 ST7735 tft screens.
It is working perfectly and blazing fast and now I would like to make use of the SD card sloth.
My question is:
Can I start a function from the SD card and return a value to the program?
WHY?
Because then I would only have to edit the file on the SD card instead of flashing a new version on the Teensy.
Here is an example how it works:
On the modeler there are 1023 preset slots. The "active preset" is between 9 other presets. 0-9, 10-19, 20-29 etc.
To show all 10 preset names that are in the range of the "active preset" on the ST7735 tft screens, I am using a function to get these presetnames from a list.
NOTE: The active preset is called PresetNumb in this function.
Say "activepreset" PresetNumb is 7, then PresetNumb would change to PresetNumb 0, because it is between 0 an 9 in the switch case.
Code:
void presetRange()
{
debug("\n"); debug("\n"); debug(" * function presetRange started on Preset_range.h");
switch ([COLOR="#800000"]PresetNumb[/COLOR])
{
case 0 ... 9: {PresetNumb = 0;} break; case 10 ... 19: {PresetNumb = 10;} break; case 20 ... 29: {PresetNumb = 20;} break;
case 30 ... 39: {PresetNumb = 30;} break; case 40 ... 49: {PresetNumb = 40;} break; case 50 ... 59:{PresetNumb = 50;} break;
case 60 ... 69: {PresetNumb = 60;} break; case 70 ... 79: {PresetNumb = 70;} break; case 80 ... 89:{PresetNumb = 80;} break;
case 90 ... 99: {PresetNumb = 90;} break;
case 100 ... 109: {PresetNumb = 100;} break; case 110 ... 119: {PresetNumb = 110;} break; case 120 ... 129: {PresetNumb = 120;} break;
case 130 ... 139: {PresetNumb = 130;} break; case 140 ... 149: {PresetNumb = 140;} break; case 150 ... 159: {PresetNumb = 150;} break;
case 160 ... 169: {PresetNumb = 160;} break; case 170 ... 179: {PresetNumb = 170;} break; case 180 ... 189: {PresetNumb = 180;} break;
case 190 ... 199: {PresetNumb = 190;} break; etc.......
}
debug("\n"); debug("\n"); debug(" * function preset_Names called on preset_range.h");
[COLOR="#800000"]preset_Names();[/COLOR]
debug("\n"); debug("\n"); debug(" * function presetRange succesfully loaded on Preset_range.h");
}
The PresetNumb value of 0 is now passed to another function called preset_Names();
->This function preset_Names(); is the file I would like to switch to the SD card.
The function returns the presetnames for each preset in the range of the PresetNumb to the program.
This works very good because now I am only using/re-using 10 global variables for all 1023 presets (PresetName0 to PresetName9)
Code:
void preset_Names(void)
{
debug("\n"); debug(" -> Preset names are beeing read from presets.ini.h");
switch (PresetNumb)
{
case 0:
strcpy(PresetName0,("=/GIFT OF TONE\="));
strcpy(PresetName1,("LT Brown"));
strcpy(PresetName2,("LT Filth"));
strcpy(PresetName3,("LT Clean Amps"));
strcpy(PresetName4,("Mark Day IceCream"));
strcpy(PresetName5,("Fluff Drggd UndR"));
strcpy(PresetName6,("Marco Fanton"));
strcpy(PresetName7,("Chris Traynor"));
strcpy(PresetName8,("Andy Wood tele"));
strcpy(PresetName9,("Andy Wood Lead"));
break;
case 10:
strcpy(PresetName0,("Moke Magic"));
strcpy(PresetName1,("Austin Buddy Liks"));
strcpy(PresetName2,("Austin Buddy Strat"));
strcpy(PresetName3,("Austin Buddy EVH"));
strcpy(PresetName4,("Austin Buddy Vaughan"));
strcpy(PresetName5,("Austin Buddy DualRecto"));
strcpy(PresetName6,("Austin Buddy Machine"));
strcpy(PresetName7,("Cooper Carter"));
strcpy(PresetName8,("Fremen Dumbler"));
strcpy(PresetName9,("Fremen one 4all"));
break;
The 10 PresetName variables can now be used to print to the tft screens.
It would be a blessing if this function could be started from the SD card.
For any help or advise, thank you in advance!
Cheers