kine: read packets as packets #5171

progress!
only:hellen-honda-k
This commit is contained in:
rusefi 2023-03-11 08:42:15 -05:00
parent f89a756d15
commit 546276e05b
4 changed files with 10 additions and 4 deletions

View File

@ -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);

View File

@ -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 */

View File

@ -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

View File

@ -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 }