Skip to content

Commit

Permalink
Handle bug in boot loader 1.1 by waiting 100ms
Browse files Browse the repository at this point in the history
Reset currentPage when starting new update
  • Loading branch information
jsphuebner committed Jul 25, 2024
1 parent 2b54dcf commit 9b392c9
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion src/oi_can.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -228,6 +228,9 @@ static void handleUpdate(twai_message_t *rxframe) {
updstate = SEND_SIZE;
DBG_OUTPUT_PORT.printf("Sending ID %" PRIu32 "\r\n", *(uint32_t*)tx_frame.data);
twai_transmit(&tx_frame, pdMS_TO_TICKS(10));

if (rxframe->data[1] < 1) //boot loader with timing quirk, wait 100 ms
delay(100);
}
break;
case SEND_SIZE:
Expand Down Expand Up @@ -317,14 +320,15 @@ static void handleUpdate(twai_message_t *rxframe) {
// Do not exit this state
break;
}

}

int StartUpdate(String fileName) {
updateFile = SPIFFS.open(fileName, "r");
//Reset host processor
setValueSdo(SDO_INDEX_COMMANDS, SDO_CMD_RESET, 1U);
updstate = SEND_MAGIC;
currentPage = 0;
DBG_OUTPUT_PORT.println("Starting Update");

return (updateFile.size() + PAGE_SIZE_BYTES - 1) / PAGE_SIZE_BYTES;
}
Expand Down

0 comments on commit 9b392c9

Please sign in to comment.