Skip to content

Commit

Permalink
Merge pull request #613 from OpenHD/consti-dev
Browse files Browse the repository at this point in the history
Small improvements
  • Loading branch information
Consti10 authored Nov 21, 2023
2 parents aaba432 + 7a4b890 commit 8a3d886
Show file tree
Hide file tree
Showing 8 changed files with 30 additions and 7 deletions.
9 changes: 8 additions & 1 deletion app/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -204,7 +204,14 @@ int main(int argc, char *argv[]) {

QSettings settings;
qDebug()<<"Storing settings at ["<<settings.fileName()<<"]";

// RPI only - set a smaller default screen scale, for whatever reason thats needed
if(QOpenHD::instance().is_platform_rpi()){
if(!settings.value("qopenhd_custom_default_screen_has_been_set",false).toBool()){
qDebug()<<"Setting initial rpi screen scale";
settings.setValue("qopenhd_custom_default_screen_has_been_set",true);
settings.setValue("global_scale",0.7);
}
}
const int screen_custom_font_dpi = settings.value("screen_custom_font_dpi").toInt();
if (screen_custom_font_dpi) {
QCoreApplication::setAttribute(Qt::AA_DisableHighDpiScaling);
Expand Down
4 changes: 2 additions & 2 deletions app/telemetry/connection/tcp_connection.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
#include <qdebug.h>

static int linux_tcp_socket_try_connect(const std::string remote_ip, const int remote_port,const int timeout_seconds){
qDebug()<<"linux_tcp_socket_try_connect:"<<remote_ip.c_str()<<":"<<remote_port<<" timeout:"<<timeout_seconds<<"s";
//qDebug()<<"linux_tcp_socket_try_connect:"<<remote_ip.c_str()<<":"<<remote_port<<" timeout:"<<timeout_seconds<<"s";
int sockfd=socket(AF_INET, SOCK_STREAM, 0);
if(sockfd<0){
qDebug()<<"Cannot create socket"<<strerror(errno);
Expand Down Expand Up @@ -60,7 +60,7 @@ static int linux_tcp_socket_try_connect(const std::string remote_ip, const int r
socklen_t len = sizeof(so_error);
getsockopt(sockfd, SOL_SOCKET, SO_ERROR, &so_error, &len);
if (so_error != 0) {
qDebug()<<"Any socket error";
//qDebug()<<"Any socket error";
close(sockfd);
return -1;
}
Expand Down
9 changes: 9 additions & 0 deletions app/util/qopenhd.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -294,6 +294,15 @@ bool QOpenHD::is_valid_ip(QString ip)
#endif
}

bool QOpenHD::is_platform_rpi()
{
#ifdef IS_PLATFORM_RPI
return true;
#else
return false;
#endif
}


void QOpenHD::keep_screen_on(bool on)
{
Expand Down
1 change: 1 addition & 0 deletions app/util/qopenhd.h
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,7 @@ class QOpenHD : public QObject
Q_INVOKABLE void sysctl_openhd(int task);

Q_INVOKABLE bool is_valid_ip(QString ip);
Q_INVOKABLE bool is_platform_rpi();
//
// Tries to mimic android toast as much as possible
//
Expand Down
3 changes: 2 additions & 1 deletion app/videostreaming/avcodec/texturerenderer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,8 @@ int TextureRenderer::queue_new_frame_for_display(AVFrame *src_frame)
//std::cout<<"DRMPrimeOut::drmprime_out_display "<<src_frame->width<<"x"<<src_frame->height<<"\n";
if ((src_frame->flags & AV_FRAME_FLAG_CORRUPT) != 0) {
//fprintf(stderr, "Discard corrupt frame: fmt=%d, ts=%" PRId64 "\n", src_frame->format, src_frame->pts);
qDebug()<<"Frame corrupt, but forwarding anyways";
// log removed, can also appear on non corrupted frames
//qDebug()<<"Frame corrupt, but forwarding anyways";
//return 0;
}
latest_frame_mutex.lock();
Expand Down
7 changes: 5 additions & 2 deletions qml/ui/configpopup/connect/PaneConnectionMode.qml
Original file line number Diff line number Diff line change
Expand Up @@ -76,9 +76,12 @@ Rectangle{
ListElement { text: "MANUAL UDP" }
ListElement { text: "MANUAL TCP" }
}
onCurrentIndexChanged: {
onActivated: {
if(currentIndex==0 || currentIndex==1 || currentIndex==2){
_mavlinkTelemetry.change_telemetry_connection_mode(currentIndex);
if(settings.qopenhd_mavlink_connection_mode!=currentIndex){
_mavlinkTelemetry.change_telemetry_connection_mode(currentIndex);
settings.qopenhd_mavlink_connection_mode=currentIndex;
}
}
}
currentIndex: settings.qopenhd_mavlink_connection_mode
Expand Down
1 change: 1 addition & 0 deletions qml/ui/configpopup/openhd_settings/LinkQuickPanel.qml
Original file line number Diff line number Diff line change
Expand Up @@ -230,6 +230,7 @@ Rectangle{
TabButton{
text: "5.8G"
}
enabled: comboBoxFreq.enabled
}
Item{ // FILLER
Layout.fillWidth: true
Expand Down
3 changes: 2 additions & 1 deletion qml/ui/widgets/VideoBitrateWidgetGeneric.qml
Original file line number Diff line number Diff line change
Expand Up @@ -110,6 +110,7 @@ BaseWidget {

ListModel{
id: resolutions_model
ListElement {title: "480p@30fps (4:3)"; value: "640x480@30"}
ListElement {title: "480p@60fps (4:3)"; value: "640x480@60"}
ListElement {title: "480p@60fps (16:9)"; value: "848x480@60"}
ListElement {title: "720p@49fps (16:9)"; value: "1280x720@49"}
Expand Down Expand Up @@ -207,7 +208,7 @@ BaseWidget {
const resolution=model.get(currentIndex).value
console.log("Selected resolution: "+resolution);
set_camera_resolution(resolution);
_qopenhd.toast_text("NOTE: OpenHD cannot check if your HW actually supports a given resolution at full frame rate");
_qopenhd.show_toast("NOTE: OpenHD cannot check if your HW actually supports a given resolution / framerate");
}
enabled: _ohdSystemAir.is_alive;
}
Expand Down

0 comments on commit 8a3d886

Please sign in to comment.