#include "CommandsDefine.h"
#include "ProjectConfig.h"
#include "Probe.h"
#include "Helper.h"
#include "usart.h"
short Probe_ConnectState;
short Probe_ButtonState;
short Last_Probe_ConnectState = 0xFFFF;
short Last_Probe_ButtonState = 0xFFFF; 

void Timer_ReadBack_ProbeStatus(u8 checkChanged,u8 bIsContentBitInverted_SendBack)
{
#ifndef RUNNING_WHERE_AT_BOOT

		Probe_ConnectState = Probe_GetConnectState();
		Probe_ButtonState = Probe_GetButtonState();
	 
		if(checkChanged == 1 
			&&	Last_Probe_ConnectState==Probe_ConnectState 
			&& Last_Probe_ButtonState==Probe_ButtonState)
		{
			return;
		}	
		
		Last_Probe_ConnectState = Probe_ConnectState;
		Last_Probe_ButtonState = Probe_ButtonState;
		
		u8 dataBytes=2;
		
		USART_WR_BUF[0]= Probe_ConnectState & 0xff;
		USART_WR_BUF[1]= Probe_ButtonState & 0xff;

		USART6_Send(CMD0x31_Request_ReadBack_ProbeStatus,dataBytes,bIsContentBitInverted_SendBack);
		
		Last_Probe_ConnectState = Probe_ConnectState;
		Last_Probe_ButtonState = Probe_ButtonState;
	
#endif	
}
void CMD0x31_Request_ReadBack_ProbeStatus_process(u8 *pData,u16 dataLen,u8 bIsContentBitInverted_Recv,u8 bIsContentBitInverted_SendBack)
{
	Timer_ReadBack_ProbeStatus(1,bIsContentBitInverted_SendBack);
}
