only:hellen-honda-k
This commit is contained in:
parent
dccc738a28
commit
339f088231
|
@ -65,6 +65,17 @@ void configureRusefiLuaUtilHooks(lua_State* l) {
|
|||
return 1;
|
||||
});
|
||||
|
||||
#ifdef EFI_KLINE
|
||||
extern uint8_t kvalues[8];
|
||||
lua_register(l, "temp_k",
|
||||
[](lua_State* l) {
|
||||
auto index = luaL_checkinteger(l, 1);
|
||||
auto value = luaL_checkinteger(l, 2);
|
||||
kvalues[index] = value;
|
||||
return 0;
|
||||
});
|
||||
#endif // EFI_KLINE
|
||||
|
||||
lua_register(l, "findSetting",
|
||||
[](lua_State* l) {
|
||||
auto name = luaL_checklstring(l, 1, nullptr);
|
||||
|
|
|
@ -18,6 +18,8 @@ size_t readWhileGives(ByteSource source, uint8_t *buffer, size_t bufferSize) {
|
|||
|
||||
#ifdef EFI_KLINE
|
||||
|
||||
uint8_t kvalues[8];
|
||||
|
||||
#define HONDA_K_40_PACKET 0x40
|
||||
|
||||
bool kAcRequestState;
|
||||
|
@ -91,16 +93,18 @@ void kLineThread(void*) {
|
|||
|
||||
if (engineConfiguration->kLineDoHondaSend && !ignoreRecentTransmit) {
|
||||
sendCounter++;
|
||||
#define PACKET_SIZE 7
|
||||
const char out2[] = {0x2, 0x0, 0x0, 0x50, 0x0, 0x0, 149};
|
||||
static_assert(sizeof(out2) == PACKET_SIZE);
|
||||
const char outB[] = {0x42, 0x0, 0x0, 0x50, 0x0, 0x0, 164};
|
||||
static_assert(sizeof(outB) == PACKET_SIZE);
|
||||
const char *out = (sendCounter % 3 == 0) ? outB : out2;
|
||||
#define OUT_SIZE 6
|
||||
const uint8_t out2[] = {0x2, 0x0, 0x0, 0x50, 0x0, 0x0};
|
||||
static_assert(sizeof(out2) == OUT_SIZE);
|
||||
const uint8_t outB[] = {0x42, 0x0, 0x0, 0x50, 0x0, 0x0};
|
||||
static_assert(sizeof(outB) == OUT_SIZE);
|
||||
const uint8_t *out = (sendCounter % 3 == 0) ? outB : out2;
|
||||
if (engineConfiguration->verboseKLine) {
|
||||
efiPrintf("kline doSend");
|
||||
}
|
||||
chnWrite(klDriver, (const uint8_t *)out, PACKET_SIZE);
|
||||
chnWrite(klDriver, (const uint8_t *)out, OUT_SIZE);
|
||||
uint8_t crc = crc_hondak_calc(out, OUT_SIZE);
|
||||
chnWrite(klDriver, (const uint8_t *)&crc, 1);
|
||||
ignoreRecentTransmit = true;
|
||||
} else {
|
||||
ignoreRecentTransmit = false;
|
||||
|
@ -168,6 +172,9 @@ void initKLine() {
|
|||
engineConfiguration->kLinePeriodUs = 300 /* us*/;
|
||||
}
|
||||
|
||||
memset(kvalues, 0, sizeof(kvalues));
|
||||
kvalues[0] = 0x2;
|
||||
kvalues[3] = 0x50;
|
||||
|
||||
chThdCreateStatic(klThreadStack, sizeof(klThreadStack), NORMALPRIO + 1, kLineThread, nullptr);
|
||||
addConsoleAction("kline", [](){
|
||||
|
|
Loading…
Reference in New Issue