mirror of
https://github.com/ArduPilot/ardupilot
synced 2025-01-22 16:48:29 -04:00
AP_Limits: fixed return of AP_Int8 parameters from object
we should return the base type, not the parameter, or callers could use set on the result
This commit is contained in:
parent
fb0f5d46ba
commit
7f79398989
@ -139,12 +139,12 @@ bool AP_Limits::required() {
|
|||||||
|
|
||||||
bool AP_Limits::check_all() {
|
bool AP_Limits::check_all() {
|
||||||
// required=false, means "all"
|
// required=false, means "all"
|
||||||
return (bool) check_triggered(false);
|
return check_triggered(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool AP_Limits::check_required() {
|
bool AP_Limits::check_required() {
|
||||||
// required=true, means "only required modules"
|
// required=true, means "only required modules"
|
||||||
return (bool) check_triggered(true);
|
return check_triggered(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool AP_Limits::check_triggered(bool only_required) {
|
bool AP_Limits::check_triggered(bool only_required) {
|
||||||
@ -176,29 +176,29 @@ bool AP_Limits::check_triggered(bool only_required) {
|
|||||||
|
|
||||||
if (only_required) {
|
if (only_required) {
|
||||||
// just modules that are both required AND triggered. (binary AND)
|
// just modules that are both required AND triggered. (binary AND)
|
||||||
return (bool) (mods_required & mods_triggered);
|
return (mods_required & mods_triggered) != 0;
|
||||||
} else {
|
} else {
|
||||||
return (bool) (mods_triggered);
|
return mods_triggered != 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
AP_Int8 AP_Limits::state() {
|
int8_t AP_Limits::state() {
|
||||||
return _state;
|
return _state.get();
|
||||||
}
|
}
|
||||||
|
|
||||||
AP_Int8 AP_Limits::safetime() {
|
int8_t AP_Limits::safetime() {
|
||||||
return _safetime;
|
return _safetime.get();
|
||||||
}
|
}
|
||||||
|
|
||||||
void AP_Limits::set_state(int s) {
|
void AP_Limits::set_state(int s) {
|
||||||
_state = (int) s;
|
_state.set(s);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
AP_Int8 AP_Limits::channel() {
|
int8_t AP_Limits::channel() {
|
||||||
return _channel;
|
return _channel.get();
|
||||||
}
|
}
|
||||||
|
|
||||||
AP_Int8 AP_Limits::recmode() {
|
int8_t AP_Limits::recmode() {
|
||||||
return _recmode;
|
return _recmode.get();
|
||||||
}
|
}
|
||||||
|
@ -41,10 +41,10 @@ public:
|
|||||||
bool enabled();
|
bool enabled();
|
||||||
bool debug();
|
bool debug();
|
||||||
bool required();
|
bool required();
|
||||||
AP_Int8 state();
|
int8_t state();
|
||||||
AP_Int8 safetime();
|
int8_t safetime();
|
||||||
AP_Int8 channel();
|
int8_t channel();
|
||||||
AP_Int8 recmode();
|
int8_t recmode();
|
||||||
|
|
||||||
// module linked list management methods
|
// module linked list management methods
|
||||||
// pointer to the first module in linked list of modules
|
// pointer to the first module in linked list of modules
|
||||||
|
Loading…
Reference in New Issue
Block a user