Right, so I am starting on a function to send a jpg to the SD in the Nextion display. I am still not sure I understand what’s going on, but my function so far looks like this:
void nextionFunction::sendPicture(int16_t dataSize)
{
// send pkConst.
_serial->print("\x3A\xA1\xBB\x44\x7F\xFF\xFE");
// send pkID. not sure what to send. is this linked to the twfile command so it knows where the data needs to go?
_serial->print("/*???*/");
// send vType. CRC not really needed for starters since data is not all that critical. maybe later
_serial->print("0x00");
// send dataSize. not quite sure what to send. the file size?
_serial->print(dataSize);
// send fileData. not sure what to send. do I send the whole file.read() at once?
_serial->print("/*???*/");
}
The “twfile” command is sent before I call the above function. The twfile command does indeed create a new file with the size that I specified (in bytes). Naturally the file remains empty since it does not yet get filled with data. Funny though, I make a call to create a file with the name “cover.jpg” and get a file called “cover.jpg.tm”. Not sure what .tm means.
There are still a few points that are unclear about how to implement this. It would be great to see a full working example from Nextion.
I’ll keep at it and report progress, but help would of course be appreciated.