Add a poll CAN message.

This commit is contained in:
Vincent Manoukian 2021-08-30 09:39:21 +02:00
parent 31d524f7fa
commit f887c30e86
3 changed files with 11 additions and 2 deletions

View File

@ -1774,6 +1774,14 @@ static void decode_msg(uint32_t eid, uint8_t *data8, int len, bool is_replaced)
}
} break;
case CAN_PACKET_POLL_ROTOR_POS: {
uint8_t buffer[4];
int32_t index = 0;
buffer_append_int32(buffer, (int32_t)(encoder_read_deg() * 100000.0), &index);
comm_can_transmit_eid_replace(data8[0] |
((uint32_t)CAN_PACKET_POLL_ROTOR_POS << 8), (uint8_t*)buffer, 4, true);
}
default:
break;
}

View File

@ -24,7 +24,7 @@
#define FW_VERSION_MAJOR 5
#define FW_VERSION_MINOR 03
// Set to 0 for building a release and iterate during beta test builds
#define FW_TEST_VERSION_NUMBER 50
#define FW_TEST_VERSION_NUMBER 51
#include "datatypes.h"

View File

@ -1105,7 +1105,8 @@ typedef enum {
CAN_PACKET_BMS_AH_WH_CHG_TOTAL,
CAN_PACKET_BMS_AH_WH_DIS_TOTAL,
CAN_PACKET_UPDATE_PID_POS_OFFSET,
CAN_PACKET_MAKE_ENUM_32_BITS = 0xFFFFFFFF
CAN_PACKET_POLL_ROTOR_POS,
CAN_PACKET_MAKE_ENUM_32_BITS = 0xFFFFFFFF,
} CAN_PACKET_ID;
// Logged fault data