Skip to content

Commit

Permalink
Merge pull request #630 from OpenHD/consti-dev
Browse files Browse the repository at this point in the history
Next release canidate ;)
  • Loading branch information
Consti10 authored Dec 8, 2023
2 parents f390b4c + 1a12fc1 commit a9ae501
Show file tree
Hide file tree
Showing 19 changed files with 2,009 additions and 1,876 deletions.
11 changes: 8 additions & 3 deletions app/telemetry/action/create_cmd_helper.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,18 @@
// Here we have various util methods to create mavlink_command_long_t commands
namespace cmd::helper{

static mavlink_command_long_t create_cmd_reboot(int target_sysid,int target_compid,bool reboot){
// @Param: companion_computer: If set to true the message generated is for openhd
// otherwise,it is for the FC
static mavlink_command_long_t create_cmd_reboot(int target_sysid,int target_compid,bool reboot,bool companion_computer){
mavlink_command_long_t cmd{};
cmd.target_system=target_sysid;
cmd.target_component=target_compid;
cmd.command=MAV_CMD_PREFLIGHT_REBOOT_SHUTDOWN;
cmd.param1=0;
cmd.param2=(reboot ? 1 : 2);
if(companion_computer){
cmd.param2=(reboot ? 1 : 2);
}else{
cmd.param1=(reboot ? 1 : 2);
}
return cmd;
}

Expand Down
2 changes: 1 addition & 1 deletion app/telemetry/action/fcaction.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -177,7 +177,7 @@ void FCAction::request_home_position_from_fc()
bool FCAction::send_command_reboot(bool reboot)
{
const auto fc_id=MavlinkTelemetry::instance().get_fc_mav_id();
auto command=cmd::helper::create_cmd_reboot(fc_id.sys_id,fc_id.comp_id,reboot);
auto command=cmd::helper::create_cmd_reboot(fc_id.sys_id,fc_id.comp_id,reboot,false);
const auto res=CmdSender::instance().send_command_long_blocking(command);
return res==CmdSender::Result::CMD_SUCCESS;
}
7 changes: 4 additions & 3 deletions app/telemetry/action/ohdaction.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -20,24 +20,25 @@ OHDAction& OHDAction::instance()

bool OHDAction::send_command_reboot_air(bool reboot)
{
auto command=cmd::helper::create_cmd_reboot(OHD_SYS_ID_AIR,MAV_COMP_ID_ONBOARD_COMPUTER,reboot);
auto command=cmd::helper::create_cmd_reboot(OHD_SYS_ID_AIR,MAV_COMP_ID_ONBOARD_COMPUTER,reboot,true);
const auto res=CmdSender::instance().send_command_long_blocking(command);
return res==CmdSender::Result::CMD_SUCCESS;
}

bool OHDAction::send_command_reboot_gnd(bool reboot)
{
auto command=cmd::helper::create_cmd_reboot(OHD_SYS_ID_GROUND,MAV_COMP_ID_ONBOARD_COMPUTER,reboot);
auto command=cmd::helper::create_cmd_reboot(OHD_SYS_ID_GROUND,MAV_COMP_ID_ONBOARD_COMPUTER,reboot,true);
const auto res=CmdSender::instance().send_command_long_blocking(command);
return res==CmdSender::Result::CMD_SUCCESS;
}

bool OHDAction::send_command_analyze_channels_blocking()
bool OHDAction::send_command_analyze_channels_blocking(int freq_bands)
{
mavlink_command_long_t cmd{};
cmd.target_system=OHD_SYS_ID_GROUND;
cmd.target_component=MAV_COMP_ID_ONBOARD_COMPUTER;
cmd.command=OPENHD_CMD_INITIATE_CHANNEL_ANALYZE;
cmd.param1=static_cast<float>(freq_bands);
const auto res=CmdSender::instance().send_command_long_blocking(cmd);
return res==CmdSender::Result::CMD_SUCCESS;
}
Expand Down
2 changes: 1 addition & 1 deletion app/telemetry/action/ohdaction.h
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ class OHDAction : public QObject
Q_INVOKABLE bool send_command_reboot_gnd(bool reboot);

// Sent to the ground unit only
bool send_command_analyze_channels_blocking();
bool send_command_analyze_channels_blocking(int freq_bands);
bool send_command_start_scan_channels_blocking(int freq_bands,int channel_widths);
private:
};
Expand Down
16 changes: 16 additions & 0 deletions app/telemetry/settings/frequencyhelper.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,22 @@ QList<int> FrequencyHelper::get_frequencies(int filter)
return ret;
}

QList<int> FrequencyHelper::filter_frequencies_40mhz_ht40plus_only(QList<int> frequencies)
{
std::vector<uint32_t> frequencies2;
for(auto& freq:frequencies){
frequencies2.push_back(freq);
}
QList<int> ret;
auto channels=openhd::frequencies_to_channels(frequencies2);
for(auto& channel:channels){
if(channel.in_40Mhz_ht40_plus){
ret.push_back(channel.frequency);
}
}
return ret;
}

QList<int> FrequencyHelper::get_frequencies_all_40Mhz()
{
QList<int> ret;
Expand Down
2 changes: 2 additions & 0 deletions app/telemetry/settings/frequencyhelper.h
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,8 @@ class FrequencyHelper : public QObject
static FrequencyHelper &instance();
// Filter: 0 - OpenHD 1-5 only, 1= all 2.4G freq, 2 = all 5.8G freq
Q_INVOKABLE QList<int> get_frequencies(int filter);
Q_INVOKABLE QList<int> filter_frequencies_40mhz_ht40plus_only(QList<int>);

Q_INVOKABLE QList<int> get_frequencies_all_40Mhz();

Q_INVOKABLE bool get_frequency_radar(int frequency_mhz);
Expand Down
19 changes: 18 additions & 1 deletion app/telemetry/settings/pollutionhelper.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,19 @@ QStringList PollutionHelper::pollution_frequencies_int_to_qstringlist(QList<int>
for(auto& freq:frequencies){
std::stringstream ss;
ss<<freq<<"Mhz";
ret.push_back(QString(ss.str().c_str()));
auto pollution=threadsafe_get_pollution_for_frequency(freq);
if(pollution.has_value()){
/*if(pollution.value().n_foreign_packets<1){
ss<<"\nFREE";
}else{
ss<<"\nPOLLUTED";
}*/
ret.push_back(QString(ss.str().c_str()));
}else{
//ss<<" N/A";
//ret.push_back(QString(ss.str().c_str()));
ret.push_back(" ");
}
}
return ret;
}
Expand All @@ -73,6 +85,11 @@ QVariantList PollutionHelper::pollution_frequencies_int_get_pollution(QList<int>
if(normalize){
ret.push_back(static_cast<int>(pollution.value().n_foreign_packets_normalized));
}else{
/*if(pollution.value().n_foreign_packets<1){
ret.push_back(static_cast<int>(0));
}else{
ret.push_back(static_cast<int>(100));
}*/
ret.push_back(static_cast<int>(pollution.value().n_foreign_packets));
}

Expand Down
4 changes: 2 additions & 2 deletions app/telemetry/settings/wblinksettingshelper.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -31,9 +31,9 @@ WBLinkSettingsHelper& WBLinkSettingsHelper::instance()
return tmp;
}

bool WBLinkSettingsHelper::start_analyze_channels()
bool WBLinkSettingsHelper::start_analyze_channels(int freq_bands)
{
if(OHDAction::instance().send_command_analyze_channels_blocking()){
if(OHDAction::instance().send_command_analyze_channels_blocking(freq_bands)){
set_analyze_progress_perc(0);
return true;
}
Expand Down
2 changes: 1 addition & 1 deletion app/telemetry/settings/wblinksettingshelper.h
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ class WBLinkSettingsHelper : public QObject
void validate_and_set_gnd_channel_width_mhz(int channel_width_mhz);
void validate_and_set_air_channel_width_mhz(int channel_width_mhz);
public:
Q_INVOKABLE bool start_analyze_channels();
Q_INVOKABLE bool start_analyze_channels(int freq_bands);
// freq_bands:
// 0: 2.4G and 5.8G
// 1: 2.4G only
Expand Down
2 changes: 1 addition & 1 deletion app/util/qopenhd.h
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ class QOpenHD : public QObject
// Tries to mimic android toast as much as possible
//
Q_INVOKABLE void show_toast(QString message,bool long_toast=false);
L_RO_PROP(QString,version_string,set_version_string,"2.5.2-evo-beta");
L_RO_PROP(QString,version_string,set_version_string,"2.5.3-evo-release");
public:
L_RO_PROP(QString,toast_text,set_toast_text,"NONE");
L_RO_PROP(bool,toast_visible,set_toast_visible,false);
Expand Down
19 changes: 10 additions & 9 deletions qml/qml.qrc
Original file line number Diff line number Diff line change
@@ -1,33 +1,33 @@
<RCC>
<qresource lang="en" prefix="/translations">
<qresource prefix="/translations" lang="en">
<file alias="QOpenHD.qm">../translations/QOpenHD_en.qm</file>
<file>resources/cursors/arrow_512_green.png</file>
<file>resources/cursors/arrow_512_transparent.png</file>
<file>resources/cursors/arrow_512_white.png</file>
<file>resources/cursors/hand_white.png</file>
</qresource>
<qresource lang="de" prefix="/translations">
<qresource prefix="/translations" lang="de">
<file alias="QOpenHD.qm">../translations/QOpenHD_de.qm</file>
</qresource>
<qresource lang="ru" prefix="/translations">
<qresource prefix="/translations" lang="ru">
<file alias="QOpenHD.qm">../translations/QOpenHD_ru.qm</file>
</qresource>
<qresource lang="es" prefix="/translations">
<qresource prefix="/translations" lang="es">
<file alias="QOpenHD.qm">../translations/QOpenHD_es.qm</file>
</qresource>
<qresource lang="fr" prefix="/translations">
<qresource prefix="/translations" lang="fr">
<file alias="QOpenHD.qm">../translations/QOpenHD_fr.qm</file>
</qresource>
<qresource lang="nl" prefix="/translations">
<qresource prefix="/translations" lang="nl">
<file alias="QOpenHD.qm">../translations/QOpenHD_nl.qm</file>
</qresource>
<qresource lang="ro" prefix="/translations">
<qresource prefix="/translations" lang="ro">
<file alias="QOpenHD.qm">../translations/QOpenHD_ro.qm</file>
</qresource>
<qresource lang="it" prefix="/translations">
<qresource prefix="/translations" lang="it">
<file alias="QOpenHD.qm">../translations/QOpenHD_it.qm</file>
</qresource>
<qresource lang="zh" prefix="/translations">
<qresource prefix="/translations" lang="zh">
<file alias="QOpenHD.qm">../translations/QOpenHD_zh.qm</file>
</qresource>
<qresource prefix="/">
Expand Down Expand Up @@ -265,5 +265,6 @@
<file>ui/elements/CardBasic.qml</file>
<file>ui/elements/ButtonIconConnect.qml</file>
<file>ui/elements/SmallHeaderInfoRow.qml</file>
<file>ui/elements/SettingsCategory.qml</file>
</qresource>
</RCC>
Loading

0 comments on commit a9ae501

Please sign in to comment.