Skip to content

Commit

Permalink
mpu6000: remove factory test for fmu-v2
Browse files Browse the repository at this point in the history
  • Loading branch information
julianoes authored and dagar committed Oct 18, 2019
1 parent 22c4bb4 commit f9ddbd7
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 1 deletion.
1 change: 1 addition & 0 deletions cmake/px4_add_board.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -218,6 +218,7 @@ function(px4_add_board)

if(CONSTRAINED_FLASH)
set(px4_constrained_flash_build "1" CACHE INTERNAL "constrained flash build" FORCE)
add_definitions(-DCONSTRAINED_FLASH)
endif()

if(TESTING)
Expand Down
2 changes: 2 additions & 0 deletions src/drivers/imu/mpu6000/MPU6000.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -383,6 +383,7 @@ MPU6000::_set_icm_acc_dlpf_filter(uint16_t frequency_hz)
write_checked_reg(ICMREG_ACCEL_CONFIG2, filter);
}

#ifndef CONSTRAINED_FLASH
/*
perform a self-test comparison to factory trim values. This takes
about 200ms and will return OK if the current values are within 14%
Expand Down Expand Up @@ -526,6 +527,7 @@ MPU6000::factory_self_test()

return ret;
}
#endif

/*
deliberately trigger an error in the sensor to trigger recovery
Expand Down
2 changes: 2 additions & 0 deletions src/drivers/imu/mpu6000/MPU6000.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -317,12 +317,14 @@ class MPU6000 : public cdev::CDev, public px4::ScheduledWorkItem

void print_registers();

#ifndef CONSTRAINED_FLASH
/**
* Test behaviour against factory offsets
*
* @return 0 on success, 1 on failure
*/
int factory_self_test();
#endif

// deliberately cause a sensor error
void test_error();
Expand Down
14 changes: 13 additions & 1 deletion src/drivers/imu/mpu6000/mpu6000_main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,9 @@ void reset(enum MPU6000_BUS busid);
void info(enum MPU6000_BUS busid);
void regdump(enum MPU6000_BUS busid);
void testerror(enum MPU6000_BUS busid);
#ifndef CONSTRAINED_FLASH
void factorytest(enum MPU6000_BUS busid);
#endif
void usage();

/**
Expand Down Expand Up @@ -293,6 +295,7 @@ testerror(enum MPU6000_BUS busid)
exit(0);
}

#ifndef CONSTRAINED_FLASH
/**
* Dump the register information
*/
Expand All @@ -310,11 +313,16 @@ factorytest(enum MPU6000_BUS busid)

exit(0);
}
#endif

void
usage()
{
warnx("missing command: try 'start', 'info', 'stop',\n'reset', 'regdump', 'factorytest', 'testerror'");
warnx("missing command: try 'start', 'info', 'stop',\n'reset', 'regdump', 'testerror'"
#ifndef CONSTRAINED_FLASH
", 'factorytest'"
#endif
);
warnx("options:");
warnx(" -X external I2C bus");
warnx(" -I internal I2C bus");
Expand Down Expand Up @@ -421,10 +429,14 @@ mpu6000_main(int argc, char *argv[])
mpu6000::regdump(busid);
}

#ifndef CONSTRAINED_FLASH

if (!strcmp(verb, "factorytest")) {
mpu6000::factorytest(busid);
}

#endif

if (!strcmp(verb, "testerror")) {
mpu6000::testerror(busid);
}
Expand Down

0 comments on commit f9ddbd7

Please sign in to comment.