//Messages //-- Message boundaries const int cnLowerBroadcastRange = 240; //Message >= 240 are treated as incoming broadcasts (no reply). const int cnUpperCmdRange = 126; //bin 011_1_1110; > 126 = out of upper command range. const int cnLowerCmdRange = 96; //bin 001_1_1111; >= 96 = command. const int cnLowerSetPIDLoopWaitTimeRange = 88; //>= 88 = new PIDLoopWaitTime. Range = 8. const int cnLowerSetPIDGainRange = 64; //>= 64 = new PIDGain value. Range = 24. const int cnLowerSetPIDResetRateRange = 40; //>= 40 = new PIDResetRate value. Range = 24. const int cnLowerSetPIDDerivTimeRange = 16; //>= 16 = new PIDDerivTime value. Range = 24. const int cnTrainPwrRange = 15; //bin 000_0_1111; Power range = 0 ... 15. //-- Broadcast messages const int cnHandshakeOn = 240; //Inbound broadcast message. There is no reply. const int cnHandshakeOff = 241; // -"- //const int cnEmergencyBreak // -"-. Not yet implemented. //-- PBrick error messages const int cnBusy = 224; //outbound error message 224 + 1 = 225 = cnBusy (data_byte is //incremented before transmission). const int cnInvalidDataByte = 225; //Outbound error message 225 + 1 = 226 = invalid databyte //(see above). //-- Train control messages const int cnTrainStop = 96; //bin_011_0_0000. Immediate stop without ramping. //No toggle bit required since stop is only executed once. const int cnTrainLightOff = 97; //bin_011_0_0001. Turn head light on. const int cnTrainLightOn = 98; //bin_011_0_0010. Turn head light off. const int cnTrainSound = 99; //bin_011_0_0011. Generate sound. const int cnTrainSoundT = 100; //Same as above +1 as toggle bit. Required for repeated sound. const int cnPollPBrickData = 101; //bin_011_0_0101. Send out identification byte. //const int cnPollPBrickDataT = 102; //Same as above +1 as toggle bit. Required for repeated poll. const int cnTrainPIDControlOn = 103; //bin_011_0_0101. Turn PID speed control on. const int cnTrainPIDControlOff = 104; //bin_011_0_0110. Trun PID speed control off. //-- Other message protocol constants const int cnMessageTimeOut = 100; //[1 ms ticks]. If second message does not arrive within //cnMessageTimeOut ms, the program resumes.