diff --git a/pws2mqtt-qt.pro.user b/pws2mqtt-qt.pro.user index 58670d4..790b4f2 100644 --- a/pws2mqtt-qt.pro.user +++ b/pws2mqtt-qt.pro.user @@ -1,6 +1,6 @@ - + EnvironmentId @@ -90,13 +90,13 @@ Qt 6.4.1 (qt6) Qt 6.4.1 (qt6) {17b0ba8e-e6fe-4c71-98eb-9b4d3bcc4307} - 0 + 1 0 0 0 - /home/daniel/develop/build-pws2mqtt-qt-Desktop-Debug - /home/daniel/develop/build-pws2mqtt-qt-Desktop-Debug + /home/daniel/develop/pws2mqtt-qt/build/debug + /home/daniel/develop/pws2mqtt-qt/build/debug true @@ -140,7 +140,47 @@ Qt4ProjectManager.Qt4BuildConfiguration 2 - 1 + + /home/daniel/develop/pws2mqtt-qt/build/Release + /home/daniel/develop/pws2mqtt-qt/build/Release + + + true + QtProjectManager.QMakeBuildStep + false + + + + true + Qt4ProjectManager.MakeStep + + 2 + Build + Build + ProjectExplorer.BuildSteps.Build + + + + true + Qt4ProjectManager.MakeStep + clean + + 1 + Clean + Clean + ProjectExplorer.BuildSteps.Clean + + 2 + false + + false + + Release + Qt4ProjectManager.Qt4BuildConfiguration + 0 + 0 + + 2 0 @@ -169,7 +209,7 @@ false true false - /home/daniel/develop/build-pws2mqtt-qt-Desktop-Debug + /home/daniel/develop/pws2mqtt-qt/build/Release 1 diff --git a/pws2mqtt.cpp b/pws2mqtt.cpp index 39026c4..20a54b0 100644 --- a/pws2mqtt.cpp +++ b/pws2mqtt.cpp @@ -17,13 +17,16 @@ extern MqttClient *mqttClient; extern Pws2mqtt *pws2mqtt; extern QHttpServer *httpServer; -QStringList previsionList {"Temps variable (incertain).", \ - "Beau temps stable (anticyclone).", \ - "Amélioration progressive (éclaircies).", \ - "Risque de pluie légère ou nuages.", \ - "Dégradation marquée (pluie/vent/orage).", \ - "Tempête ou dépression forte (vigilance)." \ - }; +QStringList previsionList +{ + "Temps variable (incertain).", \ + "Beau temps stable (anticyclone).", \ + "Amélioration progressive (éclaircies).", \ + "Risque de pluie légère ou nuages.", \ + "Dégradation marquée (pluie/vent/orage).", \ + "Tempête ou dépression forte (vigilance).", \ + "Temps stable" +}; // Callback for curl library static size_t WriteCallback(void *contents, size_t size, size_t nmemb, void *userp) @@ -330,14 +333,15 @@ void Pws2mqtt::parseData(QList> queryList) QString ret = pressureVariation(propertyValue); if (!ret.isEmpty()) { - debug (DEBUGMACRO, "baromin ret not empty : " + QByteArray::number(propertyValue), DEBUG); + debug (DEBUGMACRO, "baromin ret not empty : " + ret, DEBUG); QStringList liste = ret.split(","); - double newPrevision = liste[1].toInt(); + double newPrevision = liste[0].toUInt(); + priority = setPriority(priority, liste[1].toUInt()); if (prevision != newPrevision) { prevision = newPrevision; propertyList["prevision"] = prevision; - //notif += prevision + " \n"; + notif += previsionList[prevision] + " \n"; //debug (DEBUGMACRO, "Notif = #" + notif + "#", DEBUG); changed = true; } @@ -441,7 +445,10 @@ quint8 previsionMeteo(double currentPressure, double variation3h) } else if (currentPressure < 990.0) { return 4; - } else + } else if (variation3h == 0) + { + return 6; + }else { return 5; } @@ -450,21 +457,19 @@ quint8 previsionMeteo(double currentPressure, double variation3h) QString pressureVariation(double currentPressure) { const int NB_MESURES_3H = 360; // 3h × 120 mesures/heure (1 mesure toutes les 30s) - QVector historiquePressions; + static QVector historiquePressions; - debug(DEBUGMACRO, "PressureVariation", DEBUG); + debug(DEBUGMACRO, "PressureVariation : current pressure = " + QByteArray::number(currentPressure), DEBUG); - historiquePressions.reserve(NB_MESURES_3H); - - // Ajout de la mesure à l'historique - historiquePressions.push_back(currentPressure); + historiquePressions.append(currentPressure); // Si on a assez de mesures pour couvrir 3h if (historiquePressions.size() > NB_MESURES_3H) { + debug(DEBUGMACRO, "historiquePressions > " + QByteArray::number(NB_MESURES_3H), DEBUG); historiquePressions.erase(historiquePressions.begin()); } - + debug(DEBUGMACRO, "taille de historiquePression : " + QByteArray::number(historiquePressions.size()), DEBUG); // Calcul de la variation sur 3h si on a assez de mesures if (historiquePressions.size() == NB_MESURES_3H) { diff --git a/version.h b/version.h index f17597b..121dfe0 100644 --- a/version.h +++ b/version.h @@ -3,6 +3,6 @@ #include -std::string version = "1.0.1"; +std::string version = "1.0.16"; #endif // VERSION_H