Browse Source

AP_SmartAudio: Add configuration_finished and configuration_pending functions

zr-v5.1
giacomo892 4 years ago committed by Andrew Tridgell
parent
commit
4dac9baa09
  1. 13
      libraries/AP_VideoTX/AP_SmartAudio.cpp
  2. 5
      libraries/AP_VideoTX/AP_SmartAudio.h

13
libraries/AP_VideoTX/AP_SmartAudio.cpp

@ -68,6 +68,8 @@ bool AP_SmartAudio::init() @@ -68,6 +68,8 @@ bool AP_SmartAudio::init()
void AP_SmartAudio::loop()
{
AP_VideoTX &vtx = AP::vtx();
while (!hal.scheduler->is_system_initialized()) {
hal.scheduler->delay(100);
}
@ -141,13 +143,15 @@ void AP_SmartAudio::loop() @@ -141,13 +143,15 @@ void AP_SmartAudio::loop()
if (AP::vtx().have_params_changed() ||_vtx_power_change_pending
|| _vtx_freq_change_pending || _vtx_options_change_pending) {
update_vtx_params();
_vtx_gcs_pending = true;
set_configuration_pending(true);
vtx.set_configuration_finished(false);
// we've tried to udpate something, re-request the settings so that they
// are reflected correctly
request_settings();
} else if (_vtx_gcs_pending) {
} else if (is_configuration_pending()) {
AP::vtx().announce_vtx_settings();
_vtx_gcs_pending = false;
set_configuration_pending(false);
vtx.set_configuration_finished(true);
}
}
}
@ -237,9 +241,10 @@ void AP_SmartAudio::update_vtx_params() @@ -237,9 +241,10 @@ void AP_SmartAudio::update_vtx_params()
break;
}
}
} else {
vtx.set_configuration_finished(true);
}
}
/**
* Sends an SmartAudio Command to the vtx, waits response on the update event
* @param frameBuffer frameBuffer to send over the wire

5
libraries/AP_VideoTX/AP_SmartAudio.h

@ -191,7 +191,7 @@ private: @@ -191,7 +191,7 @@ private:
bool _vtx_freq_change_pending; // a vtx command has been issued but not confirmed by a vtx broadcast frame
bool _vtx_power_change_pending;
bool _vtx_options_change_pending;
bool _vtx_gcs_pending;
bool _vtx_changes_pending;
bool _vtx_use_set_freq; // should frequency set by band/channel or frequency
// value for current baud adjust
@ -265,5 +265,8 @@ private: @@ -265,5 +265,8 @@ private:
// change baud automatically when request-response fails many times
void update_baud_rate();
void set_configuration_pending(bool pending) { _vtx_changes_pending = pending; }
bool is_configuration_pending(){ return _vtx_changes_pending;}
};
#endif

Loading…
Cancel
Save