A59 -V1.1版本提交
This commit is contained in:
@ -11,7 +11,7 @@
|
||||
#include "moto_adc.h"
|
||||
|
||||
|
||||
// uint8_t save_data = 0;
|
||||
uint8_t save_data = 0;
|
||||
|
||||
#define ADC_VPLTAGE_MIN 1666
|
||||
#define ADC_VPLTAGE_MAX 2486
|
||||
@ -20,7 +20,7 @@ int adc_light = 0;
|
||||
int adc_voltage = 0;
|
||||
|
||||
extern uint32_t fml_stamp_to_time(uint32_t timep , uint32_t time[]);
|
||||
extern uint16_t light_buffer[];
|
||||
extern uint8_t light_buffer[];
|
||||
extern double cell_buffer[];
|
||||
extern uint8_t data_storage;
|
||||
extern uint32_t tire_front_time;
|
||||
@ -54,10 +54,10 @@ double adc_voltage_calculation(void){
|
||||
value = 16.5;
|
||||
else
|
||||
value = (adc_voltage - ADC_VPLTAGE_MIN) * (16.5 - 11.0) / (ADC_VPLTAGE_MAX - ADC_VPLTAGE_MIN) + 11.0;
|
||||
printf("adc_voltage = %d value = %lf.\r\n",adc_voltage,value);
|
||||
// printf("adc_voltage = %d value = %lf.\r\n",adc_voltage,value);
|
||||
return value;
|
||||
}
|
||||
extern uint8_t device_flag;
|
||||
|
||||
//MOTO通讯 设备信息+时间戳解析协议
|
||||
void device_data_analysis(uint8_t *buf){
|
||||
DEBUG_PRINT("enter device_data_analysis .\r\n");
|
||||
@ -77,8 +77,7 @@ void device_data_analysis(uint8_t *buf){
|
||||
// DEBUG_PRINT("0x47 -- %02x .\n",data);
|
||||
if(data!=0x47)
|
||||
return;
|
||||
if(!device_flag)
|
||||
device_flag = 1;
|
||||
|
||||
//设备相关信息
|
||||
data = *(buf++);//0x01
|
||||
// DEBUG_PRINT("0x01 -- %02x .\n",data);
|
||||
@ -199,7 +198,7 @@ void device_data_analysis(uint8_t *buf){
|
||||
Set_device_ability(data);
|
||||
|
||||
}
|
||||
|
||||
int test_light = 0;
|
||||
//MOTO通讯协议
|
||||
void data_analysis(uint8_t *buf){
|
||||
uint32_t data;
|
||||
@ -211,7 +210,8 @@ void data_analysis(uint8_t *buf){
|
||||
uint8_t light = 0;
|
||||
double cell = 0;
|
||||
uint8_t sys_state = 0;
|
||||
uint8_t save_data = 0;
|
||||
save_data = 0;
|
||||
|
||||
if(Get_sys_power_on_self_test()==100)
|
||||
sys_state=1;
|
||||
|
||||
@ -279,11 +279,14 @@ void data_analysis(uint8_t *buf){
|
||||
save_data = getBitValue(data,7);
|
||||
|
||||
if(sys_state){
|
||||
// right_led_switch(getBitValue(data,0));
|
||||
// left_led_switch(getBitValue(data,1));
|
||||
right_led_switch(getBitValue(data,0));
|
||||
left_led_switch(getBitValue(data,1));
|
||||
yg_led_switch(getBitValue(data,2));
|
||||
// abs_led_switch(getBitValue(data,4));
|
||||
// eng_led_switch(getBitValue(data,6));
|
||||
#if (MOTO_WARE_HOSE == MOTO_ICMX_A580A)
|
||||
abs_led_switch(getBitValue(data,4));
|
||||
eng_led_switch(getBitValue(data,6));
|
||||
#endif
|
||||
|
||||
}
|
||||
|
||||
//档位
|
||||
@ -343,7 +346,7 @@ void data_analysis(uint8_t *buf){
|
||||
}
|
||||
|
||||
if(save_data){
|
||||
DEBUG_PRINT("save_data.\r\n");
|
||||
// DEBUG_PRINT("save_data.\r\n");
|
||||
// printf("light = %d .\r\n",light);
|
||||
Set_sys_gas(oil);
|
||||
Set_sys_temp(temp);
|
||||
@ -364,8 +367,11 @@ void data_analysis(uint8_t *buf){
|
||||
|
||||
//adc采样光感计算
|
||||
int light_num = (adc_light/10);
|
||||
if(light_num>=100)
|
||||
light_num = 100;
|
||||
test_light = light_num;
|
||||
if(light_num>=200)
|
||||
light_num = 200;
|
||||
if(Get_sys_power_on_self_test()<100)
|
||||
light_num = 10;
|
||||
light_buffer[data_storage] =light_num;
|
||||
data_storage++;
|
||||
if(data_storage>=SAVE_DATA_SIZE){//满足存储大小 计算均值
|
||||
|
Reference in New Issue
Block a user