A270S版本路测100km差1.2km-V0.10版本

This commit is contained in:
2025-03-26 08:32:48 +08:00
parent 157c3dabe4
commit 497f8eb1e1
31 changed files with 58890 additions and 56625 deletions

View File

@ -29,7 +29,8 @@ void grade_key(void){
#ifdef UI_VIEW_QUICKLY_ARRANGE
static uint8_t Gear_value = 7;
#else
uint8_t Gear_value = 7;
// uint8_t Gear_value = 7;
static uint8_t Gear_value = 7;
#endif
static uint8_t cnt =0;
//数据顺序 N 1 2 3 4 5 6 ABS TCS FAN ENG YG R L RMT
@ -137,4 +138,102 @@ void Moto_gpio_timer(void) {
}
}
TimerHandle_t xspeedTimer;
static uint8_t speed_count = 0;
static uint32_t current_timer = 0;
static uint32_t past_timer = 0;
uint8_t time_diff=0;
uint16_t speed_diff=0;
extern uint16_t can_speed;
extern uint16_t diff_can_speed;
extern uint32_t mile_total;
// void can_loss_data_restore(void){
// past_timer = 0;
// }
// void past_timer_refresh(void){
// if(!past_timer){
// past_timer = current_timer;
// return;
// }
// printf("time_diff = %d.\r\n",time_diff);
// time_diff = current_timer-past_timer;
// if(time_diff==1){//相差为1未漏帧
// past_timer = current_timer;
// return;
// }else{
// time_diff-1;
// }
// speed_diff = (uint8_t)((can_speed+diff_can_speed)/2);
// mile_total+= (speed_diff*time_diff);
// past_timer = current_timer;
// }
// extern uint8_t abs_speed_flag;
// volatile uint8_t cnt = 0;
void vTimerSpeedback(TimerHandle_t xTimer) {
// printf("cnt=%d,mile_total=%d,can_speed=%d.\r\n",cnt,mile_total,can_speed);
// if(cnt>=2){
// can_speed =0;
// }else{
// cnt++;
// }
// if(abs_speed_flag){
// mile_total +=can_speed;
// }
// speed_count++;
// if(speed_count>=10){
speed_convert_mile_calculation();
// speed_count = 0;
// }
}
// volatile uint32_t ulHighFrequencyTimerCounts3 = 0;
// static void prvRunTimer_Handler( void *para )
// {
// vTimerClrInt((uint32_t)para);
// // ulHighFrequencyTimerCounts3++;
// // printf("=%d.\r\n",ulHighFrequencyTimerCounts3);
// // printf("cnt=%d,mile_total=%d,can_speed=%d.\r\n",cnt,mile_total,can_speed);
// if(cnt>=2){
// can_speed =0;
// }else{
// cnt++;
// }
// // if(abs_speed_flag){
// mile_total +=can_speed;
// // }
// speed_count++;
// if(speed_count>=10){
// speed_convert_mile_calculation();
// speed_count = 0;
// }
// }
void Moto_speed_timer(void){
xspeedTimer = xTimerCreate("MyspeeSTimer", // 定时器名称
pdMS_TO_TICKS(100), // 定时器周期1000毫秒
pdTRUE, // 自动重载定时器
(void *)0, // 定时器 ID
vTimerSpeedback); // 回调函数
// 启动定时器
if (xTimerStart(xspeedTimer, 0) != pdPASS) {
// 启动定时器失败的处理
printf("xTimer error!!!!!!!!!!!!!!!!!.\r\n");
}
// vTimerInit(TIMER_ID3, 1, 1, pdMS_TO_TICKS(100));
// request_irq(TIMER2_IRQn, 1, prvRunTimer_Handler, (void*)TIMER_ID3);
// vTimerEnable(TIMER_ID3);
}