mirror of https://github.com/ArduPilot/ardupilot
AP_Notify: rename member to initialized
We are not only checking if there was an error, but if it was already initialized. Let's make it explicit by inverting the value we store.
This commit is contained in:
parent
3f8dab41c4
commit
b3da1579c1
|
@ -36,12 +36,12 @@ extern const AP_HAL::HAL& hal;
|
|||
bool ToneAlarm_Linux::init()
|
||||
{
|
||||
// open the tone alarm device
|
||||
err = !hal.util->toneAlarm_init();
|
||||
if (err) {
|
||||
_initialized = hal.util->toneAlarm_init();
|
||||
if (!_initialized) {
|
||||
hal.console->printf("AP_Notify: Failed to initialise ToneAlarm");
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
// set initial boot states. This prevents us issueing a arming
|
||||
// warning in plane and rover on every boot
|
||||
flags.armed = AP_Notify::flags.armed;
|
||||
|
@ -61,7 +61,7 @@ bool ToneAlarm_Linux::play_tune(uint8_t tune_number)
|
|||
void ToneAlarm_Linux::update()
|
||||
{
|
||||
// exit immediately if we haven't initialised successfully
|
||||
if (err) {
|
||||
if (!_initialized) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
|
@ -23,9 +23,6 @@
|
|||
class ToneAlarm_Linux: public NotifyDevice
|
||||
{
|
||||
public:
|
||||
ToneAlarm_Linux() : err(true)
|
||||
{ }
|
||||
|
||||
/// init - initialised the tone alarm
|
||||
bool init(void);
|
||||
|
||||
|
@ -36,7 +33,7 @@ private:
|
|||
/// play_tune - play one of the pre-defined tunes
|
||||
bool play_tune(uint8_t tune_number);
|
||||
|
||||
bool err;
|
||||
bool _initialized = false;
|
||||
|
||||
/// tonealarm_type - bitmask of states we track
|
||||
struct tonealarm_type {
|
||||
|
|
Loading…
Reference in New Issue