mirror of
https://github.com/paparazzi/paparazzi.git
synced 2026-06-04 05:42:49 +08:00
- [ardrone] daren's mag freeze fix, cleaned up acc. to suggestions
This commit is contained in:
@@ -288,23 +288,22 @@ static void mag_freeze_check(void) {
|
|||||||
|
|
||||||
if (LastMagValue == navdata.mx) {
|
if (LastMagValue == navdata.mx) {
|
||||||
MagFreezeCounter++;
|
MagFreezeCounter++;
|
||||||
// re-initialize the serial port here, in paparazzi this should be ~3 seconds
|
// Re-initialize the serial port here, in paparazzi this should be ~150 ms
|
||||||
// considering it updates at 200 Hz
|
// considering it updates at 200 Hz
|
||||||
if (MagFreezeCounter > 100) { // rathern than 600
|
if (MagFreezeCounter > 30) {
|
||||||
printf("Mag needs resetting, Values are frozen!!! %d , %d \n",LastMagValue, navdata.mx);
|
printf("Mag needs resetting, Values are frozen!!! %d , %d \n", LastMagValue, navdata.mx);
|
||||||
printf("Setting GPIO 177 to reset PIC Navigation Board \n");
|
printf("Setting GPIO 177 to reset PIC Navigation Board \n");
|
||||||
|
|
||||||
// stop acquisition
|
// stop acquisition
|
||||||
uint8_t cmd=0x02;
|
uint8_t cmd=0x02;
|
||||||
navdata_write(&cmd, 1);
|
navdata_write(&cmd, 1);
|
||||||
|
|
||||||
|
// do the navboard reset via GPIOs
|
||||||
system("gpio 177 -d lo 0 &"); // GPIO used to reset PIC
|
system("gpio 177 -d lo 0 &"); // GPIO used to reset PIC
|
||||||
system("gpio 177 -d lo 1 &");
|
system("gpio 177 -d lo 1 &");
|
||||||
|
|
||||||
// wait 20ms to retrieve data
|
// wait 20ms to retrieve data
|
||||||
for (int i=0;i<22;i++)
|
usleep(20000);
|
||||||
{
|
|
||||||
usleep(1000);
|
|
||||||
}
|
|
||||||
|
|
||||||
// restart acquisition
|
// restart acquisition
|
||||||
cmd = 0x01;
|
cmd = 0x01;
|
||||||
|
|||||||
Reference in New Issue
Block a user