|
|
|
@ -772,70 +772,6 @@ static void clear_offsets()
@@ -772,70 +772,6 @@ static void clear_offsets()
|
|
|
|
|
compass.save_offsets(); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
/*static int8_t |
|
|
|
|
* setup_mag_offset(uint8_t argc, const Menu::arg *argv) |
|
|
|
|
* { |
|
|
|
|
* Vector3f _offsets; |
|
|
|
|
* |
|
|
|
|
* if (!strcmp_P(argv[1].str, PSTR("c"))) { |
|
|
|
|
* clear_offsets(); |
|
|
|
|
* report_compass(); |
|
|
|
|
* return (0); |
|
|
|
|
* } |
|
|
|
|
* |
|
|
|
|
* print_hit_enter(); |
|
|
|
|
* init_compass(); |
|
|
|
|
* |
|
|
|
|
* int16_t _min[3] = {0,0,0}; |
|
|
|
|
* int16_t _max[3] = {0,0,0}; |
|
|
|
|
* |
|
|
|
|
* compass.read(); |
|
|
|
|
* |
|
|
|
|
* while(1){ |
|
|
|
|
* delay(50); |
|
|
|
|
* float heading; |
|
|
|
|
* |
|
|
|
|
* compass.read(); |
|
|
|
|
* heading = compass.calculate_heading(0,0); // roll = 0, pitch = 0 |
|
|
|
|
* |
|
|
|
|
* if(compass.mag_x < _min[0]) _min[0] = compass.mag_x; |
|
|
|
|
* if(compass.mag_y < _min[1]) _min[1] = compass.mag_y; |
|
|
|
|
* if(compass.mag_z < _min[2]) _min[2] = compass.mag_z; |
|
|
|
|
* |
|
|
|
|
* // capture max |
|
|
|
|
* if(compass.mag_x > _max[0]) _max[0] = compass.mag_x; |
|
|
|
|
* if(compass.mag_y > _max[1]) _max[1] = compass.mag_y; |
|
|
|
|
* if(compass.mag_z > _max[2]) _max[2] = compass.mag_z; |
|
|
|
|
* |
|
|
|
|
* // calculate offsets |
|
|
|
|
* _offsets.x = (float)(_max[0] + _min[0]) / -2; |
|
|
|
|
* _offsets.y = (float)(_max[1] + _min[1]) / -2; |
|
|
|
|
* _offsets.z = (float)(_max[2] + _min[2]) / -2; |
|
|
|
|
* |
|
|
|
|
* // display all to user |
|
|
|
|
* Serial.printf_P(PSTR("Heading: %u, \t (%d, %d, %d), (%4.4f, %4.4f, %4.4f)\n"), |
|
|
|
|
* |
|
|
|
|
* (uint16_t)(wrap_360(ToDeg(heading) * 100)) /100, |
|
|
|
|
* |
|
|
|
|
* compass.mag_x, |
|
|
|
|
* compass.mag_y, |
|
|
|
|
* compass.mag_z, |
|
|
|
|
* |
|
|
|
|
* _offsets.x, |
|
|
|
|
* _offsets.y, |
|
|
|
|
* _offsets.z); |
|
|
|
|
* |
|
|
|
|
* if(Serial.available() > 1){ |
|
|
|
|
* compass.set_offsets(_offsets); |
|
|
|
|
* //compass.set_offsets(mag_offset_x, mag_offset_y, mag_offset_z); |
|
|
|
|
* report_compass(); |
|
|
|
|
* return 0; |
|
|
|
|
* } |
|
|
|
|
* } |
|
|
|
|
* return 0; |
|
|
|
|
* } |
|
|
|
|
*/ |
|
|
|
|
|
|
|
|
|
static int8_t |
|
|
|
|
setup_optflow(uint8_t argc, const Menu::arg *argv) |
|
|
|
|
{ |
|
|
|
|