Added function to receive the 3 protocol data.

parent 55357371
......@@ -61,8 +61,7 @@ void Com_GUI::SaveProtocolData()
{
//Receive protocol type and its parameters
if (newDataFromPC)
{
newDataFromPC = false;
{
rcvProt[0][prot] = messageFromPC[0];
rcvProt[1][prot] = messageFromPC[1];
rcvParam[0][prot]= ((messageFromPC[3]-1) & 255)<<8 | ((messageFromPC[2])&255);
......@@ -79,18 +78,21 @@ unsigned char Com_GUI::RecvCommandHndlr()
if (messageFromPC[0]=='H' && messageFromPC[1]=='B')
{
ReplyToPC('H', 'B');
newDataFromPC = false;
return 1;
}
else if(messageFromPC[0]=='I' && messageFromPC[1]=='P')
{
digitalWrite(22, HIGH);
ReplyToPC('I', 'R');
newDataFromPC = false;
return 2;
}
else if(messageFromPC[0]=='A' && messageFromPC[1]=='P')
{
digitalWrite(22, LOW);
ReplyToPC('A', 'R');
newDataFromPC = false;
return 3;
}
else
......@@ -99,15 +101,18 @@ unsigned char Com_GUI::RecvCommandHndlr()
prot = 0;
SaveProtocolData();
ReplyToPC('S', 'R');
newDataFromPC = false;
prot++;
//Receive second protocol
SaveProtocolData();
ReplyToPC('S', 'R');
newDataFromPC = false;
prot++;
//Receive third protocol
SaveProtocolData();
prot = 0;
newDataFromPC = false;
ReplyToPC('S', 'R');
prot = 0;
return 4;
}
//else
......
......@@ -25,7 +25,7 @@ class Com_GUI
//void HeartBeat();
//void ParseData();
uint8_t prot = 0;
static const byte buffSize = 40;
static const byte buffSize = 60;
unsigned char messageFromPC[buffSize] = {0};
unsigned char rcvProt[2][3];
uint16_t rcvParam[6][3];
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment