No Worries my main concern at the moment is the Midi Parsing section. However to debug parts of the midi parser (and along way to go yet) I added a simple line printer.
void testdrawtext2(char* text, uint16_t color, int myLine) {
//21 characters horizontal, and 153/9= 17, 0-17=18 lines vertical
eraseLine(myLine); //draw a black rectangle on the line in requested
if (myLine < 18) { //only 0-17 lines defined
int x_pos = myLine * 9; //each character is 9pixels high
text[18]=0; //make sure line does not exceed 18 Characters so no wrapping
tft.drawString(0, x_pos, text, color);
}
}
void eraseLine(int myLine) {
for (uint16_t x=tft.width-1; x > 6; x-=6) {
int yPos=myLine * 9;
int endLine = yPos - 8;
tft.fillRect(0,yPos,tft.width-1,9, BLACK);
}
void CharToByte(char* chars, byte* bytes, unsigned int count){
for(unsigned int i = 0; i < count; i++)
bytes[i] = (byte)chars[i];
}
void ByteToChar(byte* bytes, char* chars, unsigned int count){
unsigned int i;
for(i = 0; i < count; i++){
chars[i] = (char)bytes[i];
}
chars[i] =0;
}
}
It "plots" an indexed line of text onto the screen by first drawing a rectangle of black across that line and then writing the text over the top. Pretty simple but it works ![]()
As you can see I have also tried some byte to char conversions with no progress in cracking the display contents.
I suspect the SDFAT routines need a better data structure for returning the folder information (like an array of file names - and mybe it does that already and I can't see it?), more generalised so the program calling it gets better info to work with.
Cheers, Rob