|
@@ -32,8 +32,8 @@ uint32_t g_poweroff_count = 0; /*
|
|
|
|
|
|
uint8_t g_runstate; //运行状态,切换LED灯光
|
|
|
|
|
|
-uint8_t g_lockstatus = STATUS_UNKOWN;
|
|
|
-uint8_t g_coverstatus = STATUS_COVERCLOSE;
|
|
|
+volatile uint8_t g_lockstatus = STATUS_UNKOWN;
|
|
|
+volatile uint8_t g_coverstatus = STATUS_COVERCLOSE;
|
|
|
|
|
|
//电机状态
|
|
|
uint8_t g_motorstate = MOTOR_INIT;
|
|
@@ -95,21 +95,18 @@ void Process_Init(void)
|
|
|
|
|
|
g_detectTime = 0;
|
|
|
g_runstate = STATE_LOCK;
|
|
|
- g_angleRead_Interval = 500;
|
|
|
+ g_angleRead_Interval = 5;
|
|
|
g_angleRead_Count = 0;
|
|
|
g_ibRead_count =0;
|
|
|
|
|
|
- s_angle = AngleSensor_GetAngle();
|
|
|
- g_lockstatus=get_lockstatus();
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
- g_coverstatus=Gpio_IsOpenCover()>0?STATUS_COVEROPEN:STATUS_COVERCLOSE;
|
|
|
+// s_angle = AngleSensor_GetAngle();
|
|
|
+// g_lockstatus=get_lockstatus();
|
|
|
+// g_coverstatus=Gpio_IsOpenCover()>0?STATUS_COVEROPEN:STATUS_COVERCLOSE;
|
|
|
|
|
|
g_motorstate = MOTOR_READY;
|
|
|
|
|
|
/*上电默认LED点亮.*/
|
|
|
- update_runstate();
|
|
|
+// update_runstate();
|
|
|
}
|
|
|
|
|
|
void Process_RunPrd(void)
|
|
@@ -120,6 +117,9 @@ void Process_RunPrd(void)
|
|
|
{
|
|
|
g_blinkLedTime = 0;
|
|
|
g_blinkLedTgtTime = BLINK_LED_DFTT;
|
|
|
+
|
|
|
+ g_coverstatus=Gpio_IsOpenCover();
|
|
|
+
|
|
|
update_runstate();
|
|
|
|
|
|
switch(g_runstate){
|
|
@@ -192,10 +192,10 @@ void Process_RunPrd(void)
|
|
|
//Storage_CountReduce();
|
|
|
|
|
|
//g_poweroff_count++;
|
|
|
- printf(" opencover : %d \r\n", Gpio_IsOpenCover());
|
|
|
+ printf(" opencover : %d \r\n", g_coverstatus);
|
|
|
|
|
|
|
|
|
- printMotorCurrent();
|
|
|
+ //printMotorCurrent();
|
|
|
|
|
|
//printf(" Battery Voltage:%f V \r\n", getBatteryVoltage());
|
|
|
|
|
@@ -278,8 +278,6 @@ void Process_MotorControl(float angle)
|
|
|
}
|
|
|
|
|
|
g_lockstatus=get_lockstatus();
|
|
|
- g_coverstatus=Gpio_IsOpenCover()>0?STATUS_COVEROPEN:STATUS_COVERCLOSE;
|
|
|
-
|
|
|
|
|
|
//处理开关锁
|
|
|
switch(g_motorstate){
|
|
@@ -429,7 +427,7 @@ uint8_t get_lockstatus(void)
|
|
|
}
|
|
|
|
|
|
|
|
|
-uint8_t Process_GetOilType(void)
|
|
|
+uint16_t Process_GetOilType(void)
|
|
|
{
|
|
|
return IBGet_OilType();
|
|
|
}
|