SendStatus interim refactoring

This commit is contained in:
2020-01-10 15:21:33 +03:00
parent e0a6ac9ff0
commit 75b08441f7
2 changed files with 6 additions and 4 deletions

View File

@@ -23,6 +23,7 @@ e-mail anklimov@gmail.com
#include "aJSON.h" #include "aJSON.h"
#include "utils.h" #include "utils.h"
#include "textconst.h" #include "textconst.h"
#include "main.h"
#ifdef _dmxout #ifdef _dmxout
#include "dmx.h" #include "dmx.h"
@@ -47,6 +48,7 @@ extern aJsonObject *pollingItem;
extern PubSubClient mqttClient; extern PubSubClient mqttClient;
extern int8_t ethernetIdleCount; extern int8_t ethernetIdleCount;
extern int8_t configLocked; extern int8_t configLocked;
extern lan_status lanStatus;
static unsigned long lastctrl = 0; static unsigned long lastctrl = 0;
static aJsonObject *lastobj = NULL; static aJsonObject *lastobj = NULL;
@@ -1702,7 +1704,7 @@ switch (cause)
void Item::sendDelayedStatus() void Item::sendDelayedStatus()
{ long int flags = getFlag(SEND_COMMAND | SEND_PARAMETERS); { long int flags = getFlag(SEND_COMMAND | SEND_PARAMETERS);
// debugSerial<<flags<<F(" Delayed Status ")<<itemArr->name<<endl; // debugSerial<<flags<<F(" Delayed Status ")<<itemArr->name<<endl;
if (flags) if (flags && lanStatus==OPERATION)
{ {
SendStatus(SEND_COMMAND | SEND_PARAMETERS); SendStatus(SEND_COMMAND | SEND_PARAMETERS);
clearFlag(SEND_COMMAND | SEND_PARAMETERS); clearFlag(SEND_COMMAND | SEND_PARAMETERS);
@@ -1712,7 +1714,7 @@ void Item::sendDelayedStatus()
#endif #endif
int Item::SendStatus(int sendFlags) { int Item::SendStatus(int sendFlags) {
int chancmd=getCmd(); int chancmd=getCmd();
if (sendFlags & SEND_DEFFERED) { if ((sendFlags & SEND_DEFFERED) || (lanStatus==RETAINING_COLLECTING)) {
setFlag(sendFlags & (SEND_COMMAND | SEND_PARAMETERS)); setFlag(sendFlags & (SEND_COMMAND | SEND_PARAMETERS));
debugSerial<<F("Status deffered\n"); debugSerial<<F("Status deffered\n");
return -1; return -1;

View File

@@ -171,8 +171,8 @@ enum lan_status {
INITIAL_STATE = 0, INITIAL_STATE = 0,
HAVE_IP_ADDRESS = 1, HAVE_IP_ADDRESS = 1,
IP_READY_CONFIG_LOADED_CONNECTING_TO_BROKER = 2, IP_READY_CONFIG_LOADED_CONNECTING_TO_BROKER = 2,
OPERATION = 3, RETAINING_COLLECTING = 3,
RETAINING_COLLECTING = 4, OPERATION = 4,
AWAITING_ADDRESS = -10, AWAITING_ADDRESS = -10,
RECONNECT = 12, RECONNECT = 12,
READ_RE_CONFIG = -11, READ_RE_CONFIG = -11,