Open
Description
What steps will reproduce the problem?
1. Receiving a 64-bit addressed I/O sample from a Series 1 XBee,
configured with digital channels 0-2 set to digital in, channel 2 set to
analog in, and channel 3 set to digital out.
2. One sample per transmission, transmissions every 10 seconds.
3. The raw hex returned in the X-CTU terminal is as expected: 7E 00 12 82
(8 address bytes) 42 00 01 10 17 00 07 03 FF (checksum byte)
What is the expected output? What do you see instead?
The isDigitalEnabled() function should return all of the enabled channels,
but it just returns those that are 'on'. Also, the analog reading which
should return a 10-bit value always returns 0.
What version of the product are you using? On what operating system?
1. Boarduino (328) and Series 1 XBee on hardware serial port
2. Arduino 17 IDE on WinXP
Please provide any additional information below.
If I change the code in XBee.cpp to make the function return frame data
from getSampleOffset() + 2 instead of 4 and getSampleOffset() + 1 instead
of 3, the digital channels enabled are returned as expected:
bool RxIoSampleBaseResponse::isDigitalEnabled(uint8_t pin) {
if (pin < 8) {
return ((getFrameData()[getSampleOffset() + 2] >> pin) & 1) == 1;
} else {
return (getFrameData()[getSampleOffset() + 1] & 1) == 1;
}
}
I'm not exactly sure where the analog sampling issue is, but my quick and
dirty solution was to comment out the following code, which returns the
correct values:
for (int i = 0; i < pin; i++) {
if (isAnalogEnabled(pin)) {
start+=2;
}
}
PS - Thanks so much for an outstanding piece of work and for sharing it
with everyone!
Original issue reported on code.google.com by [email protected]
on 7 Mar 2010 at 9:32