Add default ambient temperature to dash2can (69°F)
This commit is contained in:
parent
b89ff5b4a7
commit
dda00b50a0
1 changed files with 9 additions and 5 deletions
|
@ -43,12 +43,13 @@ static int ev_handler(struct can_frame *frame, void *ctx) {
|
||||||
return hexagram_can_if_write(can_if, frame);
|
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] = {
|
static hexagram_schedule_slot table[SCHEDULE_SLOT_COUNT] = {
|
||||||
{ 16670, { .can_id = 0x280, .can_dlc = 8 }, ev_handler },
|
{ 16670, { .can_id = 0x280, .can_dlc = 8 }, ev_handler },
|
||||||
{ 16670, { .can_id = 0x288, .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 = 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 = 0x540, .can_dlc = 8 }, ev_handler },
|
||||||
{ 16670, { .can_id = 0x5a0, .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 */
|
/* Current gear */
|
||||||
if (packet->race.gear == 0) {
|
if (packet->race.gear == 0) {
|
||||||
table[3].frame.data[7] = 0x30; /* Reverse gear */
|
table[4].frame.data[7] = 0x30; /* Reverse gear */
|
||||||
} else {
|
} 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 */
|
/* Vehicle speed */
|
||||||
table[4].frame.data[1] = (speed_rps & 0xff00) >> 8;
|
table[5].frame.data[1] = (speed_rps & 0xff00) >> 8;
|
||||||
table[4].frame.data[2] = speed_rps & 0x00ff;
|
table[5].frame.data[2] = speed_rps & 0x00ff;
|
||||||
}
|
}
|
||||||
|
|
||||||
int hexagram_main_dash2can(int argc, char **argv) {
|
int hexagram_main_dash2can(int argc, char **argv) {
|
||||||
|
@ -122,6 +123,9 @@ int hexagram_main_dash2can(int argc, char **argv) {
|
||||||
/* Fuel status */
|
/* Fuel status */
|
||||||
table[2].frame.data[2] = 0x0e;
|
table[2].frame.data[2] = 0x0e;
|
||||||
|
|
||||||
|
/* Ambient temperature */
|
||||||
|
table[3].frame.data[1] = 141;
|
||||||
|
|
||||||
if ((schedule = hexagram_schedule_create(table,
|
if ((schedule = hexagram_schedule_create(table,
|
||||||
SCHEDULE_SLOT_COUNT,
|
SCHEDULE_SLOT_COUNT,
|
||||||
can_if)) == NULL) {
|
can_if)) == NULL) {
|
||||||
|
|
Loading…
Add table
Reference in a new issue