V2.05
重写延时等待函数,解决与模块之间通信间隔有可能过短的问题 修改硬件版本号时自动修改can波特率
This commit is contained in:
@@ -31,12 +31,16 @@ volatile uint16_t JQ_EnFreeBack_Test = 0;
|
||||
static void JQ_CommBegin()
|
||||
{
|
||||
CurrentSampleR_Def;
|
||||
WaitDelayEnd(200);//20ms
|
||||
//WaitDelayEnd(200);//20ms
|
||||
//delay_ms(20);
|
||||
delay_wait_untill_ms(20);
|
||||
}
|
||||
static void JQ_CommEnd()
|
||||
{
|
||||
uint16_t us_temp;
|
||||
StartDelayTime();
|
||||
//StartDelayTime();
|
||||
TimerCount_Off();
|
||||
delay_wait_start();
|
||||
if(JQ_CommEnd_CurEn > 0)
|
||||
{
|
||||
delay_os_ms(10);
|
||||
|
@@ -45,12 +45,16 @@ void XT_FreeBack_Prapare(uint8_t enable_flag)
|
||||
static void XT_CommBegin()
|
||||
{
|
||||
CurrentSampleR_Def;
|
||||
WaitDelayEnd(50);//5ms
|
||||
//WaitDelayEnd(50);//5ms
|
||||
//delay_ms(5);
|
||||
delay_wait_untill_ms(5);
|
||||
}
|
||||
static void XT_CommEnd()
|
||||
{
|
||||
uint16_t us_temp;
|
||||
StartDelayTime();
|
||||
//StartDelayTime();
|
||||
TimerCount_Off();
|
||||
delay_wait_start();
|
||||
if(XT_CommEnd_CurEn > 0)
|
||||
{
|
||||
delay_os_ms(10);
|
||||
@@ -157,7 +161,7 @@ static uint8_t XT_Get_Ack(uint32_t timeoutcnt, uint8_t ConfirmAckCount,uint32_t
|
||||
// }
|
||||
// XT_ADC_BaseValue = (XT_ADC_BaseValue>>6) + XT_FreeBack_Noise;
|
||||
XT_ADC_BaseValue = XT_FreeBack_Noise;
|
||||
while(ul_runtime < timeoutcnt)
|
||||
while(1)
|
||||
{
|
||||
FeekValue = ADC_GetCurADCFast();
|
||||
if(FeekValue >= XT_ADC_BaseValue)
|
||||
@@ -181,12 +185,19 @@ static uint8_t XT_Get_Ack(uint32_t timeoutcnt, uint8_t ConfirmAckCount,uint32_t
|
||||
ul_runtime = 0;
|
||||
}
|
||||
ul_runtime = ul_readtime+ul_runtime;
|
||||
|
||||
if(ul_runtime >= timeoutcnt){
|
||||
// time out
|
||||
rtv = 2;
|
||||
break;
|
||||
}
|
||||
}
|
||||
LED1_Out_Off;
|
||||
XTBUS_IDLE;
|
||||
Power_SetSampleCurrentRange(Current_Max);
|
||||
XT_CommEnd();
|
||||
if(rtv){
|
||||
rtv=!0;
|
||||
}
|
||||
return rtv;
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user