diff --git a/Disclaimer.md b/Disclaimer.md index 7582c4e..e919917 100644 --- a/Disclaimer.md +++ b/Disclaimer.md @@ -13,9 +13,18 @@ This document outlines the legal status and usage terms for the **AqualinkD** pr ## 2. Reverse Engineering & Interoperability AqualinkD has been developed for the sole purpose of achieving **hardware interoperability**. + + + +* **hardware interoperability:** AqualinkD is developed through independent reverse engineering of unencrypted signals transmitted over the RS485 communication bus used by Jandy® Aqualink® pool controllers. +* **Original Work:** All code and documentation in this project are original works created without access to proprietary source code, firmware, or confidential information from Jandy® or Pentair®. +* **Clean Room Implementation:** This project does not contain, use, or redistribute any proprietary source code or binary firmware belonging to Jandy or Pentair. +* **Protocol Implementation:** The communication methods used by this software (including modifications to the standard Modbus protocol over RS485) are a "method of operation" implemented through independent observation of unencrypted signal sequences. +* **Legal Precedent:** This work is designed to comply with and may be protected under the principles of Fair Use for interoperability (consistent with legal standards established in Sega v. Accolade and Google v. Oracle). Under 17 U.S.C. § 102(b), copyright protection does not extend to the ideas, systems, or methods of operation defined by a communication protocol. ## 3. Trademarks All product names, logos, and brands mentioned (such as Jandy®, Aqualink®, Pentair®, IntelliTouch®, or EasyTouch®) are the property of their respective owners. Their use within this project is for **nominative purposes only**—specifically to identify the pool equipment with which this software is compatible. This usage does not imply any affiliation with or endorsement by the trademark holders. diff --git a/README.md b/README.md index 00af04f..343ce5f 100644 --- a/README.md +++ b/README.md @@ -145,6 +145,7 @@ when serial port is wrong, can't edit config. * Fixed setting SWG for PDA v1.2 * Fixed bug with slider run times in web UI * Fixed bug with heater max min in web UI +* Added light_programming_iaqualink_delay to delay aqualink protocol while light is being programmed, some users have encountered panel slowing down while light is being programmed. ## Updates in 3.0.2 * Fixed bug with SWG being enabled if one is not present. diff --git a/RELEASE.md b/RELEASE.md index 0c0af46..bc12530 100644 --- a/RELEASE.md +++ b/RELEASE.md @@ -586,6 +586,10 @@ All notable changes to AqualinkD are documented here. Releases are listed in rev --- + +## Opened source to github (December 27, 2017) +## Project started (2016) + ## Supported Panel Versions AqualinkD was designed for Jandy Aqualink RS and works with AqualinkRS and iAqualink Combo control panels. It will work with Aqualink PDA/AquaPalm; but with limitations. diff --git a/release/aqualinkd-arm64 b/release/aqualinkd-arm64 index 5a8d285..f2f377f 100755 Binary files a/release/aqualinkd-arm64 and b/release/aqualinkd-arm64 differ diff --git a/release/aqualinkd-armhf b/release/aqualinkd-armhf index 6f3d7d6..f304e7f 100755 Binary files a/release/aqualinkd-armhf and b/release/aqualinkd-armhf differ diff --git a/release/rs485mon-arm64 b/release/rs485mon-arm64 index 3609edc..5a5c71e 100755 Binary files a/release/rs485mon-arm64 and b/release/rs485mon-arm64 differ diff --git a/release/rs485mon-armhf b/release/rs485mon-armhf index b2ca707..c9bb94f 100755 Binary files a/release/rs485mon-armhf and b/release/rs485mon-armhf differ diff --git a/source/allbutton.c b/source/allbutton.c index 8f699b3..3fe2158 100644 --- a/source/allbutton.c +++ b/source/allbutton.c @@ -11,6 +11,25 @@ #include "color_lights.h" #include "aq_scheduler.h" +#include "iaqtouch.h" + +/* Handle programmable light turning ON from OFF state */ +void handle_programmable_light_on(struct aqualinkdata *aqdata, int led_index) +{ + //if (aqdata->aqualinkleds[led_index].state == OFF) { + // Find the button associated with this LED + for (int j = 0; j < aqdata->total_buttons; j++) { + if (aqdata->aqbuttons[j].led == &aqdata->aqualinkleds[led_index] && + (aqdata->aqbuttons[j].special_mask & PROGRAM_LIGHT)) { + // LED transitioning from OFF to ON and button has PROGRAM_LIGHT flag + delay_iaqTouch4lightProgramming(); + LOG(ALLB_LOG,LOG_DEBUG, "Resetting iaqTouch poll counter due to light programming"); + break; + } + } + //} +} + /* Below can also be called from serialadapter.c */ void processLEDstate(struct aqualinkdata *aqdata, unsigned char *packet, logmask_t from) { @@ -42,6 +61,11 @@ void processLEDstate(struct aqualinkdata *aqdata, unsigned char *packet, logmask SET_IF_CHANGED(aqdata->aqualinkleds[i].state, FLASH, aqdata->is_dirty); } else if (((aqdata->raw_status[byte] >> bit) & 1) == 1){ //aqdata->aqualinkleds[i].state = ON; +#ifdef PLIGHT_IAQTOUCH_FIX + if (_aqconfig_.light_programming_iaqualink_delay && aqdata->aqualinkleds[i].state == OFF) { + handle_programmable_light_on(aqdata, i); + } +#endif SET_IF_CHANGED(aqdata->aqualinkleds[i].state, ON, aqdata->is_dirty); }else{ //aqdata->aqualinkleds[i].state = OFF; diff --git a/source/aqualink.h b/source/aqualink.h index d1fddd7..7107dea 100644 --- a/source/aqualink.h +++ b/source/aqualink.h @@ -22,6 +22,8 @@ #define CLIGHT_PANEL_FIX // Overcome bug in some jandy panels where color light status of on is not in LED status +#define PLIGHT_IAQTOUCH_FIX // Overcome bug in some jandy panels where programming a light can cause other light status to be missed, by resetting poll counter on light programming. + #define TIME_CHECK_INTERVAL 3600 //#define TIME_CHECK_INTERVAL 100 // DEBUG ONLY #define ACCEPTABLE_TIME_DIFF 120 diff --git a/source/config.c b/source/config.c index e38a462..aed95f2 100644 --- a/source/config.c +++ b/source/config.c @@ -418,6 +418,13 @@ void init_parameters (struct aqconfig * parms) _cfgParams[_numCfgParams].config_mask |= CFG_GRP_ADVANCED; _cfgParams[_numCfgParams].default_value = (void *)&_dcfg_false; + _numCfgParams++; + _cfgParams[_numCfgParams].value_ptr = &_aqconfig_.light_programming_iaqualink_delay; + _cfgParams[_numCfgParams].value_type = CFG_BOOL; + _cfgParams[_numCfgParams].name = CFG_N_light_programming_iaqualink_delay; + _cfgParams[_numCfgParams].config_mask |= CFG_GRP_ADVANCED; + _cfgParams[_numCfgParams].default_value = (void *)&_dcfg_false; + _numCfgParams++; _cfgParams[_numCfgParams].value_ptr = &_aqconfig_.read_RS485_devmask; _cfgParams[_numCfgParams].value_type = CFG_BITMASK; diff --git a/source/config.h b/source/config.h index 07636d8..066e75e 100644 --- a/source/config.h +++ b/source/config.h @@ -95,6 +95,7 @@ struct aqconfig int light_programming_initial_off; bool light_programming_advance_mode; light_program_interface light_programming_interface; // 0=let AqualinkD decide, 1=allbutton, 2=onetouch(N/A), 3=AqualinkTouch, 4=iaqualink(N/A) + bool light_programming_iaqualink_delay; bool override_freeze_protect; #ifdef AQ_PDA bool pda_sleep_mode; @@ -294,6 +295,8 @@ int _numCfgParams; #define CFG_N_light_programming_initial_on "light_programming_initial_on" #define CFG_N_light_programming_initial_off "light_programming_initial_off" #define CFG_N_light_programming_advance_mode "light_programming_advance_mode" +#define CFG_N_light_programming_iaqualink_delay "light_programming_iaqualink_delay" + #define CFG_N_override_freeze_protect "override_freeze_protect" #define CFG_N_pda_sleep_mode "pda_sleep_mode" #define CFG_N_convert_mqtt_temp "mqtt_convert_temp_to_c" diff --git a/source/iaqtouch.c b/source/iaqtouch.c index 80600bd..b3aeb9a 100644 --- a/source/iaqtouch.c +++ b/source/iaqtouch.c @@ -830,10 +830,20 @@ static int _pollCnt; // running through status while programming a lighgt seems to confuse the panel, so let // other people reset our poll count. -void reset_iaqTouchPollCounter() +#ifdef PLIGHT_IAQTOUCH_FIX +void reset_iaqTouchPollCounter(int number) { - _pollCnt = 0; + _pollCnt = number; } +void delay_iaqTouch4lightProgramming() +{ + reset_iaqTouchPollCounter(-100); // Total quess at the moment. +} +int get_iaqTouchPollCounter() +{ + return _pollCnt; +} +#endif bool process_iaqtouch_packet(unsigned char *packet, int length, struct aqualinkdata *aqdata) { @@ -1107,7 +1117,7 @@ if not programming && poll packet { iaqt_queue_cmd(nextPageRequestKey); - } else if ( (_pollCnt % DEVICE_STATUS_POLL_COUNT == 0) && + } else if ( (_pollCnt > 0) && (_pollCnt % DEVICE_STATUS_POLL_COUNT == 0) && (_currentPage == IAQ_PAGE_DEVICES || _currentPage == IAQ_PAGE_DEVICES_REV_Yg) ) { iaqt_queue_cmd(KEY_IAQTCH_STATUS); // This will force us to go to status, then it'll jump back to devices, then force status again } diff --git a/source/iaqtouch.h b/source/iaqtouch.h index 8d1de61..c161695 100644 --- a/source/iaqtouch.h +++ b/source/iaqtouch.h @@ -38,6 +38,9 @@ const char *iaqt_page_name(const unsigned char page); int num2iaqtRSset (unsigned char* packetbuffer, int num, bool pad4unknownreason); int char2iaqtRSset (unsigned char* packetbuffer, char *msg, int msg_len); +void delay_iaqTouch4lightProgramming(); +int get_iaqTouchPollCounter(); + void set_iaqtouch_lastmsg(unsigned char msgtype); // This should be moved to aq_serial once finished. diff --git a/source/iaqualink.c b/source/iaqualink.c index cb94e44..dff2e3f 100644 --- a/source/iaqualink.c +++ b/source/iaqualink.c @@ -691,9 +691,12 @@ bool process_iaqualink_packet(unsigned char *packet, int length, struct aqualink push_iaqualink_cmd(_fullcmd, 19); _fullcmd[4] = 0x00; */ - push_iaqualink_cmd(cmd_getMainstatus, 2); - push_iaqualink_cmd(cmd_getTouchstatus, 2); - push_iaqualink_cmd(cmd_getAuxstatus, 2); + // If poll counter is less than 0 we are waiting for something and don't want to overload the controller with requests + if (get_iaqTouchPollCounter() > 0) { + push_iaqualink_cmd(cmd_getMainstatus, 2); + push_iaqualink_cmd(cmd_getTouchstatus, 2); + push_iaqualink_cmd(cmd_getAuxstatus, 2); + } /* LOG(IAQL_LOG, LOG_INFO,"*****************************************\n"); LOG(IAQL_LOG, LOG_INFO,"********** Send %d 0x%02hhx ************\n",ID,ID); diff --git a/source/version.h b/source/version.h index 5c222d4..47dadc3 100644 --- a/source/version.h +++ b/source/version.h @@ -4,5 +4,5 @@ #define AQUALINKD_SHORT_NAME "AqualinkD" // Use Magor . Minor . Patch -#define AQUALINKD_VERSION "3.0.3 (dev.5)" +#define AQUALINKD_VERSION "3.0.3 (dev.6)" \ No newline at end of file