I found a bug in Waspmote API v0.15 when I was trying to set XBee link keys. The API failed to set the key as specified in the code. The bug lies in function gen_data()” in lines 4355-4403. Details below. However, it was corrected in v0.18.
/* Function: Generates the API frame to send to the XBee module Parameters: data : The string that contains part ofthe API frame param : The param to set Returns: Nothing Values: Stores in 'command' variable the API frame to send to the XBee module */ void WaspXBeeCore::gen_data(const char* data, uint8_t* param) { uint8_t inc=0; uint8_t inc2=0; clearCommand(); it=0; while(data[it] != '\0') { inc++; it++; } inc/=2; while(inc211) { for(it=0;it<8;it++) { command[inc-9+it]=param[it]; } } else if(inc==11) { for(it=0;it<3;it++) { command[inc-4+it]=param[it]; } } else if(inc==10) { for(it=0;it<2;it++) { command[inc-3+it]=param[it]; } } else command[inc-2]=param[0]; }
The function in v0.18 is as follows:
/* Function: Generates the API frame to send to the XBee module Parameters: data : The string that contains part of the API frame param : The param to set Returns: Nothing Values: Stores in 'command' variable the API frame to send to the XBee module */ void WaspXBeeCore::gen_data(const char* data, uint8_t* param) { uint8_t inc=0; uint8_t inc2=0; clearCommand(); it=0; while(data[it] != '\0') { inc++; it++; } inc/=2; while(inc2Leave a Comment