Compare commits

..

No commits in common. "f9985cc2c1524b1be1fe1694ba127e7432d8b2d3" and "0847e899607855531d357de8443fd065837ea6a6" have entirely different histories.

3 changed files with 19 additions and 27 deletions

View File

@ -4,8 +4,9 @@
#ifdef CONFIG_ENABLE_TELEINFO
#include <LibTeleinfo.h>
int TeleinfoSetup();
int TeleinfoRetrieve(float &iinst, float &papp, float &base);
int TeleinfoRetrieve(float &iinst, float &papp, float &base,
int TeleinfoProcess(std::vector<struct mqttInfo> &batchInfo);
int TeleinfoProcess(float &iinst, float &papp, float &base);
int TeleinfoProcess(float &iinst, float &papp, float &base,
std::vector<struct mqttInfo> &batchInfo);
#else
int TeleinfoSetup() {
@ -13,11 +14,8 @@ int TeleinfoSetup() {
return -1;
};
int TeleinfoRetrieve(float &, float &, float &){
return 0;
}
int TeleinfoRetrieve(float &, float &, float &, std::vector<struct mqttInfo> &)
{
int TeleinfoProcess(float &, float &, float &,
std::vector<struct mqttInfo> &){
return 0;
}
#endif

View File

@ -13,8 +13,8 @@ int TeleinfoSetup()
return 0;
}
int TeleinfoRetrieve(float &iinst, float &papp, float &base){
int TeleinfoProcess(std::vector<struct mqttInfo> &batchInfo)
{
int c;
while ((c = TELESerial.read()) >= 0) {
@ -25,16 +25,16 @@ int TeleinfoRetrieve(float &iinst, float &papp, float &base){
me = me->next;
while (me) {
if (strcmp(me->name, "IINST") == 0) {
iinst = atof(me->value);
float val = atof(me->value);
batchInfo.push_back({val, TELEINFO_IINST_FEED_FORMAT, 0, 0});
}
if (strcmp(me->name, "PAPP") == 0) {
papp = atof(me->value);
float val = atof(me->value);
batchInfo.push_back({val, TELEINFO_PAPP_FEED_FORMAT, 0, 0});
}
if (strcmp(me->name, "BASE") == 0) {
float tmp = atof(me->value);
if(tmp != 0){
base = tmp;
}
float val = atof(me->value);
batchInfo.push_back({val, TELEINFO_BASE_FEED_FORMAT, 0, 0});
}
me = me->next;
}
@ -42,7 +42,7 @@ int TeleinfoRetrieve(float &iinst, float &papp, float &base){
return 0;
}
int TeleinfoRetrieve(float &iinst, float &papp, float &base,
int TeleinfoProcess(float &iinst, float &papp, float &base,
std::vector<struct mqttInfo> &batchInfo)
{
int c;
@ -63,12 +63,9 @@ int TeleinfoRetrieve(float &iinst, float &papp, float &base,
batchInfo.push_back({papp, TELEINFO_PAPP_FEED_FORMAT, 0, 0});
}
if (strcmp(me->name, "BASE") == 0) {
float tmp = atof(me->value);
if(tmp != 0){
base = tmp;
base = atof(me->value);
batchInfo.push_back({base, TELEINFO_BASE_FEED_FORMAT, 0, 0});
}
}
me = me->next;
}

View File

@ -311,7 +311,6 @@ void loop() {
}
delay(CONFIG_WEB_DELAY_MS);
TeleinfoRetrieve(teleIinst, telePapp, teleBase);
nbCycle++;
if (nbCycle > samplingPeriod / CONFIG_WEB_DELAY_MS) {
std::vector<struct mqttInfo> batchInfo;
@ -366,12 +365,10 @@ void loop() {
batchInfo.push_back({bme680BSECIaqAcc, BME680_IAQ_ACC_FEED_FORMAT, 0, 0});
}
TeleinfoRetrieve(teleIinst, telePapp, teleBase, batchInfo);
TeleinfoProcess(teleIinst, telePapp, teleBase, batchInfo);
if (mode == BOOTMODE_NORMAL)
if (MqttBatchPublish(batchInfo, conf.mqttUser, conf.host))
WifiSetup(conf);
MqttBatchPublish(batchInfo, conf.mqttUser, conf.host);
nbCycle = 0;
}
}