diff --git a/kstars/ekos/auxiliary/weather.h b/kstars/ekos/auxiliary/weather.h --- a/kstars/ekos/auxiliary/weather.h +++ b/kstars/ekos/auxiliary/weather.h @@ -55,6 +55,12 @@ */ Q_SCRIPTABLE quint16 getUpdatePeriod(); + /** + * DBUS interface function. + * @brief Refresh the weather status + */ + Q_SCRIPTABLE bool refresh(); + /** @}*/ /** diff --git a/kstars/ekos/auxiliary/weather.cpp b/kstars/ekos/auxiliary/weather.cpp --- a/kstars/ekos/auxiliary/weather.cpp +++ b/kstars/ekos/auxiliary/weather.cpp @@ -64,4 +64,11 @@ return currentWeather->getUpdatePeriod(); } + +bool Weather::refresh() +{ + return currentWeather->refresh(); + +} + } diff --git a/kstars/ekos/observatory/observatory.cpp b/kstars/ekos/observatory/observatory.cpp --- a/kstars/ekos/observatory/observatory.cpp +++ b/kstars/ekos/observatory/observatory.cpp @@ -522,6 +522,8 @@ setWarningActions(getWeatherModel()->getWarningActions()); setAlertActions(getWeatherModel()->getAlertActions()); weatherStatusTimer.start(1000); + if (getWeatherModel()->refresh() == false) + appendLogText(i18n("Refreshing weather data failed.")); } void Observatory::shutdownWeather() @@ -550,6 +552,12 @@ // add data for the graphs we display if (selectedSensorID == id) { + // display first point in scattered style + if (sensorGraphData[id]->size() == 1) + sensorGraphs->graph()->setScatterStyle(QCPScatterStyle(QCPScatterStyle::ssCircle, QPen(Qt::black, 0), QBrush(Qt::green), 5)); + else + sensorGraphs->graph()->setScatterStyle(QCPScatterStyle(QCPScatterStyle::ssNone)); + // display data point sensorGraphs->graph()->addData(sensorGraphData[id]->last().key, sensorGraphData[id]->last().value); sensorGraphs->rescaleAxes(); diff --git a/kstars/ekos/observatory/observatory.ui b/kstars/ekos/observatory/observatory.ui --- a/kstars/ekos/observatory/observatory.ui +++ b/kstars/ekos/observatory/observatory.ui @@ -17,27 +17,12 @@ - - 3 - - - 3 - - - 3 - - - 3 - - - 3 - - - - 3 + + + Qt::Horizontal - + 3 @@ -47,6 +32,12 @@ false + + + 1 + 0 + + Dome @@ -552,6 +543,12 @@ false + + + 1 + 0 + + Shutter @@ -673,6 +670,12 @@ false + + + 1 + 0 + + Observatory Status @@ -777,361 +780,364 @@ - - - - - false + + + + false + + + + 1 + 0 + + + + Weather + + + + 3 - - Weather + + 3 - - - 3 - - - 3 - - - 3 - - - 3 - - - 3 - - - - - false + + 3 + + + 3 + + + 3 + + + + + + 0 + 0 + + + + + + + + + + + + 140 + 0 + + + + <html><head/><body><p>Current data of the weather sensors. Click on the sensor name to display its data over time.</p></body></html> + + + + + + + Qt::Horizontal + + + + 40 + 20 + + + + + + + + false + + + Actions + + + + 3 - - Actions + + 3 + + + 3 + + + 3 - - - 3 - - - 3 - - - 3 - - - 3 - - - 3 - - - - - War&ning + + 3 + + + + + War&ning + + + true + + + + 3 - - true + + 0 - - - 3 - - - 0 - - - 3 - - - 0 - - - 3 - - - - - Park Dome - - - - - - - Close Shutter - - - - - - - Stop Scheduler - - - - - - - - - <html><head/><body><p><span style=" font-style:italic;">Status: inactive</span></p></body></html> - - - Qt::AutoText - - - - - - - Qt::Horizontal - - - - 40 - 20 - - - - - - - - Delay (sec): - - - - - - - Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter - - - 9999 - - - - - - - - - - - - Ale&rt + + 3 - - true + + 0 - - - 3 - - - 3 - - - 3 - - - 0 - - - 3 - - - - - Close Shutter - - - - - - - Park Dome - - - - - - - Stop Scheduler - - - - - - - - - <html><head/><body><p><span style=" font-style:italic;">Status: inactive</span></p></body></html> - - - Qt::AutoText - - - - - - - Qt::Horizontal - - - - 40 - 20 - - - - - - - - Delay (sec): - - - - - - - Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter - - - 9999 - - - - - - - - - - - - - - - - 0 - 0 - - - - - 28 - 28 - - - - - 28 - 28 - - - - - - - - - - - Qt::Horizontal - - - QSizePolicy::Fixed - - - - 10 - 20 - - - - - - - - - 0 - 0 - - - - - - - - - - - - 140 - 0 - - - - <html><head/><body><p>Current data of the weather sensors. Click on the sensor name to display its data over time.</p></body></html> - - - - - - - false - - - - 24 - 24 - - - - - 24 - 24 - - - - <html><head/><body><p>Clear sensor data history</p></body></html> - - - - - - - .. - - - - 24 - 24 - - - - - - - - Qt::Horizontal - - - - 40 - 20 - - - - - - - - + + 3 + + + + + Park Dome + + + + + + + Close Shutter + + + + + + + Stop Scheduler + + + + + + + + + <html><head/><body><p><span style=" font-style:italic;">Status: inactive</span></p></body></html> + + + Qt::AutoText + + + + + + + Qt::Horizontal + + + + 40 + 20 + + + + + + + + Delay (sec): + + + + + + + Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter + + + 9999 + + + + + + + + + + + + Ale&rt + + + true + + + + 3 + + + 3 + + + 3 + + + 0 + + + 3 + + + + + Close Shutter + + + + + + + Park Dome + + + + + + + Stop Scheduler + + + + + + + + + <html><head/><body><p><span style=" font-style:italic;">Status: inactive</span></p></body></html> + + + Qt::AutoText + + + + + + + Qt::Horizontal + + + + 40 + 20 + + + + + + + + Delay (sec): + + + + + + + Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter + + + 9999 + + + + + + + + + + + + + + + Qt::Horizontal + + + QSizePolicy::Fixed + + + + 10 + 20 + + + + + + + + + 0 + 0 + + + + + 28 + 28 + + + + + 28 + 28 + + + + + + + + + + + false + + + + 24 + 24 + + + + + 24 + 24 + + + + <html><head/><body><p>Clear sensor data history</p></body></html> + + + + + + + + + + 24 + 24 + + + + + + + diff --git a/kstars/ekos/observatory/observatoryweathermodel.h b/kstars/ekos/observatory/observatoryweathermodel.h --- a/kstars/ekos/observatory/observatoryweathermodel.h +++ b/kstars/ekos/observatory/observatoryweathermodel.h @@ -33,6 +33,8 @@ void initModel(Weather *weather); ISD::Weather::Status status(); + bool refresh(); + /** * @brief Actions to be taken when a weather warning occurs */ diff --git a/kstars/ekos/observatory/observatoryweathermodel.cpp b/kstars/ekos/observatory/observatoryweathermodel.cpp --- a/kstars/ekos/observatory/observatoryweathermodel.cpp +++ b/kstars/ekos/observatory/observatoryweathermodel.cpp @@ -66,6 +66,11 @@ return weatherInterface->status(); } +bool ObservatoryWeatherModel::refresh() +{ + return weatherInterface->refresh(); +} + void ObservatoryWeatherModel::setWarningActionsActive(bool active) { warningActionsActive = active; diff --git a/kstars/indi/indiweather.h b/kstars/indi/indiweather.h --- a/kstars/indi/indiweather.h +++ b/kstars/indi/indiweather.h @@ -52,6 +52,7 @@ Status getWeatherStatus(); quint16 getUpdatePeriod(); + bool refresh(); signals: void newStatus(Status status); diff --git a/kstars/indi/indiweather.cpp b/kstars/indi/indiweather.cpp --- a/kstars/indi/indiweather.cpp +++ b/kstars/indi/indiweather.cpp @@ -96,6 +96,26 @@ return static_cast(updateNP->np[0].value); } + +bool Weather::refresh() +{ + ISwitchVectorProperty *refreshSP = baseDevice->getSwitch("WEATHER_REFRESH"); + + if (refreshSP == nullptr) + return false; + + ISwitch *refreshSW = IUFindSwitch(refreshSP, "REFRESH"); + + if (refreshSW == nullptr) + return false; + + IUResetSwitch(refreshSP); + refreshSW->s = ISS_ON; + clientManager->sendNewSwitch(refreshSP); + + return true; + +} } #ifndef KSTARS_LITE