A27两个不同版本的UI合并到同一个工程
This commit is contained in:
@ -1,5 +1,6 @@
|
||||
#include "awtk.h"
|
||||
#include "can_protocol.h"
|
||||
#include "moto_config.h"
|
||||
|
||||
uint8_t tcs_twinkle = 0;
|
||||
uint8_t tcs_switch = 0;
|
||||
@ -22,33 +23,6 @@ void tcsswitch_event_handing(int *buf){
|
||||
if(tcs_data<=1)
|
||||
tcs_switch = tcs_data;
|
||||
}
|
||||
//101
|
||||
void speed_event_handing(int *buf){
|
||||
uint16_t eng_temp = 0;
|
||||
uint16_t data = 0;
|
||||
uint8_t state_data = 0;
|
||||
double buf_value = 0;
|
||||
*(buf++);
|
||||
*(buf++);
|
||||
*(buf++);
|
||||
*(buf++);
|
||||
|
||||
data = *(buf++) &0xFF;
|
||||
data = (*(buf++)&0xFF) | data<<8;
|
||||
|
||||
buf_value = data;
|
||||
if(buf_value>5280)
|
||||
buf_value = 255;
|
||||
else if(buf_value>2730)
|
||||
buf_value = ((buf_value*0.1)-273);
|
||||
else
|
||||
buf_value = 0;
|
||||
eng_temp = (int)buf_value;
|
||||
Set_sys_can_temp(eng_temp);
|
||||
state_data = *(buf++);
|
||||
Set_sys_can_state(state_data);
|
||||
|
||||
}
|
||||
|
||||
//0xA5
|
||||
void abs_dtc_event_handing(int *buf){
|
||||
@ -71,57 +45,3 @@ void ecu_dtc_event_handing2(int *buf){
|
||||
dtc[0] = *(buf++)&0xFF;
|
||||
Set_can_abs_dtc(dtc);
|
||||
}
|
||||
|
||||
uint8_t dtc_flag = 0;
|
||||
void A59_dtc_event_handing(int *buf){
|
||||
uint32_t sum,sum1,sum2;
|
||||
sum = 0;
|
||||
sum1 = *(buf++)&0xFF;
|
||||
*(buf++)&0xFF;
|
||||
sum2 = *(buf++)&0xFF;
|
||||
////低位再前
|
||||
//sum = sum1 | sum2<<8;
|
||||
//高位再前
|
||||
sum = sum1<<8 | sum2;
|
||||
// if (sum !=0)
|
||||
Set_sys_now_defect_code(sum);
|
||||
|
||||
dtc_flag = *(buf++)&0xFF;
|
||||
|
||||
sum = 0;
|
||||
sum1 = *(buf++)&0xFF;
|
||||
*(buf++)&0xFF;
|
||||
sum2 = *(buf++)&0xFF;
|
||||
sum = sum1<<8 | sum2;
|
||||
// if (sum !=0)
|
||||
Set_sys_his_defect_code(sum);
|
||||
|
||||
}
|
||||
|
||||
//101
|
||||
void A59_speed_event_handing(int *buf){
|
||||
uint16_t eng_temp = 0;
|
||||
uint16_t data = 0;
|
||||
uint8_t state_data = 0;
|
||||
double buf_value = 0;
|
||||
*(buf++);
|
||||
*(buf++);
|
||||
*(buf++);
|
||||
*(buf++);
|
||||
|
||||
data = *(buf++) &0xFF;
|
||||
data = (*(buf++)&0xFF) | data<<8;
|
||||
|
||||
buf_value = data;
|
||||
if(buf_value>5280)
|
||||
buf_value = 255;
|
||||
else if(buf_value>2730)
|
||||
buf_value = ((buf_value*0.1)-273);
|
||||
else
|
||||
buf_value = 0;
|
||||
eng_temp = (int)buf_value;
|
||||
Set_sys_can_temp(eng_temp);
|
||||
state_data = *(buf++);
|
||||
Set_sys_can_state(state_data);
|
||||
|
||||
}
|
||||
|
@ -142,4 +142,23 @@ void Moto_gpio_timer(void) {
|
||||
}
|
||||
|
||||
}
|
||||
TimerHandle_t xspeedTimer;
|
||||
|
||||
void vTimerSpeedback(TimerHandle_t xTimer) {
|
||||
speed_convert_mile_calculation();
|
||||
}
|
||||
|
||||
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");
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -448,11 +448,11 @@ int flash_copy_demo(void)
|
||||
printf("start copy flash ok.\n");
|
||||
for(i=0;i<new_appsize/IMAGE_RW_SIZE;i++)
|
||||
{
|
||||
printf("i = %d start read .\r\n",i);
|
||||
// printf("i = %d start read .\r\n",i);
|
||||
sfud_read(sflash, new_appoffset+IMAGE_RW_SIZE*i, IMAGE_RW_SIZE, buf);
|
||||
printf("start erase write .\r\n");
|
||||
// printf("start erase write .\r\n");
|
||||
sfud_erase_write(sflash, imageoff+IMAGE_RW_SIZE*i, IMAGE_RW_SIZE, buf);
|
||||
printf("start erase write ok.\r\n");
|
||||
// printf("start erase write ok.\r\n");
|
||||
Set_sys_pace(i+1);
|
||||
if(i==0)
|
||||
{
|
||||
|
@ -9,13 +9,15 @@
|
||||
#include "board.h"
|
||||
#include "keypad.h"
|
||||
#include "moto_adc.h"
|
||||
#include "moto_config.h"
|
||||
|
||||
|
||||
extern double total_mile;
|
||||
uint8_t data_error_flag = 0;
|
||||
extern uint8_t wifi_time_flag;
|
||||
|
||||
uint32_t flash_trip_mile = 0;
|
||||
uint32_t flash_total_mile = 0;
|
||||
|
||||
#define KEY_DATA_PRESS 0x01 // 短按
|
||||
#define KEY_DATA_LONG_PRESS 0x02 // 长按
|
||||
enum
|
||||
@ -62,6 +64,11 @@ uint8_t getBit4Value(uint8_t count, int bitPosition) {
|
||||
return (count >> bitPosition) & 0xf;
|
||||
}
|
||||
|
||||
// 封装的函数,获取5个bit组合成的值
|
||||
uint8_t getBit5Value(uint8_t count, int bitPosition) {
|
||||
return (count >> bitPosition) & 0x1f;
|
||||
}
|
||||
|
||||
double adc_voltage_calculation(void){
|
||||
double value = 0;
|
||||
|
||||
@ -77,7 +84,7 @@ double adc_voltage_calculation(void){
|
||||
|
||||
//MOTO通讯 设备信息+时间戳解析协议
|
||||
void device_data_analysis(uint8_t *buf){
|
||||
// printf("device information............................................\r\n");
|
||||
printf("device information............................................\r\n");
|
||||
uint8_t data;
|
||||
uint8_t sum1,sum2,sum3,sum4;
|
||||
uint32_t save_total_mile,save_trip_mile;
|
||||
@ -87,12 +94,12 @@ void device_data_analysis(uint8_t *buf){
|
||||
char produce[5] = {0};
|
||||
char mac[6] = {0};
|
||||
data = *(buf++);
|
||||
if(data!=0xAA)
|
||||
return;
|
||||
// if(data!=0xAA)
|
||||
// return;
|
||||
|
||||
data = *(buf++);
|
||||
if(data!=0x55)
|
||||
return;
|
||||
// if(data!=0x55)
|
||||
// return;
|
||||
|
||||
//设备相关信息
|
||||
data = *(buf++);//0x01
|
||||
|
Reference in New Issue
Block a user