joepasquariello / FlasherX

Over-the-air firmware updates for Teensy LC/3.x/4.x/MicroMod
52 stars 14 forks source link

via UART update #5

Closed SudharsanK58 closed 11 months ago

SudharsanK58 commented 1 year ago

I am just a begginner these controller.I have manager to print hex in serial.

void sendHTTPCGET(const char* url) { String command = "AT+HTTPCGET=\"" + String(url) + "\""; espSerial.println(command); }

sendHTTPCGET("https://karthi.ind.in/trynew.hex");

void loop() { static int dataSizeLeft = 0; static bool isInHTTPCGET = false; static String lineBuffer = "";

while (espSerial.available()) { char c = espSerial.read();

if (c != '\n') { lineBuffer += c; // Add the character to the buffer continue; }

// Now we have a complete line String response = lineBuffer; lineBuffer = ""; // Reset the buffer for the next line

response.trim(); // Remove any leading/trailing white spaces or new lines

if (response.startsWith("+HTTPCGET")) { isInHTTPCGET = true;

// Extract the data size from the line int dataSizeIndex = response.indexOf(':') + 1; dataSizeLeft = response.substring(dataSizeIndex, response.indexOf(',')).toInt();

// Extract any data that might be on this line int dataStartIndex = response.indexOf(',') + 1; if (dataStartIndex != -1 && dataStartIndex < response.length()) { String data = response.substring(dataStartIndex); dataSizeLeft -= data.length(); Serial.println(data); } } else if (isInHTTPCGET) { // Print the data directly dataSizeLeft -= response.length();

// Skip printing "OK" if (response != "OK") { Serial.println(response); }

if (dataSizeLeft <= 0) { isInHTTPCGET = false; // Exit from +HTTPCGET part } } } }

From the above lines i have printed the whole hex values in serial but How do i pass these to flasherX.if (user_input == 1) { // serial // read hex file, write new firmware to flash, clean up, reboot update_firmware( serial, serial, buffer_addr, buffer_size ); }.

joepasquariello commented 11 months ago

Sorry, but I cannot answer this question. I hope you found an answer on the PRJC (Teensy) forum.