beautypg.com

PNI SeaTRAX User Manual

Page 76

background image

PNI Sensor Corporation

DOC#1018154 r02

SeaTRAX User Manual

Page 71

{

if(mComm) mComm->SendData(frameType, dataPtr, dataLen);

// Ticks is a timer function. 1 tick = 10msec.

mResponseTime = Ticks() + 300;

// Expect a response

within 3 seconds
}
//
// This is called each time this process gets a turn to execute.
//
void SEATRAX::Control()
{

switch(mStep)

{

case 1:

{

UInt8 pkt[kDataCount + 1];

// the compents we are requesting, preceded by the number of
// components being requested

pkt[0] = kDataCount;

pkt[1] = CommProtocol::kHeading;

pkt[2] = CommProtocol::kPitch;

pkt[3] = CommProtocol::kRoll;

pkt[4] = CommProtocol::kTemperature;

SendComm(CommProtocol::kSetDataComponents, pkt,

kDataCount + 1);

// Ticks is a timer function. 1 tick = 10msec.

mTime = Ticks() + 100;

// Taking a sample in 1s.

mStep++;

// go to next step of process

break;

}


case 2:

{

// Ticks is a timer function. 1 tick = 10msec.

if(Ticks() > mTime)

{

// tell the module to take a sample

SendComm(CommProtocol::kGetData);

mTime = Ticks() + 100; // take a sample every

second

mStep++;

}

break;

}

case 3:

{

// Ticks is a timer function. 1 tick = 10msec.

if(Ticks() > mResponseTime)