andrewrapp / xbee-arduino

Arduino library for communicating with XBee radios in API mode
GNU General Public License v2.0
334 stars 162 forks source link

XBee::send always escapes #21

Open coderocket opened 8 years ago

coderocket commented 8 years ago

The XBee::send method always escapes the content of the request. As a result when I send messages with an XBee configured for API mode 1,messages that contain bytes with value of 19 never get sent.

nopnop2002 commented 1 year ago

I changed like this:

// std::cout << "checksum is " << static_cast(checksum) << std::endl;

// send checksum
sendByte(checksum, escape);

// send packet (Note: prior to Arduino 1.0 this flushed the incoming buffer, which of course was not so great)
flush();

}


- Xbee.h
/**
 * Sends a XBeeRequest (TX packet) out the serial port
 */
void send(XBeeRequest &request, bool escape=false);
davidsainty commented 1 year ago

The documentation says "To use this library your XBee must be configured in API mode (AP=2)"

nopnop2002 commented 1 year ago

@davidsainty

I am using Xbee S2C.

I have an XB24C, firmware version 4061, and when configured with AP=2 I can't transmit at all.

Setting AP=1 allows 0x11, 0x13, 0x7D, 0x7E to be sent without escaping.

Receiver logging:

payload=b'H\x11\x00H\x13\x00H}\x00H~\x00' 12 <class 'bytes'>
unsigned short data=17 index=3 --> 0x11
unsigned short data=19 index=6 --> 0x13
unsigned short data=125 index=9 --> 0x7D
unsigned short data=126 index=12 --> 0x7E

I think the S2B and S2C firmware behave differently.

xctu-6

davidsainty commented 1 year ago

I have used both S2B and S2C - so I know both do work. I can't spot your problem though, maybe the receiving end isn't handling escaping correctly?