Browse Source

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.
mission-4.1.18
Lucas De Marchi 10 years ago committed by Andrew Tridgell
parent
commit
b3da1579c1
  1. 8
      libraries/AP_Notify/ToneAlarm_Linux.cpp
  2. 5
      libraries/AP_Notify/ToneAlarm_Linux.h

8
libraries/AP_Notify/ToneAlarm_Linux.cpp

@ -36,12 +36,12 @@ extern const AP_HAL::HAL& hal; @@ -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) @@ -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;
}

5
libraries/AP_Notify/ToneAlarm_Linux.h

@ -23,9 +23,6 @@ @@ -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: @@ -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…
Cancel
Save