Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

mpu6000: remove factory test #13227

Merged
merged 1 commit into from
Oct 18, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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