Browse Source

AP_Math: move is_valid_octal into adsb

This doesn't ensure the value is octal digits - there's more magic in
it.
mission-4.1.18
Peter Barker 5 years ago committed by Andrew Tridgell
parent
commit
6fe09b6120
  1. 17
      libraries/AP_Math/AP_Math.cpp
  2. 3
      libraries/AP_Math/AP_Math.h

17
libraries/AP_Math/AP_Math.cpp

@ -321,23 +321,6 @@ Vector3f rand_vec3f(void) @@ -321,23 +321,6 @@ Vector3f rand_vec3f(void)
}
#endif
bool is_valid_octal(uint16_t octal)
{
// treat "octal" as decimal and test if any decimal digit is > 7
if (octal > 7777) {
return false;
} else if (octal % 10 > 7) {
return false;
} else if ((octal % 100)/10 > 7) {
return false;
} else if ((octal % 1000)/100 > 7) {
return false;
} else if ((octal % 10000)/1000 > 7) {
return false;
}
return true;
}
/*
return true if two rotations are equivalent
This copes with the fact that we have some duplicates, like ROLL_180_YAW_90 and PITCH_180_YAW_270

3
libraries/AP_Math/AP_Math.h

@ -274,9 +274,6 @@ float rand_float(void); @@ -274,9 +274,6 @@ float rand_float(void);
// generate a random Vector3f of size 1
Vector3f rand_vec3f(void);
// confirm a value is a valid octal value
bool is_valid_octal(uint16_t octal) WARN_IF_UNUSED;
// return true if two rotations are equal
bool rotation_equal(enum Rotation r1, enum Rotation r2) WARN_IF_UNUSED;

Loading…
Cancel
Save