mirror of https://github.com/rusefi/bldc.git
Backported COMM_SET_BATTERY_CUT
This commit is contained in:
parent
e2d7efeb17
commit
42092c64b1
29
commands.c
29
commands.c
|
@ -989,6 +989,35 @@ void commands_process_packet(unsigned char *data, unsigned int len,
|
|||
}
|
||||
} break;
|
||||
|
||||
case COMM_SET_BATTERY_CUT: {
|
||||
int32_t ind = 0;
|
||||
float start = buffer_get_float32(data, 1e3, &ind);
|
||||
float end = buffer_get_float32(data, 1e3, &ind);
|
||||
bool store = data[ind++];
|
||||
bool fwd_can = data[ind++];
|
||||
|
||||
(void)fwd_can;
|
||||
|
||||
mcconf = *mc_interface_get_configuration();
|
||||
|
||||
if (mcconf.l_battery_cut_start != start || mcconf.l_battery_cut_end != end) {
|
||||
mcconf.l_battery_cut_start = start;
|
||||
mcconf.l_battery_cut_end = end;
|
||||
|
||||
if (store) {
|
||||
conf_general_store_mc_configuration(&mcconf);
|
||||
}
|
||||
|
||||
mc_interface_set_configuration(&mcconf);
|
||||
}
|
||||
|
||||
// Send ack
|
||||
ind = 0;
|
||||
uint8_t send_buffer[50];
|
||||
send_buffer[ind++] = packet_id;
|
||||
reply_func(send_buffer, ind);
|
||||
} break;
|
||||
|
||||
case COMM_SET_CAN_MODE: {
|
||||
int32_t ind = 0;
|
||||
bool store = data[ind++];
|
||||
|
|
Loading…
Reference in New Issue