Skip to content

Commit

Permalink
initial tests
Browse files Browse the repository at this point in the history
  • Loading branch information
raphaelscholle committed Sep 20, 2024
1 parent cba5ee3 commit 773770d
Show file tree
Hide file tree
Showing 3 changed files with 27 additions and 7 deletions.
2 changes: 1 addition & 1 deletion qml/ui/sidebar/MappedMavlinkChoices.qml
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
10 changes: 9 additions & 1 deletion qml/ui/sidebar/MavlinkChoiceElement.qml
Original file line number Diff line number Diff line change
Expand Up @@ -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%"}
Expand Down Expand Up @@ -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"){
Expand Down
22 changes: 17 additions & 5 deletions qml/ui/sidebar/MavlinkChoiceElement2.qml
Original file line number Diff line number Diff line change
Expand Up @@ -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"


Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand All @@ -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){
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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;
}
}

Expand Down

0 comments on commit 773770d

Please sign in to comment.