From dda00b50a0ce719785df23bb08584ca7b3724517 Mon Sep 17 00:00:00 2001 From: XANTRONIX Development Date: Mon, 29 Jan 2024 11:34:49 +0000 Subject: [PATCH] =?UTF-8?q?Add=20default=20ambient=20temperature=20to=20da?= =?UTF-8?q?sh2can=20(69=C2=B0F)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- bin/dash2can.c | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/bin/dash2can.c b/bin/dash2can.c index 23e42f6..a3aed86 100644 --- a/bin/dash2can.c +++ b/bin/dash2can.c @@ -43,12 +43,13 @@ static int ev_handler(struct can_frame *frame, void *ctx) { return hexagram_can_if_write(can_if, frame); } -#define SCHEDULE_SLOT_COUNT 5 +#define SCHEDULE_SLOT_COUNT 6 static hexagram_schedule_slot table[SCHEDULE_SLOT_COUNT] = { { 16670, { .can_id = 0x280, .can_dlc = 8 }, ev_handler }, { 16670, { .can_id = 0x288, .can_dlc = 8 }, ev_handler }, { 16670, { .can_id = 0x320, .can_dlc = 8 }, ev_handler }, + { 16670, { .can_id = 0x420, .can_dlc = 8 }, ev_handler }, { 16670, { .can_id = 0x540, .can_dlc = 8 }, ev_handler }, { 16670, { .can_id = 0x5a0, .can_dlc = 8 }, ev_handler }, }; @@ -67,14 +68,14 @@ static void table_update(hexagram_schedule_slot *table, /* Current gear */ if (packet->race.gear == 0) { - table[3].frame.data[7] = 0x30; /* Reverse gear */ + table[4].frame.data[7] = 0x30; /* Reverse gear */ } else { - table[3].frame.data[7] = 0xc | (packet->race.gear + 2) << 4; + table[4].frame.data[7] = 0xc | (packet->race.gear + 2) << 4; } /* Vehicle speed */ - table[4].frame.data[1] = (speed_rps & 0xff00) >> 8; - table[4].frame.data[2] = speed_rps & 0x00ff; + table[5].frame.data[1] = (speed_rps & 0xff00) >> 8; + table[5].frame.data[2] = speed_rps & 0x00ff; } int hexagram_main_dash2can(int argc, char **argv) { @@ -122,6 +123,9 @@ int hexagram_main_dash2can(int argc, char **argv) { /* Fuel status */ table[2].frame.data[2] = 0x0e; + /* Ambient temperature */ + table[3].frame.data[1] = 141; + if ((schedule = hexagram_schedule_create(table, SCHEDULE_SLOT_COUNT, can_if)) == NULL) {