mirror of https://github.com/sfeakes/AqualinkD.git
Version 2.2.0a
parent
36435205b2
commit
a7968003ea
|
@ -79,7 +79,9 @@ Designed to mimic AqualinkRS6 All Button keypad and (like the keypad) is used to
|
|||
* RS Serial protocol. AqualinkD has all Jandy control protocols except RS Serial.
|
||||
* Update homekit-aqualinkd to use new API & features.
|
||||
|
||||
# Update in (Pre) Release 2.2.0
|
||||
# Update in (Pre) Release 2.2.0a
|
||||
* Fixed RS-4 bug.
|
||||
* Increased timeout for startup probe
|
||||
* This release WILL require you to make aqualinkd.conf changes. <b>Make sure to read wiki section https://github.com/sfeakes/AqualinkD/wiki#Version_2</b>
|
||||
* Extensive work to reduce CPU cycles and unnesessary logic.
|
||||
* iAqualink Touch protocol supported for VSP & extended programming.
|
||||
|
|
|
@ -400,7 +400,7 @@ void initPanelButtons(struct aqualinkdata *aqdata, bool rs, int size, bool combo
|
|||
|
||||
aqdata->aqbuttons[index].led = &aqdata->aqualinkleds[15-1];
|
||||
aqdata->aqbuttons[index].led->state = LED_S_UNKNOWN;
|
||||
aqdata->aqbuttons[index].label = rs?name2label(BTN_POOL_HTR):BTN_PDA_POOL_HTR;
|
||||
aqdata->aqbuttons[index].label = rs?name2label(combo?BTN_POOL_HTR:BTN_TEMP1_HTR):BTN_PDA_POOL_HTR;
|
||||
aqdata->aqbuttons[index].name = BTN_POOL_HTR;
|
||||
aqdata->aqbuttons[index].code = KEY_POOL_HTR;
|
||||
aqdata->aqbuttons[index].dz_idx = DZ_NULL_IDX;
|
||||
|
@ -408,7 +408,7 @@ void initPanelButtons(struct aqualinkdata *aqdata, bool rs, int size, bool combo
|
|||
|
||||
aqdata->aqbuttons[index].led = &aqdata->aqualinkleds[17-1];
|
||||
aqdata->aqbuttons[index].led->state = LED_S_UNKNOWN;
|
||||
aqdata->aqbuttons[index].label = rs?name2label(BTN_SPA_HTR):BTN_PDA_SPA_HTR;
|
||||
aqdata->aqbuttons[index].label = rs?name2label(combo?BTN_SPA_HTR:BTN_TEMP2_HTR):BTN_PDA_SPA_HTR;
|
||||
aqdata->aqbuttons[index].name = BTN_SPA_HTR;
|
||||
aqdata->aqbuttons[index].code = KEY_SPA_HTR;
|
||||
aqdata->aqbuttons[index].dz_idx = DZ_NULL_IDX;
|
||||
|
|
|
@ -177,6 +177,9 @@
|
|||
#define BTN_SPA_HTR "Spa_Heater"
|
||||
#define BTN_SOLAR_HTR "Solar_Heater"
|
||||
|
||||
#define BTN_TEMP1_HTR "Temp1_Heater"
|
||||
#define BTN_TEMP2_HTR "Temp2_Heater"
|
||||
|
||||
#ifdef AQ_RS16
|
||||
#define BTN_AUXB1 "Aux_B1"
|
||||
#define BTN_AUXB2 "Aux_B2"
|
||||
|
|
|
@ -8,6 +8,8 @@
|
|||
#include "aq_programmer.h"
|
||||
#include "aq_panel.h"
|
||||
|
||||
#define DEFAULT_MG_NET_WAIT 2
|
||||
|
||||
#define TIME_CHECK_INTERVAL 3600
|
||||
#define ACCEPTABLE_TIME_DIFF 120
|
||||
|
||||
|
@ -15,7 +17,7 @@
|
|||
//#define TIME_CHECK_INTERVAL 100
|
||||
//#define ACCEPTABLE_TIME_DIFF 10
|
||||
|
||||
#define MAX_ZERO_READ_BEFORE_RECONNECT 2000 // 500
|
||||
#define MAX_ZERO_READ_BEFORE_RECONNECT 10000 // 2k normally
|
||||
|
||||
|
||||
//#define TOTAL_BUTTONS 12
|
||||
|
|
22
aqualinkd.c
22
aqualinkd.c
|
@ -360,7 +360,9 @@ void _processMessage(char *message, bool reset)
|
|||
|
||||
#ifdef AQ_RS16
|
||||
//if ( _aqconfig_.rs_panel_size >= 16) {
|
||||
if (PANEL_SIZE >= 16) {
|
||||
//if ( (int)PANEL_SIZE >= 16) { // NSF No idea why this fails on RS-4, but it does. Come back and find out why
|
||||
if ( 16 <= (int)PANEL_SIZE ) {
|
||||
printf("Panel size %d What the fuck am I doing here\n",PANEL_SIZE);
|
||||
if ((msg_loop & MSG_RS13BUTTON) != MSG_RS13BUTTON)
|
||||
_aqualink_data.aqbuttons[13].led->state = OFF;
|
||||
if ((msg_loop & MSG_RS14BUTTON) != MSG_RS14BUTTON)
|
||||
|
@ -1042,7 +1044,7 @@ int main(int argc, char *argv[])
|
|||
PANEL_SIZE,
|
||||
isCOMBO_PANEL?"Combo Pool/Spa":"",
|
||||
isSINGLE_DEV_PANEL?"Pool/Spa Only":"",
|
||||
isDUAL_EQPT_PANEL?"Dual Equiptment":"");
|
||||
isDUAL_EQPT_PANEL?"Dual Equipment":"");
|
||||
|
||||
LOG(AQUA_LOG,LOG_NOTICE, "Config log_level = %d\n", _aqconfig_.log_level);
|
||||
LOG(AQUA_LOG,LOG_NOTICE, "Config device_id = 0x%02hhx\n", _aqconfig_.device_id);
|
||||
|
@ -1098,6 +1100,8 @@ int main(int argc, char *argv[])
|
|||
if (_aqconfig_.readahead_b4_write == true)
|
||||
LOG(AQUA_LOG,LOG_NOTICE, "Serial Read Ahead Write = %s\n", bool2text(_aqconfig_.readahead_b4_write));
|
||||
|
||||
if (_aqconfig_.net_poll_wait != DEFAULT_MG_NET_WAIT)
|
||||
LOG(AQUA_LOG,LOG_NOTICE, "Network Poll Speed = %d\n", _aqconfig_.net_poll_wait);
|
||||
|
||||
//for (i = 0; i < TOTAL_BUTONS; i++)
|
||||
for (i = 0; i < _aqualink_data.total_buttons; i++)
|
||||
|
@ -1484,7 +1488,7 @@ void main_loop()
|
|||
}
|
||||
else if (packet_length > 0) {
|
||||
blank_read = 0;
|
||||
if (i++ > 500) { // 200 packets without a probe to BOTH ID's, give up config is wrong
|
||||
if (i++ > 1000) { // 1000 packets without a probe to BOTH ID's, give up config is wrong
|
||||
if(!got_probe) {
|
||||
LOG(AQUA_LOG,LOG_ERR, "No probe on '0x%02hhx', giving up! (please check config)\n",_aqconfig_.device_id);
|
||||
}
|
||||
|
@ -1515,11 +1519,17 @@ void main_loop()
|
|||
|
||||
LOG(AQUA_LOG,LOG_NOTICE, "Starting communication with Control Panel\n");
|
||||
|
||||
int blank_read_reconnect = MAX_ZERO_READ_BEFORE_RECONNECT;
|
||||
// Not the best way to do this, but ok for moment
|
||||
if (_aqconfig_.net_poll_wait <= 1)
|
||||
blank_read_reconnect = MAX_ZERO_READ_BEFORE_RECONNECT * 10;
|
||||
|
||||
blank_read = 0;
|
||||
// OK, Now go into infinate loop
|
||||
while (_keepRunning == true)
|
||||
{
|
||||
while ((rs_fd < 0 || blank_read >= MAX_ZERO_READ_BEFORE_RECONNECT) && _keepRunning == true)
|
||||
//printf("%d ",blank_read);
|
||||
while ((rs_fd < 0 || blank_read >= blank_read_reconnect) && _keepRunning == true)
|
||||
{
|
||||
if (rs_fd < 0)
|
||||
{
|
||||
|
@ -1549,7 +1559,7 @@ void main_loop()
|
|||
{
|
||||
// Unrecoverable read error. Force an attempt to reconnect.
|
||||
LOG(AQUA_LOG,LOG_ERR, "Bad packet length, reconnecting\n");
|
||||
blank_read = MAX_ZERO_READ_BEFORE_RECONNECT;
|
||||
blank_read = blank_read_reconnect;
|
||||
}
|
||||
else if (packet_length == 0)
|
||||
{
|
||||
|
@ -1645,7 +1655,7 @@ void main_loop()
|
|||
|
||||
//mg_mgr_poll(&mgr, 10);
|
||||
//mg_mgr_poll(&mgr, 5);
|
||||
mg_mgr_poll(&mgr, packet_length>0?0:2); // Don;t wait if we read something.
|
||||
mg_mgr_poll(&mgr, packet_length>0?0:_aqconfig_.net_poll_wait); // Don;t wait if we read something.
|
||||
//tcdrain(rs_fd); // Make sure buffer has been sent.
|
||||
//mg_mgr_poll(&mgr, 0);
|
||||
|
||||
|
|
7
config.c
7
config.c
|
@ -38,6 +38,7 @@
|
|||
#include "utils.h"
|
||||
#include "aq_serial.h"
|
||||
#include "aq_panel.h"
|
||||
#include "aqualink.h"
|
||||
|
||||
#define MAXCFGLINE 256
|
||||
|
||||
|
@ -122,7 +123,8 @@ void init_parameters (struct aqconfig * parms)
|
|||
parms->log_raw_RS_bytes = false;
|
||||
parms->readahead_b4_write = false;
|
||||
parms->sync_panel_time = true;
|
||||
|
||||
parms->net_poll_wait = DEFAULT_MG_NET_WAIT;
|
||||
|
||||
generate_mqtt_id(parms->mqtt_ID, MQTT_ID_LEN);
|
||||
}
|
||||
|
||||
|
@ -514,6 +516,9 @@ bool setConfigValue(struct aqualinkdata *aqdata, char *param, char *value) {
|
|||
} else if (strncasecmp (param, "keep_paneltime_synced", 21) == 0) {
|
||||
_aqconfig_.sync_panel_time = text2bool(value);
|
||||
rtn=true;
|
||||
} else if (strncasecmp (param, "network_poll_speed", 18) == 0) {
|
||||
_aqconfig_.net_poll_wait = strtoul(value, NULL, 10);
|
||||
rtn=true;
|
||||
}
|
||||
|
||||
else if (strncasecmp(param, "button_", 7) == 0) {
|
||||
|
|
1
config.h
1
config.h
|
@ -73,6 +73,7 @@ struct aqconfig
|
|||
bool readahead_b4_write;
|
||||
bool mqtt_timed_update;
|
||||
bool sync_panel_time;
|
||||
int net_poll_wait;
|
||||
};
|
||||
|
||||
#ifndef CONFIG_C
|
||||
|
|
|
@ -549,7 +549,8 @@ bool process_iaqtouch_packet(unsigned char *packet, int length, struct aqualinkd
|
|||
// if we get a button with 0x00 state on Light Page, that's the end of page.
|
||||
if (_currentPageLoading == IAQ_PAGE_COLOR_LIGHT) {
|
||||
if (packet[7] == 0x00) {
|
||||
printf("** MANUAL PAGE END\n");
|
||||
//printf("** MANUAL PAGE END\n");
|
||||
LOG(IAQT_LOG,LOG_DEBUG, "MANUAL PAGE END\n");
|
||||
_currentPage = _currentPageLoading;
|
||||
_currentPageLoading = NUL;
|
||||
processPage(aq_data);
|
||||
|
@ -561,8 +562,8 @@ bool process_iaqtouch_packet(unsigned char *packet, int length, struct aqualinkd
|
|||
}
|
||||
|
||||
if (packet[3] == 0x29) {
|
||||
printf("***** iAqualink Touch STARTUP Message ******* \n");
|
||||
|
||||
//printf("***** iAqualink Touch STARTUP Message ******* \n");
|
||||
LOG(IAQT_LOG,LOG_DEBUG, "STARTUP Message\n");
|
||||
queueGetProgramData(IAQTOUCH, aq_data);
|
||||
|
||||
//aq_programmer(AQ_SET_IAQTOUCH_SET_TIME, NULL, aq_data);
|
||||
|
|
|
@ -387,7 +387,8 @@ bool log_qeuiptment_status(struct aqualinkdata *aq_data)
|
|||
}
|
||||
|
||||
#ifdef AQ_RS16
|
||||
else if (PANEL_SIZE >= 16 ) { // Run over devices that have no status LED's on RS12&16 panels.
|
||||
//else if (PANEL_SIZE >= 16 ) { // This fails on RS4, comeback and find out why. // Run over devices that have no status LED's on RS12&16 panels.
|
||||
else if ( 16 <= (int)PANEL_SIZE ) {
|
||||
int j;
|
||||
for (i=2; i <= ONETOUCH_LINES; i++) {
|
||||
for (j = aq_data->rs16_vbutton_start; j <= aq_data->rs16_vbutton_end; j++) {
|
||||
|
|
Binary file not shown.
Binary file not shown.
Loading…
Reference in New Issue