AP_Notify: fix wrong boolean check

Check by false instead of checking by -1. Fix the following compiler warning
with gcc 5.1.0:

ardupilot/libraries/AP_Notify/ToneAlarm_Linux.cpp:64:13: warning: comparison of constant '-1' with boolean expression is always false [-Wbool-compare]
     if (err == -1) {
             ^

Also change the initialization code not to use -1.
This commit is contained in:
Lucas De Marchi 2015-06-08 19:39:06 -03:00 committed by Andrew Tridgell
parent bb534c20b5
commit 3f8dab41c4
2 changed files with 4 additions and 4 deletions

View File

@ -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 == -1) {
if (err) {
return;
}

View File

@ -23,9 +23,9 @@
class ToneAlarm_Linux: public NotifyDevice
{
public:
ToneAlarm_Linux():
err(-1)
{}
ToneAlarm_Linux() : err(true)
{ }
/// init - initialised the tone alarm
bool init(void);