|
|
@@ -182,6 +182,27 @@ static void Power_ReadCheck(void *parameter)
|
|
|
rt_thread_delay(1000);
|
|
|
while(1)
|
|
|
{
|
|
|
+
|
|
|
+#if PCB_V1 == 0
|
|
|
+ rt_uint16_t _24v_current_int = moving_average_filter_update(filter,Read_Real_Current());
|
|
|
+ if(_24v_current_int-2430>0)
|
|
|
+ {
|
|
|
+ sprintf(device_status.power,"%.2f",(float)(_24v_current_int-2400)/0.4);
|
|
|
+ }else {
|
|
|
+ sprintf(device_status.power,"0.0");
|
|
|
+ }
|
|
|
+
|
|
|
+ //消除误差
|
|
|
+ if(Read_Heat_Current()-2450<10)
|
|
|
+ {
|
|
|
+ sprintf(device_status.heat_power,"%.f",0.0);
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ //rt_uint16_t _heat_current_int = moving_average_filter_update(filter_hi,Read_Heat_Current());
|
|
|
+ sprintf(device_status.heat_power,"%.2f",(float)(Read_Heat_Current()-2450)/0.1); //2481-2465
|
|
|
+ }
|
|
|
+ #else
|
|
|
sprintf(device_status.power,"%.2f",(float)(moving_average_filter_update(filter, (float)Read_Real_Current()))/100.0*2.5);
|
|
|
//消除误差
|
|
|
if(Read_Heat_Current()-2465<10)
|
|
|
@@ -192,12 +213,14 @@ static void Power_ReadCheck(void *parameter)
|
|
|
{
|
|
|
sprintf(device_status.heat_power,"%.2f",(float)(moving_average_filter_update(filter_hi, Read_Heat_Current())-2465)/0.1); //2481-2465
|
|
|
}
|
|
|
+ #endif
|
|
|
+
|
|
|
//LOG_I("负载电流:%s,加热电流:%s",device_status.power,device_status.heat_power);
|
|
|
|
|
|
if(atof(device_status.voltage)<22.0) //小于22.0V,并且持续10S,欠压
|
|
|
{
|
|
|
bat_cnt++;
|
|
|
- }else if(atof(device_status.voltage)>24.0) //大于24.0V,解除欠压
|
|
|
+ }else if(atof(device_status.voltage)>=24.0) //大于24.0V,解除欠压
|
|
|
{
|
|
|
bat_cnt = 0;
|
|
|
device_status.C01 &= ~(1<<4);
|
|
|
@@ -209,13 +232,9 @@ static void Power_ReadCheck(void *parameter)
|
|
|
device_status.C01 |= (1<<4);
|
|
|
device_status.bat_status = 1; //欠压
|
|
|
}
|
|
|
- #if ROBOT_EN == 0
|
|
|
//rt_sprintf(device_status.voltage,"%d.%02d",filter_voltage()/100,filter_voltage()%100);
|
|
|
sprintf(device_status.voltage,"%.2f",(float)(moving_average_filter_update(filter_v, (float)Read_Real_Voltage()/100)));
|
|
|
- //LOG_D("voltage is:%sV",device_status.voltage);
|
|
|
- sprintf(device_status.fuse_voltage, "%d.%02d",Read_Fuse_Voltage()/100,Read_Fuse_Voltage()%100);
|
|
|
|
|
|
- #endif
|
|
|
rt_thread_mdelay(10);
|
|
|
}
|
|
|
moving_average_filter_free(filter);
|
|
|
@@ -240,7 +259,11 @@ int Read_Real_Current(void)
|
|
|
/* 关闭通道 */
|
|
|
rt_adc_disable(adc_dev, ADC_DEV_CHANNLE_1);
|
|
|
//LOG_D("Read_Real_Current:%d,%d",adc1_value,adc1_value * REFER_VOLTAGE/CONVERT_BITS*15);
|
|
|
+#if PCB_V1 == 0
|
|
|
+ return (adc0_value * REFER_VOLTAGE/CONVERT_BITS*12)+20;
|
|
|
+#else
|
|
|
return (ADC_VOL_BASE * (adc1_value*1.0)/(in_adc_17*1.0))*100000;
|
|
|
+#endif
|
|
|
}
|
|
|
|
|
|
int Read_Heat_Current(void)
|