Hello all. I have a dual VESC 6 controller. I need several ADC inputs as well as digital inputs, so I have not enought in the master controller. I want to use the slave controller inputs, but send their values to the master controller for the control algorithm.
I've seen different funtions like io_board_adc_values *comm_can_get_io_board_adc_1_4_id, but this function gives you the data stored in io_board_adc_1_4. This function is in comm_can.c
Also, in decode_msg, there is a CAN_PACKET_ID (CAN_PACKET_IO_OBARD_ADC_1_TO_4) in which it's read from a CAN packet the values and stored in the previously cited structure io_board_adc_1_4.
In commands.c in commands_process_packet there is a COMM_PACKET_ID (COMM_IO_BOARD_GET_ALL) in which the values stored in the structure io_board_adc_1_4 are sent by CAN, but also io_board_adc_5_8, and io_board_digital_in.
I do not see how is supposed to be used all this functions. I'm coding a function like:
void quat_comm_can_get_adc_io(uint8_t controller_id){
int32_t ind = 0;
uint8_t send_buffer[70];
ind = 0;
buffer_append_float16(send_buffer, ADC_VOLTS(ADC_IND_EXT), 1e2, &ind);
buffer_append_float16(send_buffer, ADC_VOLTS(ADC_IND_EXT2), 1e2, &ind);
buffer_append_float16(send_buffer, ADC_VOLTS(ADC_IND_HM), 1e2, &ind);
buffer_append_float16(send_buffer, ADC_VOLTS(ADC_IND_VIN_SENS), 1e2, &ind);
comm_can_transmit_eid_replace(controller_id |
((uint32_t) CAN_PACKET_IO_BOARD_ADC_1_TO_4 << 8), send_buffer, ind, true);
}
This function will be in the main thread of the slave controller, so these values are sent by CAN to the master controller, and it's supposed that these values will be stored in io_board_adc_1_4 in decode_msg funcion.
The question is: Is this how it is supposed to be used? Is there any other way to transmit these values? Thanks in advance, best regards