You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I've tried to use this package to update an second ESP32, atached to the UART1 (Serial1).
So my use-case is the following:
2 ESP's, connected to eachother via UART1.
1 has internet using a LAN-chip and thus connected via wire. The other one is not Wi-Fi capable, so I can't update using wifi, since the device can change location any time.
I want to download the firmware for te second, non internet connected eps32, onto the ethernet connected one. This works as intended.
After that download, I want to send/stream the downloaded file to the other ESP, that does not have internet and after the file got streamed, flash it to the ESP.
What I currently have:
Sender
File readFile = LittleFS.open("/newFirmware.bin");
uint8_t buf[1025] = {};
size_t _len = 256;
serialTransferClient.begin(Serial1);
serialTransferClient.sendDatum("newFirmware.bin"); // Send filenameuint16_t fileSize = readFile.size();
uint16_t numPackets = fileSize / (MAX_PACKET_SIZE - 2); // Reserve two bytes for current file index// Add an extra transmission if neededif (fileSize % MAX_PACKET_SIZE) {
numPackets++;
}
// Send all data within the file across multiple packetsfor (uint16_t i = 0; i < numPackets; i++) {
int len = readFile.read(buf, _len);
uint16_t fileIndex = i * MAX_PACKET_SIZE; // Determine the current file indexuint8_t dataLen = MAX_PACKET_SIZE - 2;
// Determine data length for the last packet if file length is not an exact multiple of MAX_PACKET_SIZE-2if ((fileIndex + (MAX_PACKET_SIZE - 2)) > fileSize) {
dataLen = fileSize - fileIndex;
}
uint8_t sendSize = serialTransferClient.txObj(fileIndex); // Stuff the current file index
sendSize = serialTransferClient.txObj(buf[fileIndex], sendSize, dataLen); // Stuff the current file data
serialTransferClient.sendData(sendSize, 1); // Send the current file index and datadelay(100);
}
Receiver:
serialTransferClient.begin(Serial1);
while (serialTransferClient.available() && !finished) {
if (serialTransferClient.available()) {
if (!serialTransferClient.currentPacketID()) {
serialTransferClient.rxObj("newFirmware.bin");
} elseif (serialTransferClient.currentPacketID() == 1) {
for (uint8_t i = 2; i < serialTransferClient.bytesRead; i++) {
// Serial.print((char)serialTransferClient.packet.rxBuff[i]);
Update.write(serialTransferClient.packet.rxBuff[i], l); // this does not work either...
}
}
}
lastTime = millis();
}
Any help would be really appriciated!
The text was updated successfully, but these errors were encountered:
@cyberdevnet I did, however not by using this package, but by transferring 64bytes each chunk. So I don't have to do specific calculations and buffering. There is room for optimizing this, but I haven't had the time yet.
Hi,
I've tried to use this package to update an second ESP32, atached to the UART1 (Serial1).
So my use-case is the following:
I want to download the firmware for te second, non internet connected eps32, onto the ethernet connected one. This works as intended.
After that download, I want to send/stream the downloaded file to the other ESP, that does not have internet and after the file got streamed, flash it to the ESP.
What I currently have:
Sender
Receiver:
Any help would be really appriciated!
The text was updated successfully, but these errors were encountered: