Revision 1443
1. Alpha code to trigger the new wireless bootloader from the user program. Not tested
Includes subroutine in the XBee library to reset the XBee's settings
2. New subroutine in the BOM library to more accurately estimate the position of the max reading using weighted average of the readings instead of max reading.
Also roughly estimates distance to BOM-detected robot based on signal strength
xbee.c | ||
---|---|---|
47 | 47 |
|
48 | 48 |
#include <serial.h> |
49 | 49 |
#include <avr/interrupt.h> |
50 |
#include <util/delay.h> |
|
50 | 51 |
|
51 | 52 |
#endif |
52 | 53 |
|
... | ... | |
584 | 585 |
} |
585 | 586 |
|
586 | 587 |
/** |
588 |
* Resets the XBee Modem (including baud rate when on robot) |
|
589 |
* |
|
590 |
* Used for launching bootloader |
|
591 |
**/ |
|
592 |
int xbee_reset(void) |
|
593 |
{ |
|
594 |
#ifdef ROBOT |
|
595 |
xbee_send_modify_at_command("BD", "3"); |
|
596 |
#endif |
|
597 |
xbee_send_read_at_command("FR"); |
|
598 |
// delay 150 ms to wait for reset |
|
599 |
#ifndef ROBOT |
|
600 |
usleep(150000); |
|
601 |
#else |
|
602 |
_delay_ms(150); |
|
603 |
#endif |
|
604 |
|
|
605 |
return 0; |
|
606 |
} |
|
607 |
|
|
608 |
/** |
|
587 | 609 |
* Sends an AT command to read a parameter. |
588 | 610 |
* |
589 | 611 |
* @param command the AT command to send. For exmaple, |
Also available in: Unified diff