增加上电自动关闭
This commit is contained in:
parent
e95f4b39b1
commit
2d99ea9494
41
appTask.c
41
appTask.c
@ -12,23 +12,25 @@ uint8_t g_rx_buf[3];
|
||||
|
||||
extern uint16_t g_AdVal[3];
|
||||
|
||||
uint16_t poweron_delay;
|
||||
uint8_t poweron_flag;
|
||||
|
||||
void HardWare_Init(void)
|
||||
{
|
||||
//时基初始化
|
||||
//时基初始化
|
||||
R_TAU0_Channel0_Start();
|
||||
|
||||
//LED初始化
|
||||
//LED初始化
|
||||
FanLED_Ctrl(0);
|
||||
HeatLED_Ctrl(0);
|
||||
//AnmoLED_Ctrl(0);
|
||||
|
||||
//AD 初始化
|
||||
//AD 初始化
|
||||
//R_ADC_Start();
|
||||
//R_ADC_Set_OperationOn();
|
||||
//R_TAU0_Channel1_Start();
|
||||
|
||||
//UART初始化
|
||||
//UART初始化
|
||||
R_UART0_Start();
|
||||
R_UART0_Receive(g_rx_buf,1);
|
||||
}
|
||||
@ -36,6 +38,8 @@ uint8_t uart_sendend;
|
||||
void Variable_Init(void)
|
||||
{
|
||||
uart_sendend = 1;
|
||||
poweron_flag = 0;
|
||||
poweron_delay = 0;
|
||||
}
|
||||
static uint8_t heat_txstate=0,fan_txstate=0,motor_txstate=0,heat_state=0,fan_state=0,motor_state=0;
|
||||
uint8_t g_tx_buf[7] = {0};
|
||||
@ -80,6 +84,16 @@ void UART_Tx_Pro(uint8_t keyid)
|
||||
}
|
||||
}
|
||||
|
||||
void uart_tx_close_all(void)
|
||||
{
|
||||
uint8_t uart_buf[7] = {0x5a,0xa5,0x04,0x00,0x0f,0x00,0x0f};
|
||||
for ( i = 0; i < 7; i++)
|
||||
{
|
||||
g_tx_buf[i] = uart_buf[i];
|
||||
}
|
||||
R_UART0_Send(g_tx_buf,7);
|
||||
}
|
||||
|
||||
uint8_t datacount=0;
|
||||
uint8_t RxTimeoutCount=0;
|
||||
static uint8_t Rxdata[10];
|
||||
@ -121,7 +135,7 @@ void UART_Rx_Pro(uint8_t data)
|
||||
void MsgPro(uint8_t len)
|
||||
{
|
||||
uint8_t i;
|
||||
//不用大屏协议
|
||||
//不用大屏协议
|
||||
uint8_t crc,crcRx;
|
||||
if (len <= 3)
|
||||
{
|
||||
@ -269,7 +283,7 @@ void keyScan(void)//5ms
|
||||
}
|
||||
|
||||
}
|
||||
//持续发送
|
||||
//持续发送
|
||||
|
||||
}
|
||||
|
||||
@ -315,7 +329,20 @@ void AppTask(void)
|
||||
TimeBase100msFlag = 0;
|
||||
|
||||
R_WDT_Restart();
|
||||
|
||||
if (poweron_flag == 0)
|
||||
{
|
||||
poweron_delay++;
|
||||
if (poweron_delay == 20 || poweron_delay == 30)
|
||||
{
|
||||
uart_tx_close_all();
|
||||
}
|
||||
if (poweron_delay >= 30)
|
||||
{
|
||||
poweron_flag = 1;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
if (TimeBase1000msFlag == 1)
|
||||
|
Loading…
x
Reference in New Issue
Block a user