diff --git a/qml/ui/sidebar/MappedMavlinkChoices.qml b/qml/ui/sidebar/MappedMavlinkChoices.qml index b98df2dea..bd6a6df28 100644 --- a/qml/ui/sidebar/MappedMavlinkChoices.qml +++ b/qml/ui/sidebar/MappedMavlinkChoices.qml @@ -205,7 +205,7 @@ Item { return frequencies_model_with_5180mhz_lowband } return frequencies_model; - else if(param_id=="FREQUENCY_SCAN"){ + }else if(param_id=="FREQUENCY_SCAN"){ return elements_frequency_scan; }else if(param_id=="CHANNEL_WIDTH"){ return elements_model_channel_width; diff --git a/qml/ui/sidebar/MavlinkChoiceElement.qml b/qml/ui/sidebar/MavlinkChoiceElement.qml index 684219526..3f483efcc 100644 --- a/qml/ui/sidebar/MavlinkChoiceElement.qml +++ b/qml/ui/sidebar/MavlinkChoiceElement.qml @@ -26,7 +26,13 @@ BaseJoyEditElement{ property var m_settings_model: _ohdSystemGroundSettings // Int param is much more common, but string param is also possible property bool override_takes_string_param: false - + ListModel{ + id: elements_frequency_scan + ListElement {value: 0; verbose:"OHD"} + ListElement {value: 1; verbose:"5.8"} + ListElement {value: 2; verbose:"2.4"} + ListElement {value: 3; verbose:"ALL"} + } ListModel{ id: elements_model_brightness ListElement {value: 0; verbose:"0%"} @@ -150,6 +156,8 @@ BaseJoyEditElement{ property string m_actual_value_string: "" function get_model(){ + }else if(param_id=="FREQUENCY_SCAN"){ + return elements_frequency_scan; if(m_param_id=="BRIGHTNESS"){ return elements_model_brightness; }else if(m_param_id=="SATURATION"){ diff --git a/qml/ui/sidebar/MavlinkChoiceElement2.qml b/qml/ui/sidebar/MavlinkChoiceElement2.qml index 985b89a47..7be618b3a 100644 --- a/qml/ui/sidebar/MavlinkChoiceElement2.qml +++ b/qml/ui/sidebar/MavlinkChoiceElement2.qml @@ -35,7 +35,7 @@ BaseJoyEditElement2{ // EXTRA property string mPARAM_ID_CHANNEL_WIDTH: "CHANNEL_WIDTH" property string mPARAM_ID_FREQUENCY: "FREQUENCY" - property string mPARAM_ID_FREQUENCY_SCAN: "FREQUENCY_SCAN" + property string mPARAM_ID_FREQUENCY_SCAN: "FREQUENCY_SCAN" // Added frequency scan param property string mPARAM_ID_RATE: "RATE" @@ -120,8 +120,7 @@ BaseJoyEditElement2{ property string populate_display_text:"I SHOULD NEVER APPEAR" function populate(){ - // Don't mind those 3 - if(m_param_id==mPARAM_ID_CHANNEL_WIDTH || m_param_id==mPARAM_ID_FREQUENCY || m_param_id==mPARAM_ID_RATE){ + if(m_param_id==mPARAM_ID_CHANNEL_WIDTH || m_param_id==mPARAM_ID_FREQUENCY || m_param_id==mPARAM_ID_RATE || m_param_id==mPARAM_ID_FREQUENCY_SCAN){ return; } // First, check if the system is alive @@ -190,7 +189,7 @@ BaseJoyEditElement2{ function user_selected_value(value_new){ // A few need to be handled specially - if(m_param_id==mPARAM_ID_FREQUENCY){ + if(m_param_id==mPARAM_ID_FREQUENCY || m_param_id==mPARAM_ID_FREQUENCY_SCAN){ // Added FREQUENCY_SCAN case if(_fcMavlinkSystem.armed){ if(settings.dev_allow_freq_change_when_armed){ // okay @@ -205,6 +204,11 @@ BaseJoyEditElement2{ _qopenhd.set_busy_for_milliseconds(2000,"CHANGING FREQUENCY"); _wbLinkSettingsHelper.change_param_air_and_ground_frequency(value_new) return; + }else if(m_param_id==mPARAM_ID_FREQUENCY_SCAN){ // New logic for FREQUENCY_SCAN + const new_frequency_scan=value_new; + _qopenhd.set_busy_for_milliseconds(2000,"CHANGING FREQ SCAN"); + _wbLinkSettingsHelper.change_param_frequency_scan_async(new_frequency_scan) + return; }else if(m_param_id==mPARAM_ID_CHANNEL_WIDTH){ const channel_width_mhz=value_new; if(!_ohdSystemAir.is_alive){ @@ -243,8 +247,13 @@ BaseJoyEditElement2{ onCurr_bandwidth_mhzChanged: { extra_populate(); } + property bool curr_frequency_scan: false; // Added frequency scan state + onCurr_frequency_scanChanged: { // Handle changes to the frequency scan state + extra_populate(); + } + function extra_populate(){ - if(!(m_param_id==mPARAM_ID_CHANNEL_WIDTH || m_param_id==mPARAM_ID_FREQUENCY || m_param_id==mPARAM_ID_RATE)){ + if(!(m_param_id==mPARAM_ID_CHANNEL_WIDTH || m_param_id==mPARAM_ID_FREQUENCY || m_param_id==mPARAM_ID_RATE || m_param_id==mPARAM_ID_FREQUENCY_SCAN)){ return; } // First, check if the system is alive @@ -278,6 +287,9 @@ BaseJoyEditElement2{ } update_display_text(curr_bandwidth_mhz); m_param_exists=true; + }else if(m_param_id==mPARAM_ID_FREQUENCY_SCAN){ // New logic for FREQUENCY_SCAN + update_display_text(curr_frequency_scan ? "ENABLED" : "DISABLED"); + m_param_exists=true; } }