Browse Source

支持定速巡航设置车速

Signed-off-by: huhui <huhui@sharkgulf.com>
huhui 2 năm trước cách đây
mục cha
commit
d91ed28992
1 tập tin đã thay đổi với 5 bổ sung1 xóa
  1. 5 1
      Applications/foc/commands.c

+ 5 - 1
Applications/foc/commands.c

@@ -98,8 +98,9 @@ static void process_ext_command(foc_cmd_body_t *command) {
 		}
 
 		u16 cruise_spd = decode_u16((u8 *)command->data + 3);
+		sys_debug("crui spd %d\n", cruise_spd);
 		if ((cruise_spd > 0) && (cruise_spd != 0xFFFF)) {
-			mc_set_cruise_speed(true, (float)cruise_spd);
+			mc_set_cruise_speed(true, (float)cruise_spd * 4.0f);
 		}
 		u8 response[8] = {0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF};
 		response[0] &= 0xFC;
@@ -113,6 +114,9 @@ static void process_ext_command(foc_cmd_body_t *command) {
 
 		shark_can0_send_ext_message(0x1A024D43, response, sizeof(response));
 	}else if (command->ext_key == 0x1A05) {
+		u16 idc_lim = decode_u16((u8 *)command->data) / 10;
+		sys_debug("idc %d\n", idc_lim);
+		mc_set_idc_limit((s16)idc_lim);
 		shark_can0_send_ext_message(0x1A054D43, command->data, command->len);
 	}