diff --git a/firmware/hw_layer/kline.cpp b/firmware/hw_layer/kline.cpp index 358fd79e16..3b5f0b3427 100644 --- a/firmware/hw_layer/kline.cpp +++ b/firmware/hw_layer/kline.cpp @@ -34,7 +34,7 @@ void kLineThread(void*) { // a bit of a busy read open question if this would affect performance? // on 2003 Honda for instance the bus seems to be 70%-ish busy. 9600 baud is 1.04ms per byte, a bit below 1kHz ByteSource serialSource = [] (uint8_t * buffer, int maxSize) { - return chnReadTimeout(klDriver,buffer, maxSize, KLINE_READ_TIMEOUT); + return chnReadTimeout(klDriver,buffer, maxSize, TIME_US2I(engineConfiguration->kLinePeriodUs)); }; size_t len = readWhileGives(serialSource, bufferIn, sizeof(bufferIn)); @@ -109,6 +109,11 @@ void initKLine() { #ifdef EFI_KLINE startKLine(); + if (engineConfiguration->kLinePeriodUs == 0) { + engineConfiguration->kLinePeriodUs = 1000 /* us*/; + } + + chThdCreateStatic(klThreadStack, sizeof(klThreadStack), NORMALPRIO + 1, kLineThread, nullptr); addConsoleAction("kline", [](){ efiPrintf("kline totalBytes %d", totalBytes); diff --git a/firmware/hw_layer/kline.h b/firmware/hw_layer/kline.h index 6fcf209f87..df9d998789 100644 --- a/firmware/hw_layer/kline.h +++ b/firmware/hw_layer/kline.h @@ -14,8 +14,6 @@ // The standard transmission rate #define KLINE_BAUD_RATE 10400 -#define KLINE_READ_TIMEOUT TIME_MS2I(2) - void initKLine(); /* Stop/Start for config update */ diff --git a/firmware/integration/rusefi_config.txt b/firmware/integration/rusefi_config.txt index a4db11876e..f10cfa42e8 100644 --- a/firmware/integration/rusefi_config.txt +++ b/firmware/integration/rusefi_config.txt @@ -1582,7 +1582,9 @@ pin_input_mode_e[LUA_DIGITAL_INPUT_COUNT iterate] luaDigitalInputPinModes; CanGpioType canGpioType UiMode uiMode int16_t hpfpPeakPos;Crank angle ATDC of first lobe peak;"deg", 1, 0, -719, 719, 0 -uint8_t[40] mainUnusedEnd;;"units", 1, 0, 0, 1, 0 + int16_t kLinePeriodUs;;"us", 1, 0, 0, 30000, 0 + int16_t unused16 +uint8_t[36] mainUnusedEnd;;"units", 1, 0, 0, 1, 0 ! end of engine_configuration_s end_struct diff --git a/firmware/tunerstudio/rusefi.input b/firmware/tunerstudio/rusefi.input index 05f18caa4b..b1c7b01e25 100644 --- a/firmware/tunerstudio/rusefi.input +++ b/firmware/tunerstudio/rusefi.input @@ -4305,6 +4305,7 @@ dialog = tcuControls, "Transmission Settings" dialog = parkingLot, "Experimental/Broken" field = uiMode, uiMode field = kLineBaudRate, kLineBaudRate + field = kLinePeriodUs, kLinePeriodUs field = canGpioType, canGpioType field = "I understand ECU Locking", yesUnderstandLocking field = "Tune read/write password", tuneHidingKey, { yesUnderstandLocking == 1 }