Skip to content

Commit

Permalink
Update
Browse files Browse the repository at this point in the history
  • Loading branch information
sfeakes committed Sep 20, 2024
1 parent e0109d7 commit d447c13
Show file tree
Hide file tree
Showing 13 changed files with 307 additions and 68 deletions.
Binary file modified release/aqualinkd-amd64
Binary file not shown.
Binary file modified release/aqualinkd-arm64
Binary file not shown.
Binary file modified release/aqualinkd-armhf
Binary file not shown.
Binary file modified release/serial_logger-amd64
Binary file not shown.
Binary file modified release/serial_logger-arm64
Binary file not shown.
Binary file modified release/serial_logger-armhf
Binary file not shown.
13 changes: 11 additions & 2 deletions source/aq_serial.c
Original file line number Diff line number Diff line change
Expand Up @@ -250,6 +250,12 @@ const char* get_jandy_packet_type(unsigned char* packet , int length)
case CMD_IAQ_MSG_LONG:
return "iAq Popup message";
break;
case CMD_IAQ_MAIN_STATUS:
return "iAq Main status";
break;
case CMD_IAQ_1TOUCH_STATUS:
return "iAq 1Touch status";
break;
case CMD_IAQ_AUX_STATUS:
return "iAq AUX status";
break;
Expand Down Expand Up @@ -1148,8 +1154,11 @@ int get_packet(int fd, unsigned char* packet)

// Report any unusual size packets.
if (index >= AQ_MAXPKTLEN_WARNING) {
LOG(RSSD_LOG,LOG_WARNING, "Serial packet seems too large at length %d\n", index);
logPacketError(packet, index);
// Aqualink2 packets 0x72 and 0x71 can be very large, so supress if it one of those.
if (packet[PKT_CMD] != CMD_IAQ_AUX_STATUS && packet[PKT_CMD] != CMD_IAQ_1TOUCH_STATUS) {
LOG(RSSD_LOG,LOG_WARNING, "Serial packet seems too large at length %d\n", index);
logPacketError(packet, index);
}
}

//LOG(RSSD_LOG,LOG_DEBUG, "Serial checksum, length %d got 0x%02hhx expected 0x%02hhx\n", index, packet[index-3], generate_checksum(packet, index));
Expand Down
2 changes: 2 additions & 0 deletions source/aq_serial.h
Original file line number Diff line number Diff line change
Expand Up @@ -411,6 +411,8 @@ SPILLOVER IS DISABLED WHILE SPA IS ON
#define CMD_IAQ_MSG_LONG 0x2c // This this is display popup message. Next 2 bytes 0x00|0x01 = wait and then 0x00|0x00 clear

// If
#define CMD_IAQ_MAIN_STATUS 0x70
#define CMD_IAQ_1TOUCH_STATUS 0x71
#define CMD_IAQ_AUX_STATUS 0x72 // Get this on AqualinkTouch protocol when iAqualink protocol sends 0x18 (get aux status I assume)
/*
#define CMD_IAQ_MSG_3 0x2d // Equiptment status message??
Expand Down
7 changes: 6 additions & 1 deletion source/aqualinkd.c
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,7 @@ char *_cfgFile;
int _cmdln_loglevel = -1;
bool _cmdln_debugRS485 = false;
bool _cmdln_lograwRS485 = false;
bool _cmdln_nostartupcheck = false;

#ifdef AQ_TM_DEBUG
//struct timespec _rs_packet_readitme;
Expand Down Expand Up @@ -460,6 +461,10 @@ int main(int argc, char *argv[])
else if (strcmp(argv[i], "-rsrd") == 0)
{
_cmdln_lograwRS485 = true;
}
else if (strcmp(argv[i], "-nc") == 0)
{
_cmdln_nostartupcheck = true;
}
}

Expand Down Expand Up @@ -1018,7 +1023,7 @@ void main_loop()
i=0;

// Loop until we get the probe messages, that means we didn;t start too soon after last shutdown.
while ( (got_probe == false || got_probe_rssa == false || got_probe_extended == false ) && _keepRunning == true)
while ( (got_probe == false || got_probe_rssa == false || got_probe_extended == false ) && _keepRunning == true && _cmdln_nostartupcheck == false)
{
if (blank_read == blank_read_reconnect / 2) {
LOG(AQUA_LOG,LOG_ERR, "Nothing read on '%s', are you sure that's right?\n",_aqconfig_.serial_port);
Expand Down
50 changes: 39 additions & 11 deletions source/iaqtouch.c
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
#include "packetLogger.h"
#include "iaqtouch.h"
#include "iaqtouch_aq_programmer.h"
#include "iaqualink.h"
#include "aq_programmer.h"
#include "rs_msg_utils.h"
#include "devices_jandy.h"
Expand Down Expand Up @@ -878,6 +879,7 @@ bool process_iaqtouch_packet(unsigned char *packet, int length, struct aqualinkd
{
static bool gotInit = false;
static int cnt = 0;
static int probesSinceLastPageCMD=0;
static bool gotStatus = true;
static char message[AQ_MSGLONGLEN + 1];
bool fake_pageend = false;
Expand All @@ -893,6 +895,7 @@ bool process_iaqtouch_packet(unsigned char *packet, int length, struct aqualinkd
}*/

// DEBUG for iAqualink
/*
if (_aqconfig_.enable_iaqualink) {
if (packet[PKT_CMD] == CMD_IAQ_AUX_STATUS) {
// Look at notes in iaqualink.c for how this packet is made up
Expand All @@ -915,12 +918,19 @@ bool process_iaqtouch_packet(unsigned char *packet, int length, struct aqualinkd
aq_data->pumps[0].rpm,
aq_data->pool_htr_set_point,
aq_data->spa_htr_set_point);
} else if (packet[PKT_CMD] == 0x70){
debuglogPacket(IAQT_LOG, packet, length, true, true);
} else if (packet[PKT_CMD] == 0x71){
debuglogPacket(IAQT_LOG, packet, length, true, true);
}


}

if (packet[PKT_CMD] == CMD_IAQ_PAGE_START) {
}*/
if (packet[PKT_CMD] == CMD_IAQ_MAIN_STATUS ||
packet[PKT_CMD] == CMD_IAQ_1TOUCH_STATUS ||
packet[PKT_CMD] == CMD_IAQ_AUX_STATUS) {
process_iaqualink_packet(packet, length, aq_data);
}
else if (packet[PKT_CMD] == CMD_IAQ_PAGE_START)
{
// Reset and messages on new page
aq_data->last_display_message[0] = ' ';
aq_data->last_display_message[1] = '\0';
Expand All @@ -937,7 +947,9 @@ bool process_iaqtouch_packet(unsigned char *packet, int length, struct aqualinkd
if (gotStatus == false)
gotStatus = true;
//[IAQ_STATUS_PAGE_LINES][AQ_MSGLEN+1];
} else if (packet[PKT_CMD] == CMD_IAQ_PAGE_END) {
}
else if (packet[PKT_CMD] == CMD_IAQ_PAGE_END)
{
set_iaq_cansend(true);
LOG(IAQT_LOG,LOG_DEBUG, "Turning IAQ SEND on\n");
if (_currentPageLoading != NUL) {
Expand Down Expand Up @@ -1047,6 +1059,7 @@ bool process_iaqtouch_packet(unsigned char *packet, int length, struct aqualinkd

// Standard ack/poll
if (packet[3] == CMD_IAQ_POLL) {
probesSinceLastPageCMD++;

#ifdef NEW_POLL_CYCLE
/*
Expand All @@ -1069,7 +1082,7 @@ if not programming && poll packet {
}*/
if (in_programming_mode(aq_data) == false) {
if (_currentPage == IAQ_PAGE_HOME) {
iaqt_queue_cmd(KEY_IAQTCH_HOMEP_KEY08);
iaqt_queue_cmd(KEY_IAQTCH_HOMEP_KEY08); // This is "other devices on/off" page
cnt = 0;
}
//if ( (isPDA_PANEL || isVirtualButtonEnabled() || PANEL_SIZE() >= 16) && !in_iaqt_programming_mode(aq_data) ) {
Expand Down Expand Up @@ -1101,8 +1114,20 @@ if not programming && poll packet {
nextPageRequestKey = KEY_IAQTCH_STATUS;
break;
}
iaqt_queue_cmd(nextPageRequestKey);

if (probesSinceLastPageCMD > 3) {
// Seems to be a bug with wifi device ghosting command on/off, kind-a looks like our page commands don;t take sometimes so wait.
iaqt_queue_cmd(nextPageRequestKey);
probesSinceLastPageCMD=0;
} else {
LOG(IAQT_LOG, LOG_NOTICE, "Waiting to send next page cnt %d\n",probesSinceLastPageCMD);
}
}
} else if (in_programming_mode(aq_data) == true) {
// Set count to something close to max, so we will pull latest info once programming has finished.
// This is good for VSP GPM programming as it takes number of seconds to register once finished programming.
// -5 seems to be too quick for VSP/GPM so using 10
cnt = REQUEST_STATUS_POLL_COUNT - 10;
}
#else
//LOG(IAQT_LOG,LOG_DEBUG, "poll count %d\n",cnt);
Expand All @@ -1128,15 +1153,18 @@ if not programming && poll packet {
iaqt_queue_cmd(KEY_IAQTCH_STATUS);
}
*/


} else if (in_programming_mode(aq_data) == true) {
// Set count to something close to above, so we will pull latest info once programming has finished.
// This is goot for VSP GPM programming as it takes number of seconds to register once finished programming.
// Set count to something close to max, so we will pull latest info once programming has finished.
// This is good for VSP GPM programming as it takes number of seconds to register once finished programming.
// -5 seems to be too quick for VSP/GPM so using 10
cnt = REQUEST_STATUS_POLL_COUNT - 10;
}
#endif

// On poll no need to kick programming threads
return false;
#endif
}

//debuglogPacket(IAQT_LOG ,packet, length);
Expand Down
Loading

0 comments on commit d447c13

Please sign in to comment.