6 #if EFI_WIDEBAND_FIRMWARE_UPDATE && EFI_CAN_SUPPORT
11 #pragma GCC diagnostic push
12 #pragma GCC diagnostic ignored "-Wunused-function"
13 #include "wideband_firmware/for_rusefi/wideband_can.h"
14 #pragma GCC diagnostic pop
18 #include "wideband_firmware/for_rusefi/wideband_image.h"
20 #define EVT_BOOTLOADER_ACK EVENT_MASK(0)
27 chEvtSignal(t, EVT_BOOTLOADER_ACK);
32 return chEvtWaitAnyTimeout(EVT_BOOTLOADER_ACK, TIME_MS2I(1000)) != 0;
43 chEvtGetAndClearEvents(EVT_BOOTLOADER_ACK);
48 efiPrintf(
"***************************************");
49 efiPrintf(
" WIDEBAND FIRMWARE UPDATE");
50 efiPrintf(
"***************************************");
51 efiPrintf(
"Wideband Update: Rebooting to bootloader...");
56 for (
int i = 0; i < 2; i++) {
63 efiPrintf(
"Wideband Update ERROR: Expected ACK from entry to bootloader, didn't get one.");
68 chThdSleepMilliseconds(200);
71 efiPrintf(
"Wideband Update: in update mode, erasing flash...");
79 efiPrintf(
"Wideband Update ERROR: Expected ACK from flash erase command, didn't get one.");
83 size_t totalSize =
sizeof(build_wideband_image_bin);
85 efiPrintf(
"Wideband Update: Flash erased! Sending %d bytes...", totalSize);
88 for (
size_t i = 0; i < totalSize; i += 8) {
91 memcpy(&m[0], build_wideband_image_bin + i, 8);
95 efiPrintf(
"Wideband Update ERROR: Expected ACK from data write, didn't get one.");
100 efiPrintf(
"Wideband Update: Update complete! Rebooting controller.");
114 chEvtGetAndClearEvents(EVT_BOOTLOADER_ACK);
119 efiPrintf(
"***************************************");
120 efiPrintf(
" WIDEBAND INDEX SET");
121 efiPrintf(
"***************************************");
122 efiPrintf(
"Setting all connected widebands to index %d...", index);
130 criticalError(
"Wideband index set failed: no controller detected!");
static float getOrZero(SensorType type)
engine_configuration_s * engineConfiguration
void setWidebandOffset(uint8_t index)
static thread_t * waitingBootloaderThread
void handleWidebandBootloaderAck()
static size_t getWidebandBus()
void updateWidebandFirmware()
bool heaterControlEnabled