Revision 348
fixed some warnings in colonet robot code
colonet_dragonfly.c | ||
---|---|---|
24 | 24 |
static UserHandler user_handlers[USER_DEFINED_MSG_TOTAL]; |
25 | 25 |
|
26 | 26 |
/* Internal function prototypes */ |
27 |
static void packet_string_to_struct(ColonetRobotServerPacket* dest_pkt, |
|
28 |
char* pkt_buf); |
|
27 |
static void packet_string_to_struct(ColonetRobotServerPacket* dest_pkt, unsigned char* pkt_buf); |
|
29 | 28 |
static unsigned int two_bytes_to_int(char high, char low); |
30 |
static void colonet_handle_receive(char type, int source, |
|
31 |
unsigned char* packet, int length); |
|
29 |
static void colonet_handle_receive(char type, int source, unsigned char* packet, int length); |
|
32 | 30 |
|
33 | 31 |
static PacketGroupHandler colonet_pgh; |
34 | 32 |
|
... | ... | |
56 | 54 |
* |
57 | 55 |
* @return -1 on error (invalid msgId), 0 on success |
58 | 56 |
*/ |
59 |
static void colonet_handle_receive(char type, int source, unsigned char* packet, |
|
60 |
int length) { |
|
57 |
static void colonet_handle_receive(char type, int source, unsigned char* packet, int length) { |
|
61 | 58 |
ColonetRobotServerPacket pkt; |
62 | 59 |
unsigned char* args; //up to 7 char args |
63 | 60 |
unsigned int int_args[3]; //up to 3 int (2-byte) args |
... | ... | |
170 | 167 |
// Battery |
171 | 168 |
case BATTERY: |
172 | 169 |
usb_puts("Got battery request.\n"); |
170 |
|
|
171 |
/* |
|
173 | 172 |
int xbeeDongleID = 0xA; // too bad this is hard-coded. |
174 | 173 |
char data[20]; |
175 | 174 |
data[0] = 0; // client ID specified in bytes 0-3 |
... | ... | |
186 | 185 |
data[11] = (char) battery8(); // battery reading |
187 | 186 |
data[12] = '\0'; |
188 | 187 |
|
189 |
wl_send_robot_to_robot_global_packet(colonet_pgh.groupCode, COLONET_RESPONSE, |
|
190 |
data, 13, xbeeDongleID, 0); |
|
188 |
wl_send_robot_to_robot_global_packet(colonet_pgh.groupCode, COLONET_RESPONSE, data, 13, xbeeDongleID, 0); |
|
191 | 189 |
usb_puts("lol \n"); |
192 |
|
|
190 |
*/ |
|
193 | 191 |
break; |
194 | 192 |
|
195 | 193 |
case ORB_INIT: |
... | ... | |
235 | 233 |
motors_off(); |
236 | 234 |
break; |
237 | 235 |
case MOVE: |
238 |
buf[40]; |
|
239 | 236 |
sprintf(buf, "calling move with: %d, %d\n", args[0], args[1]); |
240 | 237 |
usb_puts(buf); |
241 | 238 |
move(args[0], args[1]); |
... | ... | |
298 | 295 |
* Adds a user-defined message |
299 | 296 |
*/ |
300 | 297 |
int colonet_add_message(unsigned char msgId, void (*handler)(void)) { |
301 |
if(msgId < USER_DEFINED_MSG_ID_START || msgId > USER_DEFINED_MSG_ID_END){
|
|
298 |
if(msgId < USER_DEFINED_MSG_ID_START /* || msgId > USER_DEFINED_MSG_ID_END */){
|
|
302 | 299 |
return -1; |
303 | 300 |
} |
304 | 301 |
|
... | ... | |
309 | 306 |
return 0; |
310 | 307 |
} |
311 | 308 |
|
312 |
static void packet_string_to_struct(ColonetRobotServerPacket* dest_pkt, |
|
313 |
char* pkt_buf) { |
|
309 |
static void packet_string_to_struct(ColonetRobotServerPacket* dest_pkt, unsigned char* pkt_buf) { |
|
314 | 310 |
memcpy(dest_pkt, pkt_buf, sizeof(ColonetRobotServerPacket)); |
315 | 311 |
} |
316 | 312 |
|
Also available in: Unified diff