Compare commits
3 Commits
0847e89960
...
f9985cc2c1
Author | SHA1 | Date | |
---|---|---|---|
|
f9985cc2c1 | ||
|
ef446ebd19 | ||
|
5987bc28de |
@ -4,9 +4,8 @@
|
|||||||
#ifdef CONFIG_ENABLE_TELEINFO
|
#ifdef CONFIG_ENABLE_TELEINFO
|
||||||
#include <LibTeleinfo.h>
|
#include <LibTeleinfo.h>
|
||||||
int TeleinfoSetup();
|
int TeleinfoSetup();
|
||||||
int TeleinfoProcess(std::vector<struct mqttInfo> &batchInfo);
|
int TeleinfoRetrieve(float &iinst, float &papp, float &base);
|
||||||
int TeleinfoProcess(float &iinst, float &papp, float &base);
|
int TeleinfoRetrieve(float &iinst, float &papp, float &base,
|
||||||
int TeleinfoProcess(float &iinst, float &papp, float &base,
|
|
||||||
std::vector<struct mqttInfo> &batchInfo);
|
std::vector<struct mqttInfo> &batchInfo);
|
||||||
#else
|
#else
|
||||||
int TeleinfoSetup() {
|
int TeleinfoSetup() {
|
||||||
@ -14,8 +13,11 @@ int TeleinfoSetup() {
|
|||||||
return -1;
|
return -1;
|
||||||
};
|
};
|
||||||
|
|
||||||
int TeleinfoProcess(float &, float &, float &,
|
int TeleinfoRetrieve(float &, float &, float &){
|
||||||
std::vector<struct mqttInfo> &){
|
return 0;
|
||||||
return 0;
|
}
|
||||||
|
int TeleinfoRetrieve(float &, float &, float &, std::vector<struct mqttInfo> &)
|
||||||
|
{
|
||||||
|
return 0;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
@ -13,8 +13,8 @@ int TeleinfoSetup()
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
int TeleinfoProcess(std::vector<struct mqttInfo> &batchInfo)
|
|
||||||
{
|
int TeleinfoRetrieve(float &iinst, float &papp, float &base){
|
||||||
int c;
|
int c;
|
||||||
|
|
||||||
while ((c = TELESerial.read()) >= 0) {
|
while ((c = TELESerial.read()) >= 0) {
|
||||||
@ -25,16 +25,16 @@ int TeleinfoProcess(std::vector<struct mqttInfo> &batchInfo)
|
|||||||
me = me->next;
|
me = me->next;
|
||||||
while (me) {
|
while (me) {
|
||||||
if (strcmp(me->name, "IINST") == 0) {
|
if (strcmp(me->name, "IINST") == 0) {
|
||||||
float val = atof(me->value);
|
iinst = atof(me->value);
|
||||||
batchInfo.push_back({val, TELEINFO_IINST_FEED_FORMAT, 0, 0});
|
|
||||||
}
|
}
|
||||||
if (strcmp(me->name, "PAPP") == 0) {
|
if (strcmp(me->name, "PAPP") == 0) {
|
||||||
float val = atof(me->value);
|
papp = atof(me->value);
|
||||||
batchInfo.push_back({val, TELEINFO_PAPP_FEED_FORMAT, 0, 0});
|
|
||||||
}
|
}
|
||||||
if (strcmp(me->name, "BASE") == 0) {
|
if (strcmp(me->name, "BASE") == 0) {
|
||||||
float val = atof(me->value);
|
float tmp = atof(me->value);
|
||||||
batchInfo.push_back({val, TELEINFO_BASE_FEED_FORMAT, 0, 0});
|
if(tmp != 0){
|
||||||
|
base = tmp;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
me = me->next;
|
me = me->next;
|
||||||
}
|
}
|
||||||
@ -42,7 +42,7 @@ int TeleinfoProcess(std::vector<struct mqttInfo> &batchInfo)
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
int TeleinfoProcess(float &iinst, float &papp, float &base,
|
int TeleinfoRetrieve(float &iinst, float &papp, float &base,
|
||||||
std::vector<struct mqttInfo> &batchInfo)
|
std::vector<struct mqttInfo> &batchInfo)
|
||||||
{
|
{
|
||||||
int c;
|
int c;
|
||||||
@ -63,8 +63,11 @@ int TeleinfoProcess(float &iinst, float &papp, float &base,
|
|||||||
batchInfo.push_back({papp, TELEINFO_PAPP_FEED_FORMAT, 0, 0});
|
batchInfo.push_back({papp, TELEINFO_PAPP_FEED_FORMAT, 0, 0});
|
||||||
}
|
}
|
||||||
if (strcmp(me->name, "BASE") == 0) {
|
if (strcmp(me->name, "BASE") == 0) {
|
||||||
base = atof(me->value);
|
float tmp = atof(me->value);
|
||||||
batchInfo.push_back({base, TELEINFO_BASE_FEED_FORMAT, 0, 0});
|
if(tmp != 0){
|
||||||
|
base = tmp;
|
||||||
|
batchInfo.push_back({base, TELEINFO_BASE_FEED_FORMAT, 0, 0});
|
||||||
|
}
|
||||||
}
|
}
|
||||||
me = me->next;
|
me = me->next;
|
||||||
}
|
}
|
||||||
|
@ -311,6 +311,7 @@ void loop() {
|
|||||||
}
|
}
|
||||||
delay(CONFIG_WEB_DELAY_MS);
|
delay(CONFIG_WEB_DELAY_MS);
|
||||||
|
|
||||||
|
TeleinfoRetrieve(teleIinst, telePapp, teleBase);
|
||||||
nbCycle++;
|
nbCycle++;
|
||||||
if (nbCycle > samplingPeriod / CONFIG_WEB_DELAY_MS) {
|
if (nbCycle > samplingPeriod / CONFIG_WEB_DELAY_MS) {
|
||||||
std::vector<struct mqttInfo> batchInfo;
|
std::vector<struct mqttInfo> batchInfo;
|
||||||
@ -365,10 +366,12 @@ void loop() {
|
|||||||
batchInfo.push_back({bme680BSECIaqAcc, BME680_IAQ_ACC_FEED_FORMAT, 0, 0});
|
batchInfo.push_back({bme680BSECIaqAcc, BME680_IAQ_ACC_FEED_FORMAT, 0, 0});
|
||||||
}
|
}
|
||||||
|
|
||||||
TeleinfoProcess(teleIinst, telePapp, teleBase, batchInfo);
|
TeleinfoRetrieve(teleIinst, telePapp, teleBase, batchInfo);
|
||||||
|
|
||||||
if (mode == BOOTMODE_NORMAL)
|
if (mode == BOOTMODE_NORMAL)
|
||||||
MqttBatchPublish(batchInfo, conf.mqttUser, conf.host);
|
if (MqttBatchPublish(batchInfo, conf.mqttUser, conf.host))
|
||||||
|
WifiSetup(conf);
|
||||||
|
|
||||||
nbCycle = 0;
|
nbCycle = 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user