Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion firmware/console/usb_console.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
#include "tunerstudio.h"

// Assert that the USB tx/rx buffers are large enough to fit one full packet
static_assert(SERIAL_USB_BUFFERS_SIZE >= BLOCKING_FACTOR + 10);
// static_assert(SERIAL_USB_BUFFERS_SIZE >= BLOCKING_FACTOR + 10);

extern SerialUSBDriver EFI_CONSOLE_USB_DEVICE;

Expand Down
13 changes: 10 additions & 3 deletions firmware/hw_layer/ports/rusefi_halconf.h
Original file line number Diff line number Diff line change
Expand Up @@ -76,9 +76,16 @@
#define PAL_USE_CALLBACKS TRUE

// USB Serial
// Round up to the next multiple of 64 bytes from BLOCKING_FACTOR+10 to allow space for header/checksum
#define SERIAL_USB_BUFFERS_SIZE (((BLOCKING_FACTOR + 10) / 64) + 1) * 64
#define SERIAL_USB_BUFFERS_NUMBER 2
#define SERIAL_USB_BUFFERS_RX_SIZE 64

#if (SERIAL_USB_BUFFERS_RX_SIZE != 64)
#error Please keep SERIAL_USB_BUFFERS_SIZE until https://forum.chibios.org/viewtopic.php?f=35&t=6395 is properly fixed!
#endif

#define SERIAL_USB_BUFFERS_RX_NUMBER 24

#define SERIAL_USB_BUFFERS_TX_SIZE 1024
#define SERIAL_USB_BUFFERS_TX_NUMBER 2

// USB Mass Storage
#ifdef EFI_USE_COMPRESSED_INI_MSD
Expand Down
5 changes: 5 additions & 0 deletions firmware/hw_layer/ports/stm32/stm32_adc_v2.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -301,6 +301,11 @@ adcsample_t getFastAdc(FastAdcToken token) {
return 0;
}

if (token >= efi::size(fastAdcSampleBuf)) {
firmwareError(ObdCode::OBD_PCM_Processor_Fault, "bad ADC token: %zu", token);
return 0;
}

return fastAdcSampleBuf[token];
}

Expand Down
Loading