mirror of
https://github.com/anklimov/lighthub
synced 2025-12-06 11:49:51 +03:00
SendStatus interim refactoring
This commit is contained in:
@@ -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;
|
||||||
|
|||||||
@@ -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,
|
||||||
|
|||||||
Reference in New Issue
Block a user