mirror of https://github.com/sfeakes/AqualinkD.git
Fixed logging issue
parent
6649effe9d
commit
a2a925ed96
|
@ -1481,7 +1481,7 @@ void main_loop()
|
|||
int packet_length;
|
||||
unsigned char packet_buffer[AQ_MAXPKTLEN+1];
|
||||
//bool interestedInNextAck = false;
|
||||
rsDeviceType interestedInNextAck = DRS_NONE;
|
||||
//rsDeviceType interestedInNextAck = DRS_NONE;
|
||||
//bool changed = false;
|
||||
//int swg_zero_cnt = 0;
|
||||
int i;
|
||||
|
@ -1490,7 +1490,7 @@ void main_loop()
|
|||
bool got_probe_extended = false;
|
||||
bool got_probe_rssa = false;
|
||||
bool print_once = false;
|
||||
unsigned char previous_packet_to = NUL; // bad name, it's not previous, it's previous that we were interested in.
|
||||
//unsigned char previous_packet_to = NUL; // bad name, it's not previous, it's previous that we were interested in.
|
||||
|
||||
// NSF need to find a better place to init this.
|
||||
//_aqualink_data.aq_command = 0x00;
|
||||
|
@ -1860,6 +1860,8 @@ void main_loop()
|
|||
{
|
||||
if (getProtocolType(packet_buffer) == JANDY)
|
||||
{
|
||||
_aqualink_data.updated = processJandyPacket(packet_buffer, packet_length, &_aqualink_data);
|
||||
/*
|
||||
// We received the ack from a Jandy device we are interested in
|
||||
if (packet_buffer[PKT_DEST] == DEV_MASTER && interestedInNextAck != DRS_NONE)
|
||||
{
|
||||
|
@ -1904,7 +1906,7 @@ void main_loop()
|
|||
{
|
||||
interestedInNextAck = DRS_NONE;
|
||||
previous_packet_to = NUL;
|
||||
}
|
||||
}*/
|
||||
}
|
||||
// Process Pentair Device Packed (pentair have to & from in message, so no need to)
|
||||
else if (getProtocolType(packet_buffer) == PENTAIR && READ_RSDEV_vsfPUMP) {
|
||||
|
|
|
@ -33,6 +33,60 @@
|
|||
|
||||
static int _swg_noreply_cnt = 0;
|
||||
|
||||
bool processJandyPacket(unsigned char *packet_buffer, int packet_length, struct aqualinkdata *aqdata)
|
||||
{
|
||||
static rsDeviceType interestedInNextAck = DRS_NONE;
|
||||
static unsigned char previous_packet_to = NUL; // bad name, it's not previous, it's previous that we were interested in.
|
||||
int rtn = false;
|
||||
// We received the ack from a Jandy device we are interested in
|
||||
if (packet_buffer[PKT_DEST] == DEV_MASTER && interestedInNextAck != DRS_NONE)
|
||||
{
|
||||
if (interestedInNextAck == DRS_SWG)
|
||||
{
|
||||
rtn = processPacketFromSWG(packet_buffer, packet_length, aqdata);
|
||||
}
|
||||
else if (interestedInNextAck == DRS_EPUMP)
|
||||
{
|
||||
rtn = processPacketFromJandyPump(packet_buffer, packet_length, aqdata);
|
||||
}
|
||||
interestedInNextAck = DRS_NONE;
|
||||
previous_packet_to = NUL;
|
||||
}
|
||||
// We were expecting an ack from Jandy device but didn't receive it.
|
||||
else if (packet_buffer[PKT_DEST] != DEV_MASTER && interestedInNextAck != DRS_NONE)
|
||||
{
|
||||
if (interestedInNextAck == DRS_SWG && aqdata->ar_swg_device_status != SWG_STATUS_OFF)
|
||||
{ // SWG Offline
|
||||
processMissingAckPacketFromSWG(previous_packet_to, aqdata);
|
||||
}
|
||||
else if (interestedInNextAck == DRS_EPUMP)
|
||||
{ // ePump offline
|
||||
processMissingAckPacketFromJandyPump(previous_packet_to, aqdata);
|
||||
}
|
||||
interestedInNextAck = DRS_NONE;
|
||||
previous_packet_to = NUL;
|
||||
}
|
||||
else if (READ_RSDEV_SWG && packet_buffer[PKT_DEST] == SWG_DEV_ID)
|
||||
{
|
||||
interestedInNextAck = DRS_SWG;
|
||||
rtn = processPacketToSWG(packet_buffer, packet_length, aqdata, _aqconfig_.swg_zero_ignore);
|
||||
previous_packet_to = packet_buffer[PKT_DEST];
|
||||
}
|
||||
else if (READ_RSDEV_ePUMP && packet_buffer[PKT_DEST] >= JANDY_DEC_PUMP_MIN && packet_buffer[PKT_DEST] <= JANDY_DEC_PUMP_MAX)
|
||||
{
|
||||
interestedInNextAck = DRS_EPUMP;
|
||||
rtn = processPacketToJandyPump(packet_buffer, packet_length, aqdata);
|
||||
previous_packet_to = packet_buffer[PKT_DEST];
|
||||
}
|
||||
else
|
||||
{
|
||||
interestedInNextAck = DRS_NONE;
|
||||
previous_packet_to = NUL;
|
||||
}
|
||||
|
||||
return rtn;
|
||||
}
|
||||
|
||||
bool processPacketToSWG(unsigned char *packet, int packet_length, struct aqualinkdata *aqdata, int swg_zero_ignore) {
|
||||
static int swg_zero_cnt = 0;
|
||||
bool changedAnything = false;
|
||||
|
|
|
@ -5,6 +5,8 @@
|
|||
|
||||
#include "aqualink.h"
|
||||
|
||||
bool processJandyPacket(unsigned char *packet_buffer, int packet_length, struct aqualinkdata *aqdata);
|
||||
|
||||
bool processPacketToSWG(unsigned char *packet, int packet_length, struct aqualinkdata *aqdata, int swg_zero_ignore);
|
||||
bool processPacketFromSWG(unsigned char *packet, int packet_length, struct aqualinkdata *aqdata);
|
||||
bool processPacketToJandyPump(unsigned char *packet_buffer, int packet_length, struct aqualinkdata *aqdata);
|
||||
|
|
2
epump.h
2
epump.h
|
@ -1,6 +1,6 @@
|
|||
|
||||
/*
|
||||
Nothing seems to change these in simulator, need real pump to test
|
||||
Nothing seems to change these, need real pump to test
|
||||
0x10|0x02|0x7a|0x44|0x00|0x58|0x1b|0x43|0x10|0x03|
|
||||
|
||||
0x10|0x02|0x7a|0x44|0x00|0x58|0x1b|0x43|0x10|0x03|
|
||||
|
|
Binary file not shown.
|
@ -6,7 +6,7 @@
|
|||
web_directory=/nas/data/Development/Raspberry/AqualinkD/web
|
||||
|
||||
# Log to file, comment out if you do not want to log to file
|
||||
#log_file=/var/log/aqualinkd.log
|
||||
log_file=/var/log/aqualinkd.log
|
||||
|
||||
# The log level. [DEBUG, INFO, NOTICE, WARNING, ERROR]
|
||||
# Pick the highest level, and all levels below will be sent to syslog.
|
||||
|
@ -18,8 +18,8 @@ web_directory=/nas/data/Development/Raspberry/AqualinkD/web
|
|||
|
||||
#log_level=DEBUG_SERIAL
|
||||
#log_level=DEBUG
|
||||
#log_level=INFO
|
||||
log_level=NOTICE
|
||||
log_level=INFO
|
||||
#log_level=NOTICE
|
||||
|
||||
# AQUA_LOG 1
|
||||
# NET_LOG 2
|
||||
|
|
Binary file not shown.
2
utils.c
2
utils.c
|
@ -518,7 +518,7 @@ void _LOG(int16_t from, int msg_level, char *message)
|
|||
if (fp != -1) {
|
||||
timestamp(time);
|
||||
if ( write(fp, time, strlen(time) ) == -1 ||
|
||||
write(fp, time, strlen(time) ) == -1 )
|
||||
write(fp, message, strlen(message) ) == -1 )
|
||||
{
|
||||
syslog(LOG_ERR, "Can't write to log file %s\n %s", _log_filename, message);
|
||||
fprintf (stderr, "Can't write to log file %s\n %s", _log_filename, message);
|
||||
|
|
Loading…
Reference in New Issue