Skip to content

Commit

Permalink
Disable ASCOM on Qt6 (#3887)
Browse files Browse the repository at this point in the history
* Disable ASCOM on Qt6-based builds
- due to some incomprehensible error apparently out of our hands.
* SUG: Update description of ASCOM support
* Docfixes
  • Loading branch information
gzotti committed Sep 7, 2024
1 parent ec4ce09 commit 91efb8e
Show file tree
Hide file tree
Showing 10 changed files with 49 additions and 32 deletions.
9 changes: 6 additions & 3 deletions guide/plg_atTheTelescope.tex
Original file line number Diff line number Diff line change
Expand Up @@ -514,7 +514,7 @@ \subsection{Abilities and limitations}
their powerful indoor PCs via RemoteDesktop or similar setups. Keep in mind that Stellarium
is a graphics-heavy program that may challenge the outdoor computer's graphics subsystem or network.
See framerate intent settings on page~\pageref{sec:gui:configuration:tools:fps} for optimizing your screen refresh rates.
Better, run Stellarium on your indoor system and use INDI or ASCOM protocols.
Better, run Stellarium on your indoor system and use INDI or ASCOM network protocols.

\subsection{Using this plug-in}
\label{sec:plugins:TelescopeControl:using}
Expand Down Expand Up @@ -921,7 +921,7 @@ \subsection{INDI}
\item IOptron GotoNova Upgrade Kit 8400
\end{itemize}

\subsection{ASCOM (Windows only)}
\subsection{ASCOM (Windows, Qt5-based builds only)}
\label{sec:plugins:TelescopeControl:ASCOM}

\indexterm{ASCOM} \newFeature{0.19.3}is probably the most widely used
Expand All @@ -933,7 +933,10 @@ \subsection{ASCOM (Windows only)}
and most of the astronomy software and tools can communicate with
ASCOM compatible devices.

The ASCOM telescope support has been added to Stellarium's Telescope Control plugin by Gion Kunz in version 0.19.3.
The ASCOM telescope support has been added to Stellarium's Telescope Control plugin by Gion Kunz in version 0.19.3.\footnote{%
Unfortunately traditional ASCOM seems to be incompatible with Qt6.
Starting with version 24.3 ASCOM support is no longer available on Qt6-based builds.
If you depend on ASCOM support, please use a Qt5-based build of the same version.}

Note that in order for Stellarium to communicate with your ASCOM
compatible mount, you will need to have the ASCOM platform installed
Expand Down
11 changes: 7 additions & 4 deletions plugins/TelescopeControl/src/ASCOM/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
if(WIN32)
# Due to incomprehensible errors between ASCOM and Qt6OpenGL!QOpenGL2PaintEngineEx::setState(), we must disable ASCOM in QT6-based builds.
# No other code change related to Qt6 has been done so far, only the ASCOM selector has been greyed out.
# Rather sooner than later ASCOM must be replaced by Alpaca.
if(WIN32 AND (${QT_VERSION_MAJOR} EQUAL "5"))

set(CMAKE_INCLUDE_CURRENT_DIR ON)
set(CMAKE_AUTOMOC ON)
Expand All @@ -11,9 +14,9 @@ SET(TelescopeControl_ASCOM_UIS

IF (${QT_VERSION_MAJOR} EQUAL "5")
QT5_WRAP_UI(TelescopeControl_ASCOM_UIS_H ${TelescopeControl_ASCOM_UIS})
ELSE()
ELSE(${QT_VERSION_MAJOR} EQUAL "5")
QT_WRAP_UI(TelescopeControl_ASCOM_UIS_H ${TelescopeControl_ASCOM_UIS})
ENDIF()
ENDIF(${QT_VERSION_MAJOR} EQUAL "5")

add_library(TelescopeControl_ASCOM STATIC
ASCOMDevice.hpp
Expand All @@ -40,4 +43,4 @@ ENDIF(ENABLE_TESTING)

SET_TARGET_PROPERTIES(TelescopeControl_ASCOM PROPERTIES FOLDER "plugins/TelescopeControl")

ENDIF(WIN32)
ENDIF(WIN32 AND (${QT_VERSION_MAJOR} EQUAL "5"))
13 changes: 7 additions & 6 deletions plugins/TelescopeControl/src/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,9 @@ add_subdirectory(Lx200)
add_subdirectory(NexStar)
add_subdirectory(Rts2)
add_subdirectory(INDI)
if(WIN32)
if(WIN32 AND (${QT_VERSION_MAJOR} EQUAL "5"))
add_subdirectory(ASCOM)
endif(WIN32)
endif(WIN32 AND (${QT_VERSION_MAJOR} EQUAL "5"))

SET(TelescopeControl_RES ../resources/TelescopeControl.qrc)
IF (${QT_VERSION_MAJOR} EQUAL "5")
Expand Down Expand Up @@ -49,10 +49,11 @@ TARGET_LINK_LIBRARIES(TelescopeControl-static
Qt${QT_VERSION_MAJOR}::SerialPort
)

IF(WIN32)
TARGET_LINK_LIBRARIES(TelescopeControl-static
TelescopeControl_ASCOM)
ENDIF(WIN32)
# Due to incomprehensible errors between ASCOM and Qt6OpenGL!QOpenGL2PaintEngineEx::setState(), we must disable in QT6-based builds.
if(WIN32 AND (${QT_VERSION_MAJOR} EQUAL "5"))
#TARGET_LINK_LIBRARIES(TelescopeControl-static
# TelescopeControl_ASCOM)
ENDIF(WIN32 AND (${QT_VERSION_MAJOR} EQUAL "5"))

SET_TARGET_PROPERTIES(TelescopeControl-static PROPERTIES COMPILE_FLAGS "-DQT_STATICPLUGIN")
ADD_DEPENDENCIES(AllStaticPlugins TelescopeControl-static)
Expand Down
6 changes: 4 additions & 2 deletions plugins/TelescopeControl/src/TelescopeClient.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -44,8 +44,10 @@
#include <QTextStream>
#include <QMessageBox>

#ifdef Q_OS_WIN
#if defined(Q_OS_WIN)
#if QT_VERSION<QT_VERSION_CHECK(6,0,0)
#include "ASCOM/TelescopeClientASCOM.hpp"
#endif
#include <Windows.h> // GetSystemTimeAsFileTime()
#else
#include <sys/time.h>
Expand Down Expand Up @@ -103,7 +105,7 @@ TelescopeClient *TelescopeClient::create(const QString &url)
{
newTelescope = new TelescopeClientINDI(name, params);
}
#ifdef Q_OS_WIN
#if defined(Q_OS_WIN) && QT_VERSION<QT_VERSION_CHECK(6,0,0)
else if (type == "ASCOM")
{
newTelescope = new TelescopeClientASCOM(name, params, eq);
Expand Down
4 changes: 2 additions & 2 deletions plugins/TelescopeControl/src/common/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
set(CMAKE_INCLUDE_CURRENT_DIR ON)
set(CMAKE_AUTOMOC ON)

IF(WIN32)
IF(WIN32 AND (${QT_VERSION_MAJOR} EQUAL "5"))
SET(TelescopeControl_ASCOM_common_SRC
ASCOMSupport.hpp
ASCOMSupport.cpp
OLE.hpp
OLE.cpp
)
ENDIF()
ENDIF(WIN32 AND (${QT_VERSION_MAJOR} EQUAL "5"))

add_library(TelescopeControl_common STATIC
LogFile.hpp
Expand Down
6 changes: 5 additions & 1 deletion plugins/TelescopeControl/src/common/Socket.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,11 @@ long long int GetNow(void)
qint64 t;
} tmp;
GetSystemTimeAsFileTime(&tmp.file_time);
t = (tmp.t/10) - 86400000000LL*(369*365+89); // TODO: Explain this magic please!
// convert from NT/NTFS time epoch (1601-01-01 0:00:00 UTC) in μs to UNIX epoch (1970-01-01 0:00:00 UTC) in μs. The difference is:
// 24 hour/day × 3600 s/hour × 10^6 μs/s × ((369×365+89) day).
// Here 369=1970-1601, and 89 is the number of leap years in the interval.
// The division by 10 in the minuend is to convert from 100-nanosecond intervals to microseconds.
t = (tmp.t/10) - 86400000000LL*(369*365+89);
#else
struct timeval tv;
gettimeofday(&tv, 0);
Expand Down
3 changes: 1 addition & 2 deletions plugins/TelescopeControl/src/common/Socket.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -77,8 +77,7 @@ static inline int SetNonblocking(int s)

#endif //Q_OS_WIN

// retrieve system time in milliseconds
// TODO: Specify epoch?
//! retrieve system time in microseconds from the UNIX epoch (1970)
long long int GetNow(void);

class Server;
Expand Down
4 changes: 2 additions & 2 deletions plugins/TelescopeControl/src/gui/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -34,10 +34,10 @@ target_link_libraries(TelescopeControl_gui
TelescopeControl_INDI
)

IF(WIN32)
if(WIN32 AND (${QT_VERSION_MAJOR} EQUAL "5"))
target_link_libraries(TelescopeControl_gui
TelescopeControl_ASCOM
)
ENDIF(WIN32)
ENDif(WIN32 AND (${QT_VERSION_MAJOR} EQUAL "5"))

SET_TARGET_PROPERTIES(TelescopeControl_gui PROPERTIES FOLDER "plugins/TelescopeControl")
19 changes: 12 additions & 7 deletions plugins/TelescopeControl/src/gui/TelescopeConfigurationDialog.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
#include "TelescopeControl.hpp"
#include "ui_telescopeConfigurationDialog.h"

#ifdef Q_OS_WIN
#if defined(Q_OS_WIN) && QT_VERSION<QT_VERSION_CHECK(6,0,0)
#include "../common/ASCOMSupport.hpp"
#endif

Expand Down Expand Up @@ -132,7 +132,7 @@ void TelescopeConfigurationDialog::createDialogContent()
ui->setupUi(dialog);

// ASCOM Telescope client widget needs to be dynamically added in order to make use of preprocessors to exclude for non-windows
#ifdef Q_OS_WIN
#if defined(Q_OS_WIN) && QT_VERSION<QT_VERSION_CHECK(6,0,0)
ascomWidget = new TelescopeClientASCOMWidget(ui->scrollAreaWidgetContents);
ui->ASCOMLayout->addWidget(ascomWidget);

Expand All @@ -155,7 +155,12 @@ void TelescopeConfigurationDialog::createDialogContent()
connect(ui->radioButtonTelescopeRTS2, SIGNAL(toggled(bool)), this, SLOT(toggleTypeRTS2(bool)));
connect(ui->radioButtonTelescopeINDI, SIGNAL(toggled(bool)), this, SLOT(toggleTypeINDI(bool)));
#ifdef Q_OS_WIN
connect(ui->radioButtonTelescopeASCOM, SIGNAL(toggled(bool)), this, SLOT(toggleTypeASCOM(bool)));
#if (QT_VERSION>=QT_VERSION_CHECK(6,0,0))
ui->radioButtonTelescopeASCOM->setToolTip(q_("Disabled due to apparent incompatibility. Please use the Qt5-based build of Stellarium."));
ui->radioButtonTelescopeASCOM->setDisabled(true);
#else
connect(ui->radioButtonTelescopeASCOM, SIGNAL(toggled(bool)), this, SLOT(toggleTypeASCOM(bool)));
#endif
#else
ui->radioButtonTelescopeASCOM->hide();
#endif
Expand Down Expand Up @@ -193,7 +198,7 @@ void TelescopeConfigurationDialog::initConfigurationDialog()
ui->groupBoxDeviceSettings->hide();
ui->groupBoxRTS2Settings->hide();
ui->INDIProperties->hide();
#ifdef Q_OS_WIN
#if defined(Q_OS_WIN) && QT_VERSION<QT_VERSION_CHECK(6,0,0)
ascomWidget->hide();
#endif

Expand Down Expand Up @@ -347,7 +352,7 @@ void TelescopeConfigurationDialog::initExistingTelescopeConfiguration(int slot)
ui->INDIProperties->setPort(portTCP);
ui->INDIProperties->setSelectedDevice(deviceModelName);
}
#ifdef Q_OS_WIN
#if defined(Q_OS_WIN) && QT_VERSION<QT_VERSION_CHECK(6,0,0)
else if (connectionType == TelescopeControl::ConnectionASCOM)
{
ui->radioButtonTelescopeASCOM->setChecked(true);
Expand Down Expand Up @@ -456,7 +461,7 @@ void TelescopeConfigurationDialog::toggleTypeINDI(bool enabled)
ui->INDIProperties->setVisible(enabled);
}

#ifdef Q_OS_WIN
#if defined(Q_OS_WIN) && QT_VERSION<QT_VERSION_CHECK(6,0,0)
void TelescopeConfigurationDialog::toggleTypeASCOM(bool enabled)
{
ascomWidget->setVisible(enabled);
Expand Down Expand Up @@ -545,7 +550,7 @@ void TelescopeConfigurationDialog::buttonSavePressed()
telescopeManager->addTelescopeAtSlot(configuredSlot, type, name, equinox, ui->INDIProperties->host(),
ui->INDIProperties->port(), delay, connectAtStartup, circles, ui->INDIProperties->selectedDevice());
}
#ifdef Q_OS_WIN
#if defined(Q_OS_WIN) && QT_VERSION<QT_VERSION_CHECK(6,0,0)
else if (ui->radioButtonTelescopeASCOM->isChecked())
{
type = TelescopeControl::ConnectionASCOM;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
#include "StelDialog.hpp"
#include "TelescopeControl.hpp"

#ifdef Q_OS_WIN
#if defined(Q_OS_WIN) && QT_VERSION<QT_VERSION_CHECK(6,0,0)
#include "../ASCOM/TelescopeClientASCOMWidget.hpp"
#endif

Expand Down Expand Up @@ -68,7 +68,7 @@ private slots:
void toggleTypeVirtual(bool);
void toggleTypeRTS2(bool);
void toggleTypeINDI(bool enabled);
#ifdef Q_OS_WIN
#if defined(Q_OS_WIN) && QT_VERSION<QT_VERSION_CHECK(6,0,0)
void toggleTypeASCOM(bool enabled);
#endif

Expand All @@ -87,7 +87,7 @@ private slots:
QRegularExpressionValidator * circleListValidator;
QRegularExpressionValidator * serialPortValidator;

#ifdef Q_OS_WIN
#if defined(Q_OS_WIN) && QT_VERSION<QT_VERSION_CHECK(6,0,0)
TelescopeClientASCOMWidget* ascomWidget;
#endif

Expand Down

0 comments on commit 91efb8e

Please sign in to comment.