debug prevision

This commit is contained in:
DTux committed 2025-10-06 16:26:13 +02:00
1 parent 84f87d3dfe
commit c3a4188406
4 files changed
+36 -8

No files matched your search

+3 -3
View File
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?> <?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE QtCreatorProject> <!DOCTYPE QtCreatorProject>
<!-- Written by QtCreator 9.0.1, 2025-10-05T19:33:41. --> <!-- Written by QtCreator 9.0.1, 2025-10-05T23:00:49. -->
<qtcreator> <qtcreator>
<data> <data>
<variable>EnvironmentId</variable> <variable>EnvironmentId</variable>
@@ -90,7 +90,7 @@
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Qt 6.4.1 (qt6)</value> <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Qt 6.4.1 (qt6)</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName">Qt 6.4.1 (qt6)</value> <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName">Qt 6.4.1 (qt6)</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">{17b0ba8e-e6fe-4c71-98eb-9b4d3bcc4307}</value> <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">{17b0ba8e-e6fe-4c71-98eb-9b4d3bcc4307}</value>
<value type="qlonglong" key="ProjectExplorer.Target.ActiveBuildConfiguration">1</value> <value type="qlonglong" key="ProjectExplorer.Target.ActiveBuildConfiguration">0</value>
<value type="qlonglong" key="ProjectExplorer.Target.ActiveDeployConfiguration">0</value> <value type="qlonglong" key="ProjectExplorer.Target.ActiveDeployConfiguration">0</value>
<value type="qlonglong" key="ProjectExplorer.Target.ActiveRunConfiguration">0</value> <value type="qlonglong" key="ProjectExplorer.Target.ActiveRunConfiguration">0</value>
<valuemap type="QVariantMap" key="ProjectExplorer.Target.BuildConfiguration.0"> <valuemap type="QVariantMap" key="ProjectExplorer.Target.BuildConfiguration.0">
@@ -209,7 +209,7 @@
<value type="bool" key="RunConfiguration.UseQmlDebugger">false</value> <value type="bool" key="RunConfiguration.UseQmlDebugger">false</value>
<value type="bool" key="RunConfiguration.UseQmlDebuggerAuto">true</value> <value type="bool" key="RunConfiguration.UseQmlDebuggerAuto">true</value>
<value type="bool" key="RunConfiguration.UseTerminal">false</value> <value type="bool" key="RunConfiguration.UseTerminal">false</value>
<value type="QString" key="RunConfiguration.WorkingDirectory.default">/home/daniel/develop/pws2mqtt-qt/build/Release</value> <value type="QString" key="RunConfiguration.WorkingDirectory.default">/home/daniel/develop/pws2mqtt-qt/build/debug</value>
</valuemap> </valuemap>
<value type="qlonglong" key="ProjectExplorer.Target.RunConfigurationCount">1</value> <value type="qlonglong" key="ProjectExplorer.Target.RunConfigurationCount">1</value>
</valuemap> </valuemap>
+31 -4
View File
@@ -245,6 +245,7 @@ void Pws2mqtt::parseData(QList<std::pair<QString, QString>> queryList)
QString msg = ""; QString msg = "";
static QDateTime timeWind = QDateTime::currentDateTime().addSecs(-600); static QDateTime timeWind = QDateTime::currentDateTime().addSecs(-600);
quint8 windPriority = 1; quint8 windPriority = 1;
static QString msgNotif;
debug (DEBUGMACRO, name + " : " + QByteArray::number(propertyValue), DEBUG); debug (DEBUGMACRO, name + " : " + QByteArray::number(propertyValue), DEBUG);
propertyValue = round(mphTokmh(value.toFloat())); propertyValue = round(mphTokmh(value.toFloat()));
@@ -269,8 +270,7 @@ void Pws2mqtt::parseData(QList<std::pair<QString, QString>> queryList)
propertyList["rafales"] = msg; propertyList["rafales"] = msg;
msg.prepend("Rafales - "); msg.prepend("Rafales - ");
} }
QString msgNotif = formatNotifString (msg, propertyName[name].second , QByteArray::number(propertyValue)); msgNotif = formatNotifString (msg, propertyName[name].second , QByteArray::number(propertyValue));
notif += msgNotif;
setPriority(priority, windPriority); setPriority(priority, windPriority);
propertyList["winddir"] = winddir; propertyList["winddir"] = winddir;
@@ -286,6 +286,8 @@ void Pws2mqtt::parseData(QList<std::pair<QString, QString>> queryList)
debug (DEBUGMACRO, "Notif = *" + notif + "*", DEBUG); debug (DEBUGMACRO, "Notif = *" + notif + "*", DEBUG);
} }
notif += msgNotif;
/*}else if (name == "windgustmph") /*}else if (name == "windgustmph")
{ {
propertyValue = round(mphTokmh(pair.second.toFloat())); propertyValue = round(mphTokmh(pair.second.toFloat()));
@@ -314,9 +316,10 @@ void Pws2mqtt::parseData(QList<std::pair<QString, QString>> queryList)
if (compare (propertyList[name].toFloat(), propertyValue, ecart)) if (compare (propertyList[name].toFloat(), propertyValue, ecart))
{ {
//notif += formatNotifString (propertyName[name].first, propertyName[name].second , value); //notif += formatNotifString (propertyName[name].first, propertyName[name].second , value);
QString pluviosite = getPluviosite(propertyValue);
priority = setPriority (priority, 4); priority = setPriority (priority, 4);
//debug (DEBUGMACRO, "Notif = #" + notif + "#", DEBUG); //debug (DEBUGMACRO, "Notif = #" + notif + "#", DEBUG);
propertyList[name] = propertyValue; propertyList[name] = pluviosite + " : " + QString::number(round(propertyValue*100)/100);
changed = true; changed = true;
} }
}else if (name == "baromin") }else if (name == "baromin")
@@ -345,7 +348,7 @@ void Pws2mqtt::parseData(QList<std::pair<QString, QString>> queryList)
prevision = newPrevision; prevision = newPrevision;
propertyList["prevision"] = prevision; propertyList["prevision"] = prevision;
//debug (DEBUGMACRO, "Notif = #" + notif + "#", DEBUG); //debug (DEBUGMACRO, "Notif = #" + notif + "#", DEBUG);
changed = true; //changed = true;
} }
} }
notif += prevision + " \n"; notif += prevision + " \n";
@@ -430,6 +433,26 @@ void Pws2mqtt::parseData(QList<std::pair<QString, QString>> queryList)
debug(DEBUGMACRO, "parseData: Returning", DEBUG); debug(DEBUGMACRO, "parseData: Returning", DEBUG);
} }
QString getPluviosite(double value)
{
if (value < 1)
{
return "Pluie fine, bruine";
}else if (value < 5)
{
return "Pluie Modérée";
}else if (value < 15)
{
return "Pluie forte";
}else if (value > 30)
{
return "Évènement extrème";
}else if (value > 15)
{
return "Forte pluie";
}
}
QString previsionMeteo(double currentPressure, double variation3h, quint8 &priority) QString previsionMeteo(double currentPressure, double variation3h, quint8 &priority)
{ {
QString variation = ""; QString variation = "";
@@ -509,6 +532,10 @@ QString pressureVariation(double currentPressure, quint8 &priority)
debug(DEBUGMACRO, "ending pressureVariation with result", DEBUG); debug(DEBUGMACRO, "ending pressureVariation with result", DEBUG);
return prevision; return prevision;
}else
{
static QTime time = QTime::currentTime();
return "Première prévision à " + time.addSecs((NB_MESURES_3H - historiquePressions.size()) * 30).toString();
} }
debug(DEBUGMACRO, "ending pressureVariation no result", DEBUG); debug(DEBUGMACRO, "ending pressureVariation no result", DEBUG);
return ""; return "";
+1
View File
@@ -60,6 +60,7 @@ void notify (QString notif, QString priority = "low", QString inputPath = "");
quint8 setPriority (quint8 currentPriority, quint8 newPriority); quint8 setPriority (quint8 currentPriority, quint8 newPriority);
QString previsionMeteo(double currentPressure, double variation3h, quint8 &priority); QString previsionMeteo(double currentPressure, double variation3h, quint8 &priority);
QString pressureVariation(double currentPressure, quint8 &priority); QString pressureVariation(double currentPressure, quint8 &priority);
QString getPluviosite(double value);
void rotateAndSaveImage(const QString &inputPath, const QString &outputPath, qreal angle=0); void rotateAndSaveImage(const QString &inputPath, const QString &outputPath, qreal angle=0);
#endif // PWS2MQTT_H #endif // PWS2MQTT_H
+1 -1
View File
@@ -3,6 +3,6 @@
#include <string> #include <string>
std::string version = "1.0.17"; std::string version = "1.0.25";
#endif // VERSION_H #endif // VERSION_H