|
|
@@ -73,13 +73,14 @@ void can_process_factory_message(can_message_t *can_message){
|
|
|
return;
|
|
|
}else if (item == 3) { //读取gpio状态
|
|
|
encode_u16(response + 3, gpio_get_pin_values());
|
|
|
- rsplen += 4;
|
|
|
+ rsplen += 2;
|
|
|
}else if (item == 4) { // u phase detect
|
|
|
- int count = 20;
|
|
|
+ int count = 200;
|
|
|
float uvw[3] = {0, 0, 0};
|
|
|
s16 uvw_total[3] = {0, 0, 0};
|
|
|
u8 detect = decode_u8((u8 *)can_message->data + 1);
|
|
|
gpio_phase_u_detect(true);
|
|
|
+ delay_ms(50);
|
|
|
while(count-- > 0) {
|
|
|
delay_us(100);
|
|
|
get_uvw_phases_raw(uvw);
|
|
|
@@ -87,9 +88,9 @@ void can_process_factory_message(can_message_t *can_message){
|
|
|
uvw_total[1] += S16Q5(uvw[1]);
|
|
|
uvw_total[2] += S16Q5(uvw[2]);
|
|
|
}
|
|
|
- encode_s16(response + 3, uvw_total[0]/20);
|
|
|
- encode_s16(response + 5, uvw_total[1]/20);
|
|
|
- encode_s16(response + 7, uvw_total[2]/20);
|
|
|
+ encode_s16(response + 3, uvw_total[0]/200);
|
|
|
+ encode_s16(response + 5, uvw_total[1]/200);
|
|
|
+ encode_s16(response + 7, uvw_total[2]/200);
|
|
|
gpio_phase_u_detect(false);
|
|
|
rsplen += 6;
|
|
|
}else if (item == 5) { //phase current test
|