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) {