mirror of https://github.com/sfeakes/AqualinkD.git
parent
d2c5df8e00
commit
2ddcfa7f8a
36
Makefile
36
Makefile
|
@ -1,8 +1,15 @@
|
|||
#
|
||||
# Options
|
||||
# make DEBUG=true // Turn on timing statments
|
||||
|
||||
# Valid flags for AQ_FLAGS
|
||||
# AQ_DEBUG = true
|
||||
AQ_RS16 = true
|
||||
AQ_PDA = true
|
||||
|
||||
|
||||
# make EXFLAGS="-D BETA_PDA_AUTOLABEL" // Add compile flags
|
||||
#
|
||||
|
||||
# define the C compiler to use
|
||||
CC = gcc
|
||||
|
||||
|
@ -12,9 +19,7 @@ LIBS := -l pthread -l m
|
|||
|
||||
# debug of not
|
||||
#DBG = -g -O0 -fsanitize=address
|
||||
#DBG = -g -O0
|
||||
#DBG = -D ONETOUCH
|
||||
#DBG =
|
||||
|
||||
|
||||
# USe below to remove unused functions and global variables.
|
||||
#LFLAGS = -Wl,--gc-sections,--print-gc-sections
|
||||
|
@ -27,20 +32,37 @@ GCCFLAGS = -Wall -O3 $(EXFLAGS)
|
|||
|
||||
#CFLAGS = -Wall -g $(LIBS)
|
||||
#CFLAGS = -Wall -g $(LIBS) -std=gnu11
|
||||
#CFLAGS = $(GCCFLAGS) $(DBG) $(AQ_FLAGS) $(LIBS) -D MG_DISABLE_MD5 -D MG_DISABLE_HTTP_DIGEST_AUTH -D MG_DISABLE_MD5 -D MG_DISABLE_JSON_RPC
|
||||
CFLAGS = $(GCCFLAGS) $(DBG) $(LIBS) -D MG_DISABLE_MD5 -D MG_DISABLE_HTTP_DIGEST_AUTH -D MG_DISABLE_MD5 -D MG_DISABLE_JSON_RPC
|
||||
|
||||
|
||||
# Add inputs and outputs from these tool invocations to the build variables
|
||||
|
||||
# define the C source files
|
||||
SRCS = aqualinkd.c utils.c config.c aq_serial.c init_buttons.c aq_programmer.c net_services.c json_messages.c pda.c pda_menu.c \
|
||||
pda_aq_programmer.c devices_jandy.c onetouch.c onetouch_aq_programmer.c packetLogger.c devices_pentair.c color_lights.c mongoose.c
|
||||
#SRCS = aqualinkd.c utils.c config.c aq_serial.c init_buttons.c aq_programmer.c net_services.c json_messages.c pda.c pda_menu.c \
|
||||
# pda_aq_programmer.c devices_jandy.c onetouch.c onetouch_aq_programmer.c packetLogger.c devices_pentair.c color_lights.c mongoose.c
|
||||
|
||||
SRCS = aqualinkd.c utils.c config.c aq_serial.c init_buttons.c aq_programmer.c net_services.c json_messages.c \
|
||||
devices_jandy.c onetouch.c onetouch_aq_programmer.c packetLogger.c devices_pentair.c color_lights.c mongoose.c
|
||||
DBG_SRC = timespec_subtract.c
|
||||
|
||||
ifeq ($(AQ_PDA), true)
|
||||
SRCS := $(SRCS) pda.c pda_menu.c pda_aq_programmer.c
|
||||
CFLAGS := $(CFLAGS) -D AQ_PDA
|
||||
endif
|
||||
|
||||
ifeq ($(AQ_RS16), true)
|
||||
CFLAGS := $(CFLAGS) -D AQ_RS16
|
||||
endif
|
||||
|
||||
ifeq ($(AQ_DEBUG), true)
|
||||
DEBUG=true
|
||||
endif
|
||||
|
||||
# If run with `make DEBUG=true` add debug files and pass parameter for compile
|
||||
ifeq ($(DEBUG), true)
|
||||
SRCS := $(SRCS) $(DBG_SRC)
|
||||
CFLAGS := -g -O0 $(CFLAGS) -D AQ_DEBUG
|
||||
CFLAGS := -g -O0 $(CFLAGS) -D AQ_DEBUG
|
||||
endif
|
||||
|
||||
SL_SRC = serial_logger.c aq_serial.c utils.c packetLogger.c
|
||||
|
|
|
@ -72,12 +72,16 @@ Designed to mimic AqualinkRS6 All Button keypad and (like the keypad) is used to
|
|||
* http://aqualink.ip/simulator.html <- (RS8 All Button Control Panel simulator)
|
||||
* http://aqualink.ip/debug.html <- (Turn on/off debug/serial debug & download logs)
|
||||
#<a name="release"></a>
|
||||
# Update in Release 2.0.1
|
||||
# Update in Release 2.1.0
|
||||
* Big update, lots of core changes, <b>please read wiki section https://github.com/sfeakes/AqualinkD/wiki#Version_2</b>
|
||||
* Full Variable Speed Pump support. (Can read,set & change RPM,GPM)
|
||||
* Full support for all Colored Lights (even if Jandy Control Panel doesn't support them)
|
||||
* Chemlink pH & ORP now supported. (along with posting MQTT information)
|
||||
* There are some configuration changes, make sure to read wiki (link above)
|
||||
* RS12 & RS16 Panels now supported. (RS16 will also need `extended_device_id` set for full AUXB5-B8 support)
|
||||
* New UI option(s) `turn_on_sensortiles = true` & `show_vsp_gpm=false` in `config.js`
|
||||
* Added compile flags. If you make your own aqualinkd and have no need for PDA or RS16 support, edit the Makefile.
|
||||
* Completley new API.
|
||||
# Update in Release 1.3.9a
|
||||
* Improved Debugging for serial.
|
||||
* Added panel Timeout mode support to UI and MQTT
|
||||
|
|
196
aq_programmer.c
196
aq_programmer.c
|
@ -26,12 +26,17 @@
|
|||
#include "utils.h"
|
||||
#include "aq_programmer.h"
|
||||
#include "aq_serial.h"
|
||||
#include "pda.h"
|
||||
#include "pda_menu.h"
|
||||
|
||||
#ifdef AQ_PDA
|
||||
#include "pda.h"
|
||||
#include "pda_menu.h"
|
||||
#include "pda_aq_programmer.h"
|
||||
#endif
|
||||
|
||||
#include "init_buttons.h"
|
||||
#include "pda_aq_programmer.h"
|
||||
#include "onetouch_aq_programmer.h"
|
||||
#include "color_lights.h"
|
||||
#include "config.h"
|
||||
|
||||
#ifdef AQ_DEBUG
|
||||
#include <time.h>
|
||||
|
@ -56,7 +61,9 @@ void *get_aqualink_aux_labels( void *ptr );
|
|||
//void *threadded_send_cmd( void *ptr );
|
||||
void *set_aqualink_light_programmode( void *ptr );
|
||||
void *set_aqualink_light_colormode( void *ptr );
|
||||
#ifdef AQ_PDA
|
||||
void *set_aqualink_PDA_init( void *ptr );
|
||||
#endif
|
||||
void *set_aqualink_SWG( void *ptr );
|
||||
void *set_aqualink_boost( void *ptr );
|
||||
void *set_aqualink_pump_rpm( void *ptr );
|
||||
|
@ -302,27 +309,32 @@ int setpoint_check(int type, int value, struct aqualinkdata *aqdata)
|
|||
return rtn;
|
||||
}
|
||||
|
||||
void queueGetExtendedProgramData(emulation_type source_type, struct aqualinkdata *aq_data, bool labels)
|
||||
void queueGetProgramData(emulation_type source_type, struct aqualinkdata *aq_data)
|
||||
{
|
||||
// Wait for onetouch if enabeled.
|
||||
if ( source_type == ALLBUTTON && ( onetouch_enabled() == false || extended_device_id_programming() == false ) ) {
|
||||
aq_send_cmd(NUL);
|
||||
aq_programmer(AQ_GET_POOL_SPA_HEATER_TEMPS, NULL, aq_data);
|
||||
aq_programmer(AQ_GET_FREEZE_PROTECT_TEMP, NULL, aq_data);
|
||||
if (labels)
|
||||
if (_aqconfig_.use_panel_aux_labels)
|
||||
aq_programmer(AQ_GET_AUX_LABELS, NULL, aq_data);
|
||||
} else if ( source_type == ONETOUCH) {
|
||||
aq_programmer(AQ_GET_ONETOUCH_SETPOINTS, NULL, aq_data);
|
||||
if (_aqconfig_.use_panel_aux_labels)
|
||||
aq_programmer(AQ_GET_AUX_LABELS, NULL, aq_data);
|
||||
#ifdef AQ_PDA
|
||||
} else if ( source_type == AQUAPDA) {
|
||||
aq_programmer(AQ_PDA_INIT, NULL, aq_data);
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
void queueGetProgramData(emulation_type source_type, struct aqualinkdata *aq_data)
|
||||
{
|
||||
queueGetExtendedProgramData(source_type, aq_data, false);
|
||||
}
|
||||
|
||||
*/
|
||||
/*
|
||||
void kick_aq_program_thread(struct aqualinkdata *aq_data)
|
||||
{
|
||||
|
@ -361,15 +373,16 @@ void kick_aq_program_thread(struct aqualinkdata *aq_data, emulation_type source_
|
|||
logMessage(LOG_DEBUG, "Kicking OneTouch thread %d,%p\n",aq_data->active_thread.ptype, aq_data->active_thread.thread_id);
|
||||
pthread_cond_broadcast(&aq_data->active_thread.thread_cond);
|
||||
}
|
||||
else if (source_type == AQUAPDA && !in_ot_programming_mode(aq_data)) {
|
||||
logMessage(LOG_DEBUG, "Kicking PDA thread %d,%p\n",aq_data->active_thread.ptype, aq_data->active_thread.thread_id);
|
||||
pthread_cond_broadcast(&aq_data->active_thread.thread_cond);
|
||||
}
|
||||
else if (source_type == ALLBUTTON && !in_ot_programming_mode(aq_data)) {
|
||||
logMessage(LOG_DEBUG, "Kicking RS thread %d,%p message '%s'\n",aq_data->active_thread.ptype, aq_data->active_thread.thread_id,aq_data->last_message);
|
||||
pthread_cond_broadcast(&aq_data->active_thread.thread_cond);
|
||||
}
|
||||
|
||||
#ifdef AQ_PDA
|
||||
else if (source_type == AQUAPDA && !in_ot_programming_mode(aq_data)) {
|
||||
logMessage(LOG_DEBUG, "Kicking PDA thread %d,%p\n",aq_data->active_thread.ptype, aq_data->active_thread.thread_id);
|
||||
pthread_cond_broadcast(&aq_data->active_thread.thread_cond);
|
||||
}
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -402,6 +415,7 @@ void aq_programmer(program_type r_type, char *args, struct aqualinkdata *aq_data
|
|||
}
|
||||
}
|
||||
|
||||
#ifdef AQ_PDA
|
||||
// Check we are doing something valid request
|
||||
if (pda_mode() == true) {
|
||||
pda_reset_sleep();
|
||||
|
@ -420,12 +434,9 @@ void aq_programmer(program_type r_type, char *args, struct aqualinkdata *aq_data
|
|||
type != AQ_SET_BOOST) {
|
||||
logMessage(LOG_ERR, "Selected Programming mode '%d' not supported with PDA mode control panel\n",type);
|
||||
return;
|
||||
} /*else if (onetouch_enabled() == false &&
|
||||
( type != AQ_SET_ONETOUCH_PUMP_RPM || type != AQ_SET_ONETOUCH_MACRO || type != AQ_GET_ONETOUCH_SETPOINTS)) {
|
||||
logMessage(LOG_ERR, "Selected Programming mode '%d' not supported without OneTouch mode (extra_device_id) enabled\n",type);
|
||||
return;
|
||||
}*/
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
programmingthread->aq_data = aq_data;
|
||||
programmingthread->thread_id = 0;
|
||||
|
@ -516,36 +527,12 @@ void aq_programmer(program_type r_type, char *args, struct aqualinkdata *aq_data
|
|||
return;
|
||||
}
|
||||
break;
|
||||
case AQ_PDA_INIT:
|
||||
if( pthread_create( &programmingthread->thread_id , NULL , set_aqualink_PDA_init, (void*)programmingthread) < 0) {
|
||||
logMessage (LOG_ERR, "could not create thread\n");
|
||||
return;
|
||||
}
|
||||
break;
|
||||
case AQ_PDA_WAKE_INIT:
|
||||
if( pthread_create( &programmingthread->thread_id , NULL , set_aqualink_PDA_wakeinit, (void*)programmingthread) < 0) {
|
||||
logMessage (LOG_ERR, "could not create thread\n");
|
||||
return;
|
||||
}
|
||||
break;
|
||||
case AQ_SET_SWG_PERCENT:
|
||||
if( pthread_create( &programmingthread->thread_id , NULL , set_aqualink_SWG, (void*)programmingthread) < 0) {
|
||||
logMessage (LOG_ERR, "could not create thread\n");
|
||||
return;
|
||||
}
|
||||
break;
|
||||
case AQ_PDA_DEVICE_STATUS:
|
||||
if( pthread_create( &programmingthread->thread_id , NULL , get_aqualink_PDA_device_status, (void*)programmingthread) < 0) {
|
||||
logMessage (LOG_ERR, "could not create thread\n");
|
||||
return;
|
||||
}
|
||||
break;
|
||||
case AQ_PDA_DEVICE_ON_OFF:
|
||||
if( pthread_create( &programmingthread->thread_id , NULL , set_aqualink_PDA_device_on_off, (void*)programmingthread) < 0) {
|
||||
logMessage (LOG_ERR, "could not create thread\n");
|
||||
return;
|
||||
}
|
||||
break;
|
||||
case AQ_GET_AUX_LABELS:
|
||||
if( pthread_create( &programmingthread->thread_id , NULL , get_aqualink_aux_labels, (void*)programmingthread) < 0) {
|
||||
logMessage (LOG_ERR, "could not create thread\n");
|
||||
|
@ -606,6 +593,34 @@ void aq_programmer(program_type r_type, char *args, struct aqualinkdata *aq_data
|
|||
return;
|
||||
}
|
||||
break;
|
||||
|
||||
#ifdef AQ_PDA
|
||||
case AQ_PDA_INIT:
|
||||
if( pthread_create( &programmingthread->thread_id , NULL , set_aqualink_PDA_init, (void*)programmingthread) < 0) {
|
||||
logMessage (LOG_ERR, "could not create thread\n");
|
||||
return;
|
||||
}
|
||||
break;
|
||||
case AQ_PDA_WAKE_INIT:
|
||||
if( pthread_create( &programmingthread->thread_id , NULL , set_aqualink_PDA_wakeinit, (void*)programmingthread) < 0) {
|
||||
logMessage (LOG_ERR, "could not create thread\n");
|
||||
return;
|
||||
}
|
||||
break;
|
||||
case AQ_PDA_DEVICE_STATUS:
|
||||
if( pthread_create( &programmingthread->thread_id , NULL , get_aqualink_PDA_device_status, (void*)programmingthread) < 0) {
|
||||
logMessage (LOG_ERR, "could not create thread\n");
|
||||
return;
|
||||
}
|
||||
break;
|
||||
case AQ_PDA_DEVICE_ON_OFF:
|
||||
if( pthread_create( &programmingthread->thread_id , NULL , set_aqualink_PDA_device_on_off, (void*)programmingthread) < 0) {
|
||||
logMessage (LOG_ERR, "could not create thread\n");
|
||||
return;
|
||||
}
|
||||
break;
|
||||
#endif
|
||||
|
||||
default:
|
||||
logMessage (LOG_ERR, "Didn't understand programming mode type\n");
|
||||
break;
|
||||
|
@ -664,7 +679,8 @@ void waitForSingleThreadOrTerminate(struct programmingThreadCtrl *threadCtrl, pr
|
|||
clock_gettime(CLOCK_REALTIME, &threadCtrl->aq_data->start_active_time);
|
||||
#endif
|
||||
|
||||
//logMessage (LOG_DEBUG, "Thread %d is active\n", threadCtrl->aq_data->active_thread.thread_id);
|
||||
logMessage (LOG_NOTICE, "Programming: %s\n", ptypeName(threadCtrl->aq_data->active_thread.ptype));
|
||||
|
||||
logMessage (LOG_DEBUG, "Thread %d,%p is active (%s)\n",
|
||||
threadCtrl->aq_data->active_thread.ptype,
|
||||
threadCtrl->aq_data->active_thread.thread_id,
|
||||
|
@ -835,11 +851,13 @@ STOP BOOST POOL
|
|||
*/
|
||||
int val = atoi((char*)threadCtrl->thread_args);
|
||||
|
||||
#ifdef AQ_PDA
|
||||
if (pda_mode() == true) {
|
||||
set_PDA_aqualink_boost(aq_data, val);
|
||||
cleanAndTerminateThread(threadCtrl);
|
||||
return ptr;
|
||||
}
|
||||
#endif
|
||||
|
||||
logMessage(LOG_DEBUG, "programming BOOST to %s\n", val==true?"On":"Off");
|
||||
|
||||
|
@ -923,13 +941,15 @@ void *set_aqualink_SWG( void *ptr )
|
|||
int val = atoi((char*)threadCtrl->thread_args);
|
||||
val = setpoint_check(SWG_SETPOINT, val, aq_data);
|
||||
|
||||
#ifdef AQ_PDA
|
||||
if (pda_mode() == true) {
|
||||
set_PDA_aqualink_SWG_setpoint(aq_data, val);
|
||||
cleanAndTerminateThread(threadCtrl);
|
||||
return ptr;
|
||||
}
|
||||
#endif
|
||||
|
||||
logMessage(LOG_NOTICE, "programming SWG percent to %d\n", val);
|
||||
//logMessage(LOG_NOTICE, "programming SWG percent to %d\n", val);
|
||||
|
||||
if ( select_menu_item(aq_data, "SET AQUAPURE") != true ) {
|
||||
logMessage(LOG_WARNING, "Could not select SET AQUAPURE menu\n");
|
||||
|
@ -994,11 +1014,13 @@ void *get_aqualink_aux_labels( void *ptr )
|
|||
|
||||
waitForSingleThreadOrTerminate(threadCtrl, AQ_GET_AUX_LABELS);
|
||||
|
||||
#ifdef AQ_PDA
|
||||
if (pda_mode() == true) {
|
||||
get_PDA_aqualink_aux_labels(aq_data);
|
||||
cleanAndTerminateThread(threadCtrl);
|
||||
return ptr;
|
||||
}
|
||||
#endif
|
||||
|
||||
if ( select_menu_item(aq_data, "REVIEW") != true ) {
|
||||
logMessage(LOG_WARNING, "Could not select REVIEW menu\n");
|
||||
|
@ -1037,7 +1059,7 @@ void *set_aqualink_light_colormode( void *ptr )
|
|||
int btn = atoi(&buf[5]);
|
||||
int typ = atoi(&buf[10]);
|
||||
|
||||
if (btn < 0 || btn >= TOTAL_BUTTONS ) {
|
||||
if (btn < 0 || btn >= aq_data->total_buttons ) {
|
||||
logMessage(LOG_ERR, "Can't program light mode on button %d\n", btn);
|
||||
cleanAndTerminateThread(threadCtrl);
|
||||
return ptr;
|
||||
|
@ -1055,7 +1077,7 @@ void *set_aqualink_light_colormode( void *ptr )
|
|||
cleanAndTerminateThread(threadCtrl);
|
||||
return ptr;
|
||||
} else {
|
||||
logMessage(LOG_NOTICE, "Light Programming #: %d, on button: %s, color light type: %d, name '%s'\n", val, button->label, typ, mode_name);
|
||||
logMessage(LOG_INFO, "Light Programming #: %d, on button: %s, color light type: %d, name '%s'\n", val, button->label, typ, mode_name);
|
||||
}
|
||||
|
||||
// Simply turn the light off if value is 0
|
||||
|
@ -1128,7 +1150,7 @@ void *set_aqualink_light_programmode( void *ptr )
|
|||
int iOff = atoi(&buf[15]);
|
||||
float pmode = atof(&buf[20]);
|
||||
|
||||
if (btn < 0 || btn >= TOTAL_BUTTONS ) {
|
||||
if (btn < 0 || btn >= aq_data->total_buttons ) {
|
||||
logMessage(LOG_ERR, "Can't program light mode on button %d\n", btn);
|
||||
cleanAndTerminateThread(threadCtrl);
|
||||
return ptr;
|
||||
|
@ -1137,7 +1159,7 @@ void *set_aqualink_light_programmode( void *ptr )
|
|||
aqkey *button = &aq_data->aqbuttons[btn];
|
||||
unsigned char code = button->code;
|
||||
|
||||
logMessage(LOG_NOTICE, "Light Programming #: %d, on button: %s, with pause mode: %f (initial on=%d, initial off=%d)\n", val, button->label, pmode, iOn, iOff);
|
||||
logMessage(LOG_INFO, "Light Programming #: %d, on button: %s, with pause mode: %f (initial on=%d, initial off=%d)\n", val, button->label, pmode, iOn, iOff);
|
||||
|
||||
// Simply turn the light off if value is 0
|
||||
if (val <= 0) {
|
||||
|
@ -1211,11 +1233,13 @@ void *set_aqualink_pool_heater_temps( void *ptr )
|
|||
*/
|
||||
val = setpoint_check(POOL_HTR_SETOINT, val, aq_data);
|
||||
|
||||
#ifdef AQ_PDA
|
||||
if (pda_mode() == true) {
|
||||
set_PDA_aqualink_heater_setpoint(aq_data, val, true);
|
||||
cleanAndTerminateThread(threadCtrl);
|
||||
return ptr;
|
||||
}
|
||||
#endif
|
||||
|
||||
// NSF IF in TEMP1 / TEMP2 mode, we need C range of 1 to 40 is 2 to 40 for TEMP1, 1 to 39 TEMP2
|
||||
if (aq_data->single_device == true ){
|
||||
|
@ -1284,12 +1308,13 @@ void *set_aqualink_spa_heater_temps( void *ptr )
|
|||
}*/
|
||||
val = setpoint_check(SPA_HTR_SETOINT, val, aq_data);
|
||||
|
||||
#ifdef AQ_PDA
|
||||
if (pda_mode() == true) {
|
||||
set_PDA_aqualink_heater_setpoint(aq_data, val, false);
|
||||
cleanAndTerminateThread(threadCtrl);
|
||||
return ptr;
|
||||
}
|
||||
|
||||
#endif
|
||||
// NSF IF in TEMP1 / TEMP2 mode, we need C range of 1 to 40 is 2 to 40 for TEMP1, 1 to 39 TEMP2
|
||||
|
||||
if (aq_data->single_device == true ){
|
||||
|
@ -1360,12 +1385,13 @@ void *set_aqualink_freeze_heater_temps( void *ptr )
|
|||
|
||||
logMessage(LOG_DEBUG, "Setting sfreeze protection to %d\n", val);
|
||||
|
||||
#ifdef AQ_PDA
|
||||
if (pda_mode() == true) {
|
||||
set_PDA_aqualink_freezeprotect_setpoint(aq_data, val);
|
||||
cleanAndTerminateThread(threadCtrl);
|
||||
return ptr;
|
||||
}
|
||||
|
||||
#endif
|
||||
//setAqualinkTemp(aq_data, "SYSTEM SETUP", "FRZ PROTECT", "TEMP SETTING", "FRZ", val);
|
||||
if ( select_menu_item(aq_data, "SYSTEM SETUP") != true ) {
|
||||
logMessage(LOG_WARNING, "Could not select SYSTEM SETUP menu\n");
|
||||
|
@ -1404,7 +1430,7 @@ void *set_aqualink_time( void *ptr )
|
|||
struct aqualinkdata *aq_data = threadCtrl->aq_data;
|
||||
|
||||
waitForSingleThreadOrTerminate(threadCtrl, AQ_SET_TIME);
|
||||
logMessage(LOG_NOTICE, "Setting time on aqualink\n");
|
||||
//logMessage(LOG_NOTICE, "Setting time on aqualink\n");
|
||||
|
||||
time_t now = time(0); // get time now
|
||||
struct tm *result = localtime(&now);
|
||||
|
@ -1482,8 +1508,9 @@ void *get_aqualink_pool_spa_heater_temps( void *ptr )
|
|||
struct aqualinkdata *aq_data = threadCtrl->aq_data;
|
||||
|
||||
waitForSingleThreadOrTerminate(threadCtrl, AQ_GET_POOL_SPA_HEATER_TEMPS);
|
||||
logMessage(LOG_NOTICE, "Getting pool & spa heat setpoints from aqualink\n");
|
||||
//logMessage(LOG_NOTICE, "Getting pool & spa heat setpoints from aqualink\n");
|
||||
|
||||
#ifdef AQ_PDA
|
||||
if (pda_mode() == true) {
|
||||
if (!get_PDA_aqualink_pool_spa_heater_temps(aq_data)) {
|
||||
logMessage(LOG_ERR, "Error Getting PDA pool & spa heat protection setpoints\n");
|
||||
|
@ -1491,6 +1518,7 @@ void *get_aqualink_pool_spa_heater_temps( void *ptr )
|
|||
cleanAndTerminateThread(threadCtrl);
|
||||
return ptr;
|
||||
}
|
||||
#endif
|
||||
|
||||
if ( select_menu_item(aq_data, "REVIEW") != true ) {
|
||||
logMessage(LOG_WARNING, "Could not select REVIEW menu\n");
|
||||
|
@ -1524,9 +1552,9 @@ void *get_freeze_protect_temp( void *ptr )
|
|||
struct aqualinkdata *aq_data = threadCtrl->aq_data;
|
||||
|
||||
waitForSingleThreadOrTerminate(threadCtrl, AQ_GET_FREEZE_PROTECT_TEMP);
|
||||
logMessage(LOG_NOTICE, "Getting freeze protection setpoints\n");
|
||||
|
||||
//logMessage(LOG_NOTICE, "Getting freeze protection setpoints\n");
|
||||
|
||||
#ifdef AQ_PDA
|
||||
if (pda_mode() == true) {
|
||||
if (! get_PDA_freeze_protect_temp(aq_data)) {
|
||||
logMessage(LOG_ERR, "Error Getting PDA freeze protection setpoints\n");
|
||||
|
@ -1534,6 +1562,7 @@ void *get_freeze_protect_temp( void *ptr )
|
|||
cleanAndTerminateThread(threadCtrl);
|
||||
return ptr;
|
||||
}
|
||||
#endif
|
||||
|
||||
if ( select_menu_item(aq_data, "REVIEW") != true ) {
|
||||
logMessage(LOG_WARNING, "Could not select REVIEW menu\n");
|
||||
|
@ -1641,12 +1670,14 @@ void _waitfor_queue2empty(bool longwait)
|
|||
}
|
||||
|
||||
if (_pgm_command != NUL) {
|
||||
#ifdef AQ_PDA
|
||||
if (pda_mode()) {
|
||||
// Wait for longer in PDA mode since it's slower.
|
||||
while ( (_pgm_command != NUL) && ( i++ < (150*(longwait?2:1)) ) ) {
|
||||
delay(100);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
logMessage(LOG_WARNING, "Send command Queue did not empty, timeout\n");
|
||||
}
|
||||
|
||||
|
@ -1971,23 +2002,8 @@ const char *ptypeName(program_type type)
|
|||
case AQ_SET_LIGHTCOLOR_MODE:
|
||||
return "Set light color (using Panel)";
|
||||
break;
|
||||
case AQ_PDA_INIT:
|
||||
return "Init PDA";
|
||||
break;
|
||||
case AQ_SET_SWG_PERCENT:
|
||||
case AQ_SET_SWG_PERCENT:
|
||||
return "Set SWG percent";
|
||||
break;
|
||||
case AQ_PDA_DEVICE_STATUS:
|
||||
return "Get PDA Device status";
|
||||
break;
|
||||
case AQ_PDA_DEVICE_ON_OFF:
|
||||
return "Switch PDA device on/off";
|
||||
break;
|
||||
case AQ_GET_AUX_LABELS:
|
||||
return "Get AUX labels";
|
||||
break;
|
||||
case AQ_PDA_WAKE_INIT:
|
||||
return "PDA init after wake";
|
||||
break;
|
||||
case AQ_SET_BOOST:
|
||||
return "SWG Boost";
|
||||
|
@ -2019,6 +2035,23 @@ const char *ptypeName(program_type type)
|
|||
case AQ_SET_ONETOUCH_SPA_HEATER_TEMP:
|
||||
return "Set OneTouch Spa Heater Temp";
|
||||
break;
|
||||
#ifdef AQ_PDA
|
||||
case AQ_PDA_INIT:
|
||||
return "Init PDA";
|
||||
break;
|
||||
case AQ_PDA_DEVICE_STATUS:
|
||||
return "Get PDA Device status";
|
||||
break;
|
||||
case AQ_PDA_DEVICE_ON_OFF:
|
||||
return "Switch PDA device on/off";
|
||||
break;
|
||||
case AQ_GET_AUX_LABELS:
|
||||
return "Get AUX labels";
|
||||
break;
|
||||
case AQ_PDA_WAKE_INIT:
|
||||
return "PDA init after wake";
|
||||
break;
|
||||
#endif
|
||||
case AQP_NULL:
|
||||
default:
|
||||
return "Unknown";
|
||||
|
@ -2033,7 +2066,9 @@ const char *programtypeDisplayName(program_type type)
|
|||
case AQ_GET_POOL_SPA_HEATER_TEMPS:
|
||||
case AQ_GET_ONETOUCH_SETPOINTS:
|
||||
case AQ_GET_FREEZE_PROTECT_TEMP:
|
||||
#ifdef AQ_PDA
|
||||
case AQ_PDA_INIT:
|
||||
#endif
|
||||
return "Programming: retrieving setpoints";
|
||||
break;
|
||||
case AQ_SET_ONETOUCH_TIME:
|
||||
|
@ -2064,20 +2099,11 @@ const char *programtypeDisplayName(program_type type)
|
|||
case AQ_SET_ONETOUCH_SWG_PERCENT:
|
||||
return "Programming: setting SWG percent";
|
||||
break;
|
||||
case AQ_PDA_DEVICE_STATUS:
|
||||
return "Programming: retrieving PDA Device status";
|
||||
break;
|
||||
case AQ_PDA_DEVICE_ON_OFF:
|
||||
return "Programming: setting device on/off";
|
||||
break;
|
||||
case AQ_GET_AUX_LABELS:
|
||||
return "Programming: retrieving AUX labels";
|
||||
break;
|
||||
case AQ_PDA_WAKE_INIT:
|
||||
return "Programming: PDA wakeup";
|
||||
break;
|
||||
case AQ_SET_BOOST:
|
||||
case AQ_SET_ONETOUCH_BOOST:
|
||||
case AQ_SET_BOOST:
|
||||
case AQ_SET_ONETOUCH_BOOST:
|
||||
return "Programming: setting SWG Boost";
|
||||
break;
|
||||
case AQ_SET_ONETOUCH_PUMP_RPM:
|
||||
|
@ -2086,7 +2112,17 @@ const char *programtypeDisplayName(program_type type)
|
|||
case AQ_SET_ONETOUCH_MACRO:
|
||||
return "Programming: setting OneTouch Macro";
|
||||
break;
|
||||
|
||||
#ifdef AQ_PDA
|
||||
case AQ_PDA_DEVICE_STATUS:
|
||||
return "Programming: retrieving PDA Device status";
|
||||
break;
|
||||
case AQ_PDA_DEVICE_ON_OFF:
|
||||
return "Programming: setting device on/off";
|
||||
break;
|
||||
case AQ_PDA_WAKE_INIT:
|
||||
return "Programming: PDA wakeup";
|
||||
break;
|
||||
#endif
|
||||
default:
|
||||
return "Programming: please wait!";
|
||||
break;
|
||||
|
|
|
@ -82,7 +82,7 @@ void kick_aq_program_thread(struct aqualinkdata *aq_data, emulation_type source_
|
|||
bool in_ot_programming_mode(struct aqualinkdata *aq_data);
|
||||
void aq_send_cmd(unsigned char cmd);
|
||||
void queueGetProgramData(emulation_type source_type, struct aqualinkdata *aq_data);
|
||||
void queueGetExtendedProgramData(emulation_type source_type, struct aqualinkdata *aq_data, bool labels);
|
||||
//void queueGetExtendedProgramData(emulation_type source_type, struct aqualinkdata *aq_data, bool labels);
|
||||
unsigned char pop_aq_cmd(struct aqualinkdata *aq_data);
|
||||
|
||||
|
||||
|
|
15
aq_serial.c
15
aq_serial.c
|
@ -57,9 +57,8 @@ bool onetouch_mode()
|
|||
#endif
|
||||
*/
|
||||
|
||||
#ifdef AQ_PDA
|
||||
bool _pda_mode = false;
|
||||
bool _onetouch_enabled = false;
|
||||
bool _extended_device_id_programming = false;
|
||||
|
||||
void set_pda_mode(bool mode)
|
||||
{
|
||||
|
@ -72,6 +71,11 @@ bool pda_mode()
|
|||
{
|
||||
return _pda_mode;
|
||||
}
|
||||
#endif
|
||||
|
||||
bool _onetouch_enabled = false;
|
||||
bool _extended_device_id_programming = false;
|
||||
|
||||
|
||||
void set_onetouch_enabled(bool mode)
|
||||
{
|
||||
|
@ -505,6 +509,13 @@ void _send_ack(int fd, unsigned char ack_type, unsigned char command)
|
|||
ackPacket[5] = ack_type;
|
||||
ackPacket[6] = command;
|
||||
ackPacket[7] = generate_checksum(ackPacket, length-1);
|
||||
if (command == DLE) { // We shuld probably also check the ack type as well, just for future proofing.
|
||||
// 0x10(DLE) that's not part of the headder or footer needs to be escaped AFTER with NUL, so shif everyting uo one
|
||||
ackPacket[8] = ackPacket[7]; // move the caculated checksum
|
||||
ackPacket[7] = NUL; // escape the DLE
|
||||
ackPacket[9] = DLE; // add new end sequence
|
||||
ackPacket[10] = ETX; // add new end sequence
|
||||
}
|
||||
}
|
||||
|
||||
//printf("***Send ACK (%s) ***\n",(ack_type==ACK_NORMAL?"Normal":(ack_type==ACK_SCREEN_BUSY?"ScreenBusy":"ScreenBusyDisplay")) );
|
||||
|
|
48
aq_serial.h
48
aq_serial.h
|
@ -74,11 +74,19 @@
|
|||
#define CMD_STATUS 0x02
|
||||
#define CMD_MSG 0x03
|
||||
#define CMD_MSG_LONG 0x04
|
||||
#define CMD_RS_UNKNOWN 0x08
|
||||
|
||||
/* ACK RETURN COMMANDS */
|
||||
/*
|
||||
#define ACK_NORMAL 0x00
|
||||
#define ACK_SCREEN_BUSY_SCROLL 0x01 // Seems to be busy but can cache a message,
|
||||
#define ACK_SCREEN_BUSY_BLOCK 0x03 // Seems to be don't send me shit.
|
||||
#define ACK_SCREEN_BUSY_SCROLL 0x01 // Seems to be busy displaying last message, but can cache next message,
|
||||
#define ACK_SCREEN_BUSY_BLOCK 0x03 // Seems to be don't send me any more shit.
|
||||
*/
|
||||
// Some keypads use 0x00 some 0x80 (think it's something to do with version, but need to figure it out)
|
||||
#define ACK_NORMAL 0x80
|
||||
#define ACK_SCREEN_BUSY_SCROLL 0x81 // Seems to be busy displaying last message, but can cache next message,
|
||||
#define ACK_SCREEN_BUSY_BLOCK 0x83 // Seems to be don't send me any more shit.
|
||||
|
||||
|
||||
// Remove this and fix all compile errors when get time.
|
||||
#define ACK_SCREEN_BUSY ACK_SCREEN_BUSY_SCROLL
|
||||
|
@ -133,6 +141,24 @@
|
|||
#define KEY_OVERRIDE 0x1e
|
||||
#define KEY_ENTER 0x1d
|
||||
|
||||
#ifdef AQ_RS16
|
||||
//RS 12 & 16 are different from Aux4 to Aux7
|
||||
#define KEY_RS16_AUX4 0x14
|
||||
#define KEY_RS16_AUX5 0x03
|
||||
#define KEY_RS16_AUX6 0x07
|
||||
#define KEY_RS16_AUX7 0x06
|
||||
// RS 12 & 16 have extra buttons
|
||||
#define KEY_AUXB1 0x0b
|
||||
#define KEY_AUXB2 0x10
|
||||
#define KEY_AUXB3 0x15
|
||||
#define KEY_AUXB4 0x1a
|
||||
#define KEY_AUXB5 0x04
|
||||
#define KEY_AUXB6 0x08
|
||||
#define KEY_AUXB7 0x0d
|
||||
#define KEY_AUXB8 0x0c
|
||||
// End diff in RS12
|
||||
#endif
|
||||
|
||||
#define BTN_PUMP "Filter_Pump"
|
||||
#define BTN_SPA "Spa_Mode"
|
||||
#define BTN_AUX1 "Aux_1"
|
||||
|
@ -146,6 +172,17 @@
|
|||
#define BTN_SPA_HTR "Spa_Heater"
|
||||
#define BTN_SOLAR_HTR "Solar_Heater"
|
||||
|
||||
#ifdef AQ_RS16
|
||||
#define BTN_AUXB1 "Aux_B1"
|
||||
#define BTN_AUXB2 "Aux_B2"
|
||||
#define BTN_AUXB3 "Aux_B3"
|
||||
#define BTN_AUXB4 "Aux_B4"
|
||||
#define BTN_AUXB5 "Aux_B5"
|
||||
#define BTN_AUXB6 "Aux_B6"
|
||||
#define BTN_AUXB7 "Aux_B7"
|
||||
#define BTN_AUXB8 "Aux_B8"
|
||||
#endif
|
||||
|
||||
#define BTN_PDA_PUMP "FILTER PUMP"
|
||||
#define BTN_PDA_SPA "SPA"
|
||||
#define BTN_PDA_AUX1 "AUX1"
|
||||
|
@ -160,7 +197,12 @@
|
|||
#define BTN_PDA_SOLAR_HTR "EXTRA AUX"
|
||||
|
||||
#define BUTTON_LABEL_LENGTH 20
|
||||
|
||||
#ifndef AQ_RS16
|
||||
#define TOTAL_LEDS 20
|
||||
#else
|
||||
#define TOTAL_LEDS 24 // Only 20 exist in control panel, but need space for the extra buttons on RS16 panel
|
||||
#endif
|
||||
|
||||
// Index starting at 1
|
||||
#define POOL_HTR_LED_INDEX 15
|
||||
|
@ -318,8 +360,10 @@ typedef enum {
|
|||
|
||||
int init_serial_port(const char* tty);
|
||||
void close_serial_port(int file_descriptor);
|
||||
#ifdef AQ_PDA
|
||||
void set_pda_mode(bool mode);
|
||||
bool pda_mode();
|
||||
#endif
|
||||
int generate_checksum(unsigned char* packet, int length);
|
||||
protocolType getProtocolType(unsigned char* packet);
|
||||
bool check_jandy_checksum(unsigned char* packet, int length);
|
||||
|
|
15
aqualink.h
15
aqualink.h
|
@ -16,7 +16,16 @@
|
|||
|
||||
#define MAX_ZERO_READ_BEFORE_RECONNECT 500
|
||||
|
||||
#define TOTAL_BUTTONS 12
|
||||
|
||||
//#define TOTAL_BUTTONS 12
|
||||
|
||||
#ifndef AQ_RS16
|
||||
#define TOTAL_BUTTONS 12
|
||||
#else
|
||||
#define TOTAL_BUTTONS 20
|
||||
#define RS16_VBUTTONS_START 13 // RS16 panel has 4 buttons with no LED's, so list them for manual matching to RS messages
|
||||
#define RS16_VBUTTONS_END 16 // RS16 panel has 4 buttons with no LED's, so list them for manual matching to RS messages
|
||||
#endif
|
||||
|
||||
#define TEMP_UNKNOWN -999
|
||||
//#define UNKNOWN TEMP_UNKNOWN
|
||||
|
@ -38,7 +47,9 @@ typedef struct aqualinkkey
|
|||
aqled *led;
|
||||
char *label;
|
||||
char *name;
|
||||
#ifdef AQ_PDA
|
||||
char *pda_label;
|
||||
#endif
|
||||
unsigned char code;
|
||||
int dz_idx;
|
||||
} aqkey;
|
||||
|
@ -126,6 +137,8 @@ struct aqualinkdata
|
|||
unsigned char raw_status[AQ_PSTLEN];
|
||||
aqled aqualinkleds[TOTAL_LEDS];
|
||||
aqkey aqbuttons[TOTAL_BUTTONS];
|
||||
unsigned short total_buttons; // Should probably malloc the above to this in the future
|
||||
//aqkey *aqbuttons;
|
||||
int air_temp;
|
||||
int pool_temp;
|
||||
int spa_temp;
|
||||
|
|
145
aqualinkd.c
145
aqualinkd.c
|
@ -48,6 +48,7 @@
|
|||
#include "version.h"
|
||||
|
||||
|
||||
|
||||
//#define DEFAULT_CONFIG_FILE "./aqualinkd.conf"
|
||||
|
||||
static volatile bool _keepRunning = true;
|
||||
|
@ -223,7 +224,48 @@ void setUnits(char *msg)
|
|||
logMessage(LOG_INFO, "Temp Units set to %d (F=0, C=1, Unknown=2)\n", _aqualink_data.temp_units);
|
||||
}
|
||||
|
||||
#ifdef AQ_RS16
|
||||
bool RS16_endswithLEDstate(char *msg)
|
||||
{
|
||||
char *sp;
|
||||
int i;
|
||||
aqledstate state = LED_S_UNKNOWN;
|
||||
|
||||
if (_aqconfig_.rs_panel_size < 16)
|
||||
return false;
|
||||
|
||||
sp = strrchr(msg, ' ');
|
||||
|
||||
if( sp == NULL )
|
||||
return false;
|
||||
|
||||
if (strncasecmp(sp, " on", 3) == 0)
|
||||
state = ON;
|
||||
else if (strncasecmp(sp, " off", 4) == 0)
|
||||
state = OFF;
|
||||
else if (strncasecmp(sp, " enabled", 8) == 0) // Total guess, need to check
|
||||
state = ENABLE;
|
||||
else if (strncasecmp(sp, " no idea", 8) == 0) // need to figure out these states
|
||||
state = FLASH;
|
||||
|
||||
if (state == LED_S_UNKNOWN)
|
||||
return false;
|
||||
|
||||
// Only need to start at Aux B5->B8 (12-15)
|
||||
// Loop over only aqdata->aqbuttons[13] to aqdata->aqbuttons[16]
|
||||
for (i = RS16_VBUTTONS_START; i <= RS16_VBUTTONS_END; i++) {
|
||||
//TOTAL_BUTTONS
|
||||
if ( stristr(msg, _aqualink_data.aqbuttons[i].label) != NULL) {
|
||||
_aqualink_data.aqbuttons[i].led->state = state;
|
||||
logMessage(LOG_INFO, "Set %s to %d\n", _aqualink_data.aqbuttons[i].label, _aqualink_data.aqbuttons[i].led->state);
|
||||
// Return true should be the result, but in the if we want to continue to display message
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
#endif
|
||||
|
||||
#define MSG_FREEZE 1 // 2^0, bit 0
|
||||
#define MSG_SERVICE 2 // 2^1, bit 1
|
||||
|
@ -448,8 +490,8 @@ void processMessage(char *message)
|
|||
logMessage(LOG_NOTICE, "Control Panel %s\n", msg);
|
||||
if (_initWithRS == false)
|
||||
{
|
||||
//queueGetProgramData(ALLBUTTON, &_aqualink_data);
|
||||
queueGetExtendedProgramData(ALLBUTTON, &_aqualink_data, _aqconfig_.use_panel_aux_labels);
|
||||
queueGetProgramData(ALLBUTTON, &_aqualink_data);
|
||||
//queueGetExtendedProgramData(ALLBUTTON, &_aqualink_data, _aqconfig_.use_panel_aux_labels);
|
||||
_initWithRS = true;
|
||||
}
|
||||
}
|
||||
|
@ -463,14 +505,40 @@ void processMessage(char *message)
|
|||
//aq_programmer(AQ_SEND_CMD, (char *)KEY_ENTER, &_aqualink_data);
|
||||
aq_send_cmd(KEY_ENTER);
|
||||
}
|
||||
else if ((msg[4] == ':') && (strncasecmp(msg, "AUX", 3) == 0))
|
||||
{ // AUX label "AUX1:"
|
||||
int labelid = atoi(msg + 3);
|
||||
// Process any button states (fake LED) for RS12 and above keypads
|
||||
// Text will be button label on or off ie Aux_B2 off or WaterFall off
|
||||
|
||||
#ifdef AQ_RS16
|
||||
else if ( _aqconfig_.rs_panel_size >= 16 && RS16_endswithLEDstate(msg) == true )
|
||||
{
|
||||
// Do nothing, just stop other else if statments executing
|
||||
// make sure we also display the message.
|
||||
// Note we only get ON messages here, Off messages will not be sent if something else turned it off
|
||||
// use the Onetouch or iAqua equiptment page for off.
|
||||
strcpy(_aqualink_data.last_display_message, msg);
|
||||
}
|
||||
#endif
|
||||
else if (((msg[4] == ':') || (msg[6] == ':')) && (strncasecmp(msg, "AUX", 3) == 0) )
|
||||
{ // Should probable check we are in programming mode.
|
||||
// 'Aux3: No Label'
|
||||
// 'Aux B1: No Label'
|
||||
int labelid;
|
||||
int ni = 3;
|
||||
if (msg[4] == 'B') { ni = 5; }
|
||||
labelid = atoi(msg + ni);
|
||||
if (labelid > 0 && _aqconfig_.use_panel_aux_labels == true)
|
||||
{
|
||||
if (ni == 5)
|
||||
labelid = labelid + 8;
|
||||
else
|
||||
labelid = labelid + 1;
|
||||
// Aux1: on panel = Button 3 in aqualinkd (button 2 in array)
|
||||
logMessage(LOG_NOTICE, "AUX LABEL %d '%s'\n", labelid + 1, msg);
|
||||
_aqualink_data.aqbuttons[labelid+1].label = prittyString(cleanalloc(msg+5));
|
||||
if (strncasecmp(msg+ni+3, "No Label", 8) != 0) {
|
||||
_aqualink_data.aqbuttons[labelid].label = prittyString(cleanalloc(msg+ni+2));
|
||||
logMessage(LOG_NOTICE, "AUX ID %s label set to '%s'\n", _aqualink_data.aqbuttons[labelid].name, _aqualink_data.aqbuttons[labelid].label);
|
||||
} else {
|
||||
logMessage(LOG_NOTICE, "AUX ID %s has no control panel label using '%s'\n", _aqualink_data.aqbuttons[labelid].name, _aqualink_data.aqbuttons[labelid].label);
|
||||
}
|
||||
//_aqualink_data.aqbuttons[labelid + 1].label = cleanalloc(msg + 5);
|
||||
}
|
||||
}
|
||||
|
@ -495,7 +563,8 @@ void processMessage(char *message)
|
|||
//_aqualink_data.display_message = msg;
|
||||
if (_aqualink_data.active_thread.thread_id == 0 &&
|
||||
stristr(msg, "JANDY AquaLinkRS") == NULL &&
|
||||
stristr(msg, "PUMP O") == NULL &&// Catch 'PUMP ON' and 'PUMP OFF' but not 'PUMP WILL TURN ON'
|
||||
//stristr(msg, "PUMP O") == NULL &&// Catch 'PUMP ON' and 'PUMP OFF' but not 'PUMP WILL TURN ON'
|
||||
strncasecmp(msg, "PUMP O", 6) != 0 &&// Catch 'PUMP ON' and 'PUMP OFF' but not 'PUMP WILL TURN ON'
|
||||
stristr(msg, "MAINTAIN") == NULL && // Catch 'MAINTAIN TEMP IS OFF'
|
||||
stristr(msg, "0 PSI") == NULL /* // Catch some erronious message on test harness
|
||||
stristr(msg, "CLEANER O") == NULL &&
|
||||
|
@ -536,12 +605,12 @@ bool process_packet(unsigned char *packet, int length)
|
|||
_aqualink_data.last_packet_type = packet[PKT_CMD];
|
||||
rtn = true;
|
||||
}
|
||||
|
||||
#ifdef AQ_PDA
|
||||
if (_aqconfig_.pda_mode == true)
|
||||
{
|
||||
return process_pda_packet(packet, length);
|
||||
}
|
||||
|
||||
#endif
|
||||
if (processing_long_msg > 0 && packet[PKT_CMD] != CMD_MSG_LONG)
|
||||
{
|
||||
processing_long_msg = 0;
|
||||
|
@ -613,6 +682,10 @@ bool process_packet(unsigned char *packet, int length)
|
|||
//logMessage(LOG_INFO, "Synch'ing with Aqualink master device...\n");
|
||||
rtn = false;
|
||||
break;
|
||||
case CMD_RS_UNKNOWN:
|
||||
logMessage(LOG_INFO, "RS Received command, 0x%02hhx, not sure what this is for!\n", packet[PKT_CMD]);
|
||||
rtn = false;
|
||||
break;
|
||||
default:
|
||||
logMessage(LOG_INFO, "RS Received unknown packet, 0x%02hhx\n", packet[PKT_CMD]);
|
||||
rtn = false;
|
||||
|
@ -836,7 +909,16 @@ int main(int argc, char *argv[])
|
|||
initButtons(&_aqualink_data);
|
||||
|
||||
read_config(&_aqualink_data, cfgFile);
|
||||
|
||||
|
||||
// Just so we catch the heaters, make all panels RS8 or RS16
|
||||
//_aqualink_data.total_buttons = _aqconfig_.rs_panel_size + 4; // This would be correct if we re-index heaters.
|
||||
#ifdef AQ_RS16
|
||||
if (_aqconfig_.rs_panel_size >= 12)
|
||||
_aqualink_data.total_buttons = 20;
|
||||
else
|
||||
#endif
|
||||
_aqualink_data.total_buttons = 12;
|
||||
|
||||
if (cmdln_loglevel != -1)
|
||||
_aqconfig_.log_level = cmdln_loglevel;
|
||||
|
||||
|
@ -855,11 +937,12 @@ int main(int argc, char *argv[])
|
|||
logMessage(LOG_NOTICE, "%s v%s\n", AQUALINKD_NAME, AQUALINKD_VERSION);
|
||||
|
||||
logMessage(LOG_NOTICE, "Config log_level = %d\n", _aqconfig_.log_level);
|
||||
logMessage(LOG_NOTICE, "Config socket_port = %s\n", _aqconfig_.socket_port);
|
||||
logMessage(LOG_NOTICE, "Config serial_port = %s\n", _aqconfig_.serial_port);
|
||||
logMessage(LOG_NOTICE, "Config web_directory = %s\n", _aqconfig_.web_directory);
|
||||
logMessage(LOG_NOTICE, "Config device_id = 0x%02hhx\n", _aqconfig_.device_id);
|
||||
logMessage(LOG_NOTICE, "Config extra_device_id = 0x%02hhx\n", _aqconfig_.onetouch_device_id);
|
||||
logMessage(LOG_NOTICE, "Config serial_port = %s\n", _aqconfig_.serial_port);
|
||||
logMessage(LOG_NOTICE, "Config rs_panel_size = %d\n", _aqconfig_.rs_panel_size);
|
||||
logMessage(LOG_NOTICE, "Config socket_port = %s\n", _aqconfig_.socket_port);
|
||||
logMessage(LOG_NOTICE, "Config web_directory = %s\n", _aqconfig_.web_directory);
|
||||
logMessage(LOG_NOTICE, "Config extra_device_prog = %s\n", bool2text(_aqconfig_.extended_device_id_programming));
|
||||
logMessage(LOG_NOTICE, "Config read_all_devices = %s\n", bool2text(_aqconfig_.read_all_devices));
|
||||
logMessage(LOG_NOTICE, "Config use_aux_labels = %s\n", bool2text(_aqconfig_.use_panel_aux_labels));
|
||||
|
@ -877,8 +960,10 @@ int main(int argc, char *argv[])
|
|||
logMessage(LOG_NOTICE, "Config idx spa temp = %d\n", _aqconfig_.dzidx_spa_water_temp);
|
||||
logMessage(LOG_NOTICE, "Config idx SWG Percent = %d\n", _aqconfig_.dzidx_swg_percent);
|
||||
logMessage(LOG_NOTICE, "Config idx SWG PPM = %d\n", _aqconfig_.dzidx_swg_ppm);
|
||||
#ifdef AQ_PDA
|
||||
logMessage(LOG_NOTICE, "Config PDA Mode = %s\n", bool2text(_aqconfig_.pda_mode));
|
||||
logMessage(LOG_NOTICE, "Config PDA Sleep Mode = %s\n", bool2text(_aqconfig_.pda_sleep_mode));
|
||||
#endif
|
||||
logMessage(LOG_NOTICE, "Config force SWG = %s\n", bool2text(_aqconfig_.force_swg));
|
||||
/* removed until domoticz has a better virtual thermostat
|
||||
logMessage(LOG_NOTICE, "Config idx pool thermostat = %d\n", _aqconfig_.dzidx_pool_thermostat);
|
||||
|
@ -898,7 +983,8 @@ int main(int argc, char *argv[])
|
|||
logMessage(LOG_NOTICE, "Ignore SWG 0 msg count = %d\n", _aqconfig_.swg_zero_ignore);
|
||||
|
||||
|
||||
for (i = 0; i < TOTAL_BUTONS; i++)
|
||||
//for (i = 0; i < TOTAL_BUTONS; i++)
|
||||
for (i = 0; i < _aqualink_data.total_buttons; i++)
|
||||
{
|
||||
//char ext[] = " VSP ID None | AL ID 0 ";
|
||||
char ext[40];
|
||||
|
@ -916,13 +1002,16 @@ int main(int argc, char *argv[])
|
|||
if (_aqualink_data.aqbuttons[i].dz_idx > 0)
|
||||
sprintf(ext+strlen(ext), "dzidx %-3d", _aqualink_data.aqbuttons[i].dz_idx);
|
||||
|
||||
if (!_aqconfig_.pda_mode) {
|
||||
logMessage(LOG_NOTICE, "Config BTN %-13s = label %-15s | %s\n",
|
||||
_aqualink_data.aqbuttons[i].name, _aqualink_data.aqbuttons[i].label, ext);
|
||||
} else {
|
||||
#ifdef AQ_PDA
|
||||
if (_aqconfig_.pda_mode) {
|
||||
logMessage(LOG_NOTICE, "Config BTN %-13s = label %-15s | PDAlabel %-15s | %s\n",
|
||||
_aqualink_data.aqbuttons[i].name, _aqualink_data.aqbuttons[i].label,
|
||||
_aqualink_data.aqbuttons[i].pda_label, ext);
|
||||
} else
|
||||
#endif
|
||||
{
|
||||
logMessage(LOG_NOTICE, "Config BTN %-13s = label %-15s | %s\n",
|
||||
_aqualink_data.aqbuttons[i].name, _aqualink_data.aqbuttons[i].label, ext);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -954,20 +1043,20 @@ void caculate_ack_packet(int rs_fd, unsigned char *packet_buffer) {
|
|||
return;
|
||||
}
|
||||
|
||||
//if (!_aqualink_data.simulate_panel || _aqualink_data.active_thread.thread_id != 0) {
|
||||
// if PDA mode, should we sleep? if not Can only send command to status message on PDA.
|
||||
// if PDA mode, should we sleep? if not Can only send command to status message on PDA.
|
||||
#ifdef AQ_PDA
|
||||
if (_aqconfig_.pda_mode == true) {
|
||||
//pda_programming_thread_check(&_aqualink_data);
|
||||
if (_aqconfig_.pda_sleep_mode && pda_shouldSleep()) {
|
||||
logMessage(LOG_DEBUG, "PDA Aqualink daemon in sleep mode\n");
|
||||
return;
|
||||
//} else if (packet_buffer[PKT_CMD] != CMD_STATUS) // Moved logic to pop_aq_cmd()
|
||||
// send_extended_ack(rs_fd, ACK_PDA, NUL);
|
||||
} else {
|
||||
send_extended_ack(rs_fd, ACK_PDA, pop_aq_cmd(&_aqualink_data));
|
||||
}
|
||||
|
||||
} else if (_aqualink_data.simulate_panel && _aqualink_data.active_thread.thread_id == 0) {
|
||||
} else
|
||||
#endif
|
||||
if (_aqualink_data.simulate_panel && _aqualink_data.active_thread.thread_id == 0) {
|
||||
// We are in simlator mode, ack get's complicated now.
|
||||
// If have a command to send, send a normal ack.
|
||||
// If we last message is waiting for an input "SELECT xxxxx", then sent a pause ack
|
||||
|
@ -1090,6 +1179,7 @@ void main_loop()
|
|||
rs_fd = init_serial_port(_aqconfig_.serial_port);
|
||||
logMessage(LOG_NOTICE, "Listening to Aqualink RS8 on serial port: %s\n", _aqconfig_.serial_port);
|
||||
|
||||
#ifdef AQ_PDA
|
||||
if (_aqconfig_.pda_mode == true)
|
||||
{
|
||||
#ifdef BETA_PDA_AUTOLABEL
|
||||
|
@ -1098,6 +1188,7 @@ void main_loop()
|
|||
init_pda(&_aqualink_data);
|
||||
#endif
|
||||
}
|
||||
#endif
|
||||
if (_aqconfig_.onetouch_device_id != 0x00)
|
||||
{
|
||||
set_onetouch_enabled(true);
|
||||
|
@ -1172,7 +1263,11 @@ void main_loop()
|
|||
|
||||
changed = process_packet(packet_buffer, packet_length);
|
||||
// If we are not in PDA or Simulator mode, just sent ACK & any CMD, else caculate the ACK.
|
||||
if (!_aqualink_data.simulate_panel && !_aqconfig_.pda_mode) {
|
||||
if (!_aqualink_data.simulate_panel
|
||||
#ifdef AQ_PDA
|
||||
&& !_aqconfig_.pda_mode
|
||||
#endif
|
||||
) {
|
||||
//send_ack(rs_fd, pop_aq_cmd(&_aqualink_data));
|
||||
send_extended_ack(rs_fd, (_aqualink_data.last_packet_type==CMD_MSG_LONG?ACK_SCREEN_BUSY_SCROLL:ACK_NORMAL), pop_aq_cmd(&_aqualink_data));
|
||||
} else
|
||||
|
|
23
config.c
23
config.c
|
@ -37,6 +37,7 @@
|
|||
#include "config.h"
|
||||
#include "utils.h"
|
||||
#include "aq_serial.h"
|
||||
#include "init_buttons.h"
|
||||
|
||||
#define MAXCFGLINE 256
|
||||
|
||||
|
@ -52,6 +53,7 @@ void init_parameters (struct aqconfig * parms)
|
|||
{
|
||||
//int i;
|
||||
//char *p;
|
||||
parms->rs_panel_size = 8;
|
||||
parms->serial_port = DEFAULT_SERIALPORT;
|
||||
parms->log_level = DEFAULT_LOG_LEVEL;
|
||||
parms->socket_port = DEFAULT_WEBPORT;
|
||||
|
@ -81,9 +83,11 @@ void init_parameters (struct aqconfig * parms)
|
|||
//parms->light_programming_button_spa = TEMP_UNKNOWN;
|
||||
parms->deamonize = true;
|
||||
parms->log_file = '\0';
|
||||
#ifdef AQ_PDA
|
||||
parms->pda_mode = false;
|
||||
parms->onetouch_mode = false;
|
||||
parms->pda_sleep_mode = false;
|
||||
#endif
|
||||
parms->onetouch_mode = false;
|
||||
parms->convert_mqtt_temp = true;
|
||||
parms->convert_dz_temp = true;
|
||||
parms->report_zero_pool_temp = false;
|
||||
|
@ -340,6 +344,17 @@ bool setConfigValue(struct aqualinkdata *aqdata, char *param, char *value) {
|
|||
_aqconfig_.onetouch_device_id = strtoul(cleanalloc(value), NULL, 16);
|
||||
//_config_parameters.onetouch_device_id != 0x00
|
||||
rtn=true;
|
||||
} else if (strncasecmp(param, "rs_panel_size", 13) == 0) {
|
||||
_aqconfig_.rs_panel_size = strtoul(value, NULL, 10);
|
||||
if ( _aqconfig_.rs_panel_size > TOTAL_BUTTONS) {
|
||||
logMessage(LOG_ERR, "Config error, 'rs_panel_size' is either invalid or too large for compiled parameters, reset to %d\n",TOTAL_BUTTONS);
|
||||
_aqconfig_.rs_panel_size = TOTAL_BUTTONS;
|
||||
}
|
||||
#ifdef AQ_RS16 // Need to re-order button hex values
|
||||
if (_aqconfig_.rs_panel_size >= 12)
|
||||
initButtons_RS16(aqdata);
|
||||
#endif
|
||||
rtn=true;
|
||||
} else if (strncasecmp(param, "web_directory", 13) == 0) {
|
||||
_aqconfig_.web_directory = cleanalloc(value);
|
||||
rtn=true;
|
||||
|
@ -403,15 +418,15 @@ bool setConfigValue(struct aqualinkdata *aqdata, char *param, char *value) {
|
|||
} else if (strncasecmp(param, "override_freeze_protect", 23) == 0) {
|
||||
_aqconfig_.override_freeze_protect = text2bool(value);
|
||||
rtn=true;
|
||||
#ifdef AQ_PDA
|
||||
} else if (strncasecmp(param, "pda_mode", 8) == 0) {
|
||||
_aqconfig_.pda_mode = text2bool(value);
|
||||
set_pda_mode(_aqconfig_.pda_mode);
|
||||
//_aqconfig_.use_PDA_auxiliary = false;
|
||||
rtn=true;
|
||||
} else if (strncasecmp(param, "pda_sleep_mode", 8) == 0) {
|
||||
_aqconfig_.pda_sleep_mode = text2bool(value);
|
||||
//set_pda_mode(_aqconfig_.pda_mode);
|
||||
rtn=true;
|
||||
#endif
|
||||
} else if (strncasecmp(param, "convert_mqtt_temp_to_c", 22) == 0) {
|
||||
_aqconfig_.convert_mqtt_temp = text2bool(value);
|
||||
rtn=true;
|
||||
|
@ -478,9 +493,11 @@ bool setConfigValue(struct aqualinkdata *aqdata, char *param, char *value) {
|
|||
} else if (strncasecmp(param + 9, "_dzidx", 6) == 0) {
|
||||
aqdata->aqbuttons[num].dz_idx = strtoul(value, NULL, 10);
|
||||
rtn=true;
|
||||
#ifdef AQ_PDA
|
||||
} else if (strncasecmp(param + 9, "_PDA_label", 10) == 0) {
|
||||
aqdata->aqbuttons[num].pda_label = cleanalloc(value);
|
||||
rtn=true;
|
||||
#endif
|
||||
} else if (strncasecmp(param + 9, "_lightMode", 10) == 0) {
|
||||
if (aqdata->num_lights < MAX_LIGHTS) {
|
||||
int type = strtoul(value, NULL, 10);
|
||||
|
|
6
config.h
6
config.h
|
@ -34,6 +34,8 @@ struct aqconfig
|
|||
unsigned char onetouch_device_id;
|
||||
bool extended_device_id_programming;
|
||||
bool deamonize;
|
||||
unsigned short rs_panel_size;
|
||||
//unsigned short rs_panel_size;
|
||||
char *log_file;
|
||||
char *mqtt_dz_sub_topic;
|
||||
char *mqtt_dz_pub_topic;
|
||||
|
@ -54,9 +56,11 @@ struct aqconfig
|
|||
//int light_programming_button_pool;
|
||||
//int light_programming_button_spa;
|
||||
bool override_freeze_protect;
|
||||
#ifdef AQ_PDA
|
||||
bool pda_mode;
|
||||
bool onetouch_mode;
|
||||
bool pda_sleep_mode;
|
||||
#endif
|
||||
bool onetouch_mode;
|
||||
bool convert_mqtt_temp;
|
||||
bool convert_dz_temp;
|
||||
//bool flash_mqtt_buttons;
|
||||
|
|
|
@ -0,0 +1,247 @@
|
|||
Debug: Serial read 7 bytes
|
||||
Debug: Jandy Packet | HEX: 0x10|0x02|0x78|0x41|0xcb|0x10|0x03|
|
||||
Debug: Serial read 12 bytes
|
||||
Debug: Jandy Packet | HEX: 0x10|0x02|0x0b|0x02|0x00|0x10|0x40|0x00|0x00|0x6f|0x10|0x03|
|
||||
Debug: Serial read 9 bytes
|
||||
Debug: Jandy Packet | HEX: 0x10|0x02|0x00|0x01|0x80|0x00|0x93|0x10|0x03|
|
||||
Debug: Serial read 7 bytes
|
||||
Debug: Jandy Packet | HEX: 0x10|0x02|0x0a|0x00|0x1c|0x10|0x03|
|
||||
Debug: RS received packet of type Probe length 7
|
||||
Debug: RS Received PROBE length 7.
|
||||
Debug: RS SEND cmd '0x00'
|
||||
Debug: Serial write 9 bytes
|
||||
Debug: Jandy Packet | HEX: 0x10|0x02|0x00|0x01|0x80|0x00|0x93|0x10|0x03|
|
||||
Debug: Serial read 12 bytes
|
||||
Debug: Jandy Packet | HEX: 0x10|0x02|0x0b|0x02|0x00|0x10|0x40|0x00|0x00|0x6f|0x10|0x03|
|
||||
Debug: Serial read 9 bytes
|
||||
Debug: Jandy Packet | HEX: 0x10|0x02|0x00|0x01|0x80|0x00|0x93|0x10|0x03|
|
||||
Info: URI request: '/debug.html?command=debug&value=status'
|
||||
Info: WEB: Message command='debug'
|
||||
Debug: Served WEB request
|
||||
Debug: Serial read 12 bytes
|
||||
Debug: Jandy Packet | HEX: 0x10|0x02|0x0a|0x02|0x00|0x10|0x40|0x00|0x00|0x6e|0x10|0x03|
|
||||
Debug: RS received packet of type Status length 12
|
||||
Debug: RS SEND cmd '0x00'
|
||||
Debug: Serial write 9 bytes
|
||||
Debug: Jandy Packet | HEX: 0x10|0x02|0x00|0x01|0x80|0x00|0x93|0x10|0x03|
|
||||
Info: MQTT: Published id=2: aqualinkd-test/Service_Mode 0
|
||||
Info: MQTT: Published id=3: aqualinkd-test/Temperature/Spa -18.00
|
||||
Info: MQTT: Published id=4: aqualinkd-test/Freeze_Protect 0
|
||||
Info: MQTT: Published id=5: aqualinkd-test/Battery 1
|
||||
Info: MQTT: Published id=6: aqualinkd-test/SWG 0
|
||||
Info: MQTT: Published id=7: aqualinkd-test/SWG/enabled 0
|
||||
Info: MQTT: Published id=8: aqualinkd-test/SWG/fullstatus 255
|
||||
Info: MQTT: Published id=9: aqualinkd-test/SWG/Boost 0
|
||||
Info: MQTT: Published id=10: aqualinkd-test/Filter_Pump/delay 0
|
||||
Info: MQTT: Published id=11: aqualinkd-test/Filter_Pump 1
|
||||
Info: MQTT: Published id=12: aqualinkd-test/Spa_Mode/delay 0
|
||||
Info: MQTT: Published id=13: aqualinkd-test/Spa_Mode 0
|
||||
Info: MQTT: Published id=14: aqualinkd-test/Aux_1/delay 0
|
||||
Info: MQTT: Published id=15: aqualinkd-test/Aux_1 0
|
||||
Info: MQTT: Published id=16: aqualinkd-test/Aux_2/delay 0
|
||||
Info: MQTT: Published id=17: aqualinkd-test/Aux_2 0
|
||||
Info: MQTT: Published id=18: aqualinkd-test/Aux_3/delay 0
|
||||
Info: MQTT: Published id=19: aqualinkd-test/Aux_3 0
|
||||
Info: MQTT: Published id=20: aqualinkd-test/Aux_4/delay 0
|
||||
Info: MQTT: Published id=21: aqualinkd-test/Aux_4 0
|
||||
Info: MQTT: Published id=22: aqualinkd-test/Aux_5/delay 0
|
||||
Info: MQTT: Published id=23: aqualinkd-test/Aux_5 0
|
||||
Info: MQTT: Published id=24: aqualinkd-test/Aux_6/delay 0
|
||||
Info: MQTT: Published id=25: aqualinkd-test/Aux_6 0
|
||||
Info: MQTT: Published id=26: aqualinkd-test/Aux_7/delay 0
|
||||
Info: MQTT: Published id=27: aqualinkd-test/Aux_7 0
|
||||
Info: MQTT: Published id=28: aqualinkd-test/Aux_B1/delay 0
|
||||
Info: MQTT: Published id=29: aqualinkd-test/Aux_B1 0
|
||||
Info: MQTT: Published id=30: aqualinkd-test/Aux_B2/delay 0
|
||||
Info: MQTT: Published id=31: aqualinkd-test/Aux_B2 1
|
||||
Info: MQTT: Published id=32: aqualinkd-test/Aux_B3/delay 0
|
||||
Info: MQTT: Published id=33: aqualinkd-test/Aux_B3 0
|
||||
Info: MQTT: Published id=34: aqualinkd-test/Aux_B4/delay 0
|
||||
Info: MQTT: Published id=35: aqualinkd-test/Aux_B4 0
|
||||
Info: MQTT: Published id=36: aqualinkd-test/Pool_Heater 0
|
||||
Info: MQTT: Published id=37: aqualinkd-test/Pool_Heater/enabled 0
|
||||
Info: MQTT: Published id=38: aqualinkd-test/Spa_Heater 0
|
||||
Info: MQTT: Published id=39: aqualinkd-test/Spa_Heater/enabled 0
|
||||
Info: MQTT: Published id=40: aqualinkd-test/Solar_Heater/delay 0
|
||||
Info: MQTT: Published id=41: aqualinkd-test/Solar_Heater 0
|
||||
Debug: MQTT: Message publishing acknowledged (msg_id: 2)
|
||||
Debug: MQTT: Ignore aqualinkd-test/Service_Mode 0
|
||||
Debug: MQTT: Message publishing acknowledged (msg_id: 3)
|
||||
Debug: MQTT: received (msg_id: 3), looks like my own message, ignoring
|
||||
Debug: MQTT: Ignore aqualinkd-test/Temperature/Spa -18.00
|
||||
Debug: MQTT: Message publishing acknowledged (msg_id: 4)
|
||||
Debug: MQTT: received (msg_id: 4), looks like my own message, ignoring
|
||||
Debug: MQTT: Ignore aqualinkd-test/Freeze_Protect 0
|
||||
Debug: MQTT: Message publishing acknowledged (msg_id: 5)
|
||||
Debug: MQTT: received (msg_id: 5), looks like my own message, ignoring
|
||||
Debug: MQTT: Ignore aqualinkd-test/Battery 1
|
||||
Debug: MQTT: Message publishing acknowledged (msg_id: 6)
|
||||
Debug: MQTT: received (msg_id: 6), looks like my own message, ignoring
|
||||
Debug: MQTT: Ignore aqualinkd-test/SWG 0
|
||||
Debug: MQTT: Message publishing acknowledged (msg_id: 7)
|
||||
Debug: MQTT: received (msg_id: 7), looks like my own message, ignoring
|
||||
Debug: MQTT: Ignore aqualinkd-test/SWG/enabled 0
|
||||
Debug: MQTT: Message publishing acknowledged (msg_id: 8)
|
||||
Debug: MQTT: received (msg_id: 8), looks like my own message, ignoring
|
||||
Debug: MQTT: Ignore aqualinkd-test/SWG/fullstatus 255
|
||||
Debug: MQTT: Message publishing acknowledged (msg_id: 9)
|
||||
Debug: MQTT: received (msg_id: 9), looks like my own message, ignoring
|
||||
Debug: MQTT: Ignore aqualinkd-test/SWG/Boost 0
|
||||
Debug: MQTT: Message publishing acknowledged (msg_id: 10)
|
||||
Debug: MQTT: received (msg_id: 10), looks like my own message, ignoring
|
||||
Debug: MQTT: Ignore aqualinkd-test/Filter_Pump/delay 0
|
||||
Debug: MQTT: Message publishing acknowledged (msg_id: 11)
|
||||
Debug: MQTT: received (msg_id: 11), looks like my own message, ignoring
|
||||
Debug: MQTT: Ignore aqualinkd-test/Filter_Pump 1
|
||||
Debug: MQTT: Message publishing acknowledged (msg_id: 12)
|
||||
Debug: MQTT: received (msg_id: 12), looks like my own message, ignoring
|
||||
Debug: MQTT: Ignore aqualinkd-test/Spa_Mode/delay 0
|
||||
Debug: MQTT: Message publishing acknowledged (msg_id: 13)
|
||||
Debug: MQTT: received (msg_id: 13), looks like my own message, ignoring
|
||||
Debug: MQTT: Ignore aqualinkd-test/Spa_Mode 0
|
||||
Debug: MQTT: Message publishing acknowledged (msg_id: 14)
|
||||
Debug: MQTT: received (msg_id: 14), looks like my own message, ignoring
|
||||
Debug: MQTT: Ignore aqualinkd-test/Aux_1/delay 0
|
||||
Debug: MQTT: Message publishing acknowledged (msg_id: 15)
|
||||
Debug: MQTT: received (msg_id: 15), looks like my own message, ignoring
|
||||
Debug: MQTT: Ignore aqualinkd-test/Aux_1 0
|
||||
Debug: MQTT: Message publishing acknowledged (msg_id: 16)
|
||||
Debug: MQTT: received (msg_id: 16), looks like my own message, ignoring
|
||||
Debug: MQTT: Ignore aqualinkd-test/Aux_2/delay 0
|
||||
Debug: MQTT: Message publishing acknowledged (msg_id: 17)
|
||||
Debug: MQTT: received (msg_id: 17), looks like my own message, ignoring
|
||||
Debug: MQTT: Ignore aqualinkd-test/Aux_2 0
|
||||
Debug: MQTT: Message publishing acknowledged (msg_id: 18)
|
||||
Debug: MQTT: received (msg_id: 18), looks like my own message, ignoring
|
||||
Debug: MQTT: Ignore aqualinkd-test/Aux_3/delay 0
|
||||
Debug: MQTT: Message publishing acknowledged (msg_id: 19)
|
||||
Debug: MQTT: received (msg_id: 19), looks like my own message, ignoring
|
||||
Debug: MQTT: Ignore aqualinkd-test/Aux_3 0
|
||||
Debug: MQTT: Message publishing acknowledged (msg_id: 20)
|
||||
Debug: MQTT: received (msg_id: 20), looks like my own message, ignoring
|
||||
Debug: MQTT: Ignore aqualinkd-test/Aux_4/delay 0
|
||||
Debug: MQTT: Message publishing acknowledged (msg_id: 21)
|
||||
Debug: MQTT: received (msg_id: 21), looks like my own message, ignoring
|
||||
Debug: MQTT: Ignore aqualinkd-test/Aux_4 0
|
||||
Debug: MQTT: Message publishing acknowledged (msg_id: 22)
|
||||
Debug: MQTT: received (msg_id: 22), looks like my own message, ignoring
|
||||
Debug: MQTT: Ignore aqualinkd-test/Aux_5/delay 0
|
||||
Debug: MQTT: Message publishing acknowledged (msg_id: 23)
|
||||
Debug: MQTT: received (msg_id: 23), looks like my own message, ignoring
|
||||
Debug: MQTT: Ignore aqualinkd-test/Aux_5 0
|
||||
Debug: MQTT: Message publishing acknowledged (msg_id: 24)
|
||||
Debug: MQTT: received (msg_id: 24), looks like my own message, ignoring
|
||||
Debug: MQTT: Ignore aqualinkd-test/Aux_6/delay 0
|
||||
Debug: MQTT: Message publishing acknowledged (msg_id: 25)
|
||||
Debug: MQTT: received (msg_id: 25), looks like my own message, ignoring
|
||||
Debug: MQTT: Ignore aqualinkd-test/Aux_6 0
|
||||
Debug: MQTT: Message publishing acknowledged (msg_id: 26)
|
||||
Debug: MQTT: received (msg_id: 26), looks like my own message, ignoring
|
||||
Debug: MQTT: Ignore aqualinkd-test/Aux_7/delay 0
|
||||
Debug: MQTT: Message publishing acknowledged (msg_id: 27)
|
||||
Debug: MQTT: received (msg_id: 27), looks like my own message, ignoring
|
||||
Debug: MQTT: Ignore aqualinkd-test/Aux_7 0
|
||||
Debug: MQTT: Message publishing acknowledged (msg_id: 28)
|
||||
Debug: MQTT: received (msg_id: 28), looks like my own message, ignoring
|
||||
Debug: MQTT: Ignore aqualinkd-test/Aux_B1/delay 0
|
||||
Debug: MQTT: Message publishing acknowledged (msg_id: 29)
|
||||
Debug: MQTT: received (msg_id: 29), looks like my own message, ignoring
|
||||
Debug: MQTT: Ignore aqualinkd-test/Aux_B1 0
|
||||
Debug: MQTT: Message publishing acknowledged (msg_id: 30)
|
||||
Debug: MQTT: received (msg_id: 30), looks like my own message, ignoring
|
||||
Debug: MQTT: Ignore aqualinkd-test/Aux_B2/delay 0
|
||||
Debug: MQTT: Message publishing acknowledged (msg_id: 31)
|
||||
Debug: MQTT: received (msg_id: 31), looks like my own message, ignoring
|
||||
Debug: MQTT: Ignore aqualinkd-test/Aux_B2 1
|
||||
Debug: MQTT: Message publishing acknowledged (msg_id: 32)
|
||||
Debug: MQTT: received (msg_id: 32), looks like my own message, ignoring
|
||||
Debug: MQTT: Ignore aqualinkd-test/Aux_B3/delay 0
|
||||
Debug: MQTT: Message publishing acknowledged (msg_id: 33)
|
||||
Debug: MQTT: received (msg_id: 33), looks like my own message, ignoring
|
||||
Debug: MQTT: Ignore aqualinkd-test/Aux_B3 0
|
||||
Debug: MQTT: Message publishing acknowledged (msg_id: 34)
|
||||
Debug: MQTT: received (msg_id: 34), looks like my own message, ignoring
|
||||
Debug: MQTT: Ignore aqualinkd-test/Aux_B4/delay 0
|
||||
Debug: MQTT: Message publishing acknowledged (msg_id: 35)
|
||||
Debug: MQTT: received (msg_id: 35), looks like my own message, ignoring
|
||||
Debug: MQTT: Ignore aqualinkd-test/Aux_B4 0
|
||||
Debug: MQTT: Message publishing acknowledged (msg_id: 36)
|
||||
Debug: MQTT: received (msg_id: 36), looks like my own message, ignoring
|
||||
Debug: MQTT: Ignore aqualinkd-test/Pool_Heater 0
|
||||
Debug: MQTT: Message publishing acknowledged (msg_id: 37)
|
||||
Debug: MQTT: received (msg_id: 37), looks like my own message, ignoring
|
||||
Debug: MQTT: Ignore aqualinkd-test/Pool_Heater/enabled 0
|
||||
Debug: MQTT: Message publishing acknowledged (msg_id: 38)
|
||||
Debug: MQTT: received (msg_id: 38), looks like my own message, ignoring
|
||||
Debug: MQTT: Ignore aqualinkd-test/Spa_Heater 0
|
||||
Debug: MQTT: Message publishing acknowledged (msg_id: 39)
|
||||
Debug: MQTT: received (msg_id: 39), looks like my own message, ignoring
|
||||
Debug: MQTT: Ignore aqualinkd-test/Spa_Heater/enabled 0
|
||||
Debug: MQTT: Message publishing acknowledged (msg_id: 40)
|
||||
Debug: MQTT: received (msg_id: 40), looks like my own message, ignoring
|
||||
Debug: MQTT: Ignore aqualinkd-test/Solar_Heater/delay 0
|
||||
Debug: MQTT: Message publishing acknowledged (msg_id: 41)
|
||||
Debug: MQTT: Ignore aqualinkd-test/Solar_Heater 0
|
||||
Debug: Serial read 10 bytes
|
||||
Debug: Jandy Packet | HEX: 0x10|0x02|0x0a|0x08|0x00|0x1c|0x22|0x62|0x10|0x03|
|
||||
Debug: RS received packet of type PDA Hlight length 10
|
||||
Info: RS Received unknown packet, 0x08
|
||||
Debug: RS SEND cmd '0x00'
|
||||
Debug: Serial write 9 bytes
|
||||
Debug: Jandy Packet | HEX: 0x10|0x02|0x00|0x01|0x80|0x00|0x93|0x10|0x03|
|
||||
Debug: Serial read 24 bytes
|
||||
Debug: Jandy Packet | HEX: 0x10|0x02|0x0a|0x03|0x01|0x42|0x30|0x30|0x32|0x39|0x32|0x33|0x31|0x20|0x52|0x45|0x56|0x20|0x54|0x2e|0x30|0xa2|0x10|0x03|
|
||||
Debug: RS received packet of type Message length 24
|
||||
Debug: RS SEND cmd '0x00'
|
||||
Debug: Serial write 9 bytes
|
||||
Debug: Jandy Packet | HEX: 0x10|0x02|0x00|0x01|0x80|0x00|0x93|0x10|0x03|
|
||||
Debug: Serial read 10 bytes
|
||||
Debug: Jandy Packet | HEX: 0x10|0x02|0x78|0x44|0x00|0x58|0x1b|0x41|0x10|0x03|
|
||||
Debug: To ePump: Jandy Packet | HEX: 0x10|0x02|0x78|0x44|0x00|0x58|0x1b|0x41|0x10|0x03|
|
||||
|
||||
Debug: Serial read 7 bytes
|
||||
Debug: Jandy Packet | HEX: 0x10|0x02|0x78|0x41|0xcb|0x10|0x03|
|
||||
Debug: Serial read 7 bytes
|
||||
Debug: Jandy Packet | HEX: 0x10|0x02|0x60|0x00|0x72|0x10|0x03|
|
||||
Debug: Serial read 12 bytes
|
||||
Debug: Jandy Packet | HEX: 0x10|0x02|0x0b|0x02|0x00|0x10|0x40|0x00|0x00|0x6f|0x10|0x03|
|
||||
Debug: Serial read 9 bytes
|
||||
Debug: Jandy Packet | HEX: 0x10|0x02|0x00|0x01|0x80|0x00|0x93|0x10|0x03|
|
||||
Debug: Serial read 24 bytes
|
||||
Debug: Jandy Packet | HEX: 0x10|0x02|0x0b|0x03|0x00|0x50|0x6f|0x6f|0x6c|0x20|0x54|0x65|0x6d|0x70|0x20|0x20|0x36|0x35|0xdf|0x46|0x20|0x60|0x10|0x03|
|
||||
Debug: Serial read 9 bytes
|
||||
Debug: Jandy Packet | HEX: 0x10|0x02|0x00|0x01|0x80|0x00|0x93|0x10|0x03|
|
||||
Debug: Serial read 24 bytes
|
||||
Debug: Jandy Packet | HEX: 0x10|0x02|0x0a|0x04|0x02|0x2e|0x31|0x20|0x20|0x20|0x20|0x20|0x20|0x20|0x20|0x20|0x20|0x20|0x20|0x20|0x20|0x41|0x10|0x03|
|
||||
Debug: RS received packet of type Lng Message length 24
|
||||
Debug: RS SEND cmd '0x00'
|
||||
Debug: Serial write 9 bytes
|
||||
Debug: Jandy Packet | HEX: 0x10|0x02|0x00|0x01|0x81|0x00|0x94|0x10|0x03|
|
||||
Debug: Serial read 7 bytes
|
||||
Debug: Jandy Packet | HEX: 0x10|0x02|0x41|0x00|0x53|0x10|0x03|
|
||||
Debug: Serial read 10 bytes
|
||||
Debug: Jandy Packet | HEX: 0x10|0x02|0x78|0x44|0x00|0x58|0x1b|0x41|0x10|0x03|
|
||||
Debug: To ePump: Jandy Packet | HEX: 0x10|0x02|0x78|0x44|0x00|0x58|0x1b|0x41|0x10|0x03|
|
||||
|
||||
Debug: Serial read 7 bytes
|
||||
Debug: Jandy Packet | HEX: 0x10|0x02|0x78|0x41|0xcb|0x10|0x03|
|
||||
Debug: Serial read 12 bytes
|
||||
Debug: Jandy Packet | HEX: 0x10|0x02|0x0b|0x02|0x00|0x10|0x40|0x00|0x00|0x6f|0x10|0x03|
|
||||
Debug: Serial read 9 bytes
|
||||
Debug: Jandy Packet | HEX: 0x10|0x02|0x00|0x01|0x80|0x00|0x93|0x10|0x03|
|
||||
Debug: Serial read 24 bytes
|
||||
Debug: Jandy Packet | HEX: 0x10|0x02|0x0a|0x04|0x03|0x20|0x20|0x00|0x00|0x00|0x00|0x00|0x00|0x00|0x00|0x00|0x00|0x00|0x00|0x00|0x00|0x63|0x10|0x03|
|
||||
Debug: RS received packet of type Lng Message length 24
|
||||
Debug: RS SEND cmd '0x00'
|
||||
Debug: Serial write 9 bytes
|
||||
Debug: Jandy Packet | HEX: 0x10|0x02|0x00|0x01|0x81|0x00|0x94|0x10|0x03|
|
||||
Debug: Serial read 7 bytes
|
||||
Debug: Jandy Packet | HEX: 0x10|0x02|0x60|0x00|0x72|0x10|0x03|
|
||||
Debug: Serial read 12 bytes
|
||||
Debug: Jandy Packet | HEX: 0x10|0x02|0x0b|0x02|0x00|0x10|0x40|0x00|0x00|0x6f|0x10|0x03|
|
||||
Debug: Serial read 9 bytes
|
||||
Debug: Jandy Packet | HEX: 0x10|0x02|0x00|0x01|0x80|0x00|0x93|0x10|0x03|
|
||||
Debug: Serial read 10 bytes
|
||||
Debug: Jandy Packet | HEX: 0x10|0x02|0x78|0x44|0x00|0x58|0x1b|0x41|0x10|0x03|
|
||||
Debug: To ePump: Jandy Packet | HEX: 0x10|0x02|0x78|0x44|0x00|0x58|0x1b|0x41|0x10|0x03|
|
||||
|
|
@ -6,6 +6,7 @@
|
|||
#include "aqualink.h"
|
||||
#include "utils.h"
|
||||
#include "aq_mqtt.h"
|
||||
#include "packetLogger.h"
|
||||
|
||||
bool processPacketToSWG(unsigned char *packet, int packet_length, struct aqualinkdata *aqdata, int swg_zero_ignore) {
|
||||
static int swg_zero_cnt = 0;
|
||||
|
@ -180,11 +181,27 @@ void get_swg_status_mqtt(struct aqualinkdata *aqdata, char *message, int *status
|
|||
|
||||
bool processPacketToJandyPump(unsigned char *packet_buffer, int packet_length, struct aqualinkdata *aqdata)
|
||||
{
|
||||
logMessage(LOG_DEBUG, "Need to log ePump message here for future\n");
|
||||
char msg[1000];
|
||||
//logMessage(LOG_DEBUG, "Need to log ePump message here for future\n");
|
||||
beautifyPacket(msg, packet_buffer, packet_length);
|
||||
logMessage(LOG_DEBUG, "To ePump: %s\n", msg);
|
||||
return false;
|
||||
}
|
||||
bool processPacketFromJandyPump(unsigned char *packet_buffer, int packet_length, struct aqualinkdata *aqdata)
|
||||
{
|
||||
logMessage(LOG_DEBUG, "Need to log ePump message here for future\n");
|
||||
char msg[1000];
|
||||
//logMessage(LOG_DEBUG, "Need to log ePump message here for future\n");
|
||||
beautifyPacket(msg, packet_buffer, packet_length);
|
||||
logMessage(LOG_DEBUG, "From ePump: %s\n", msg);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
Messages to ePump so far.
|
||||
Debug: To ePump: Jandy Packet | HEX: 0x10|0x02|0x78|0x42|0xcc|0x10|0x03|
|
||||
Debug: To ePump: Jandy Packet | HEX: 0x10|0x02|0x78|0x44|0x00|0x10|0x27|0x05|0x10|0x03|
|
||||
Debug: To ePump: Jandy Packet | HEX: 0x10|0x02|0x78|0x44|0x00|0x58|0x1b|0x41|0x10|0x03|
|
||||
Debug: To ePump: Jandy Packet | HEX: 0x10|0x02|0x78|0x45|0x00|0x05|0xd4|0x10|0x03|
|
||||
Debug: To ePump: Jandy Packet | HEX: 0x10|0x02|0x78|0x46|0x00|0x00|0x03|0xd3|0x10|0x03|
|
||||
Debug: To ePump: Jandy Packet | HEX: 0x10|0x02|0x78|0x46|0x00|0x04|0x00|0xd4|0x10|0x03|
|
||||
*/
|
424
init_buttons.c
424
init_buttons.c
|
@ -14,57 +14,309 @@
|
|||
* https://github.com/sfeakes/aqualinkd
|
||||
*/
|
||||
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include "config.h"
|
||||
#include "domoticz.h"
|
||||
|
||||
#ifdef AQ_RS16
|
||||
void initButtons_RS16(struct aqualinkdata *aqdata);
|
||||
#endif
|
||||
|
||||
char *name2label(char *str)
|
||||
{
|
||||
int len = strlen(str);
|
||||
|
||||
char *newst = malloc(sizeof *newst * (len+1));
|
||||
|
||||
unsigned int i;
|
||||
for(i = 0; i < len; i++) {
|
||||
if ( str[i] == '_' )
|
||||
newst[i] = ' ';
|
||||
else
|
||||
newst[i] = str[i];
|
||||
}
|
||||
newst[len] = '\0';
|
||||
|
||||
return newst;
|
||||
}
|
||||
/*
|
||||
* Link LED numbers to buttons, this is valid for RS8 and below, RS10 and above are different
|
||||
* need to update this code in future.
|
||||
*/
|
||||
|
||||
void initButtons(struct aqualinkdata *aqdata)
|
||||
{
|
||||
//int i;
|
||||
//for (i = 0; i < MAX_PUMPS; i++)
|
||||
// aqdata->pumps[i].buttonID = -1;
|
||||
|
||||
aqdata->aqbuttons[0].led = &aqdata->aqualinkleds[7-1];
|
||||
aqdata->aqbuttons[0].led->state = LED_S_UNKNOWN;
|
||||
aqdata->aqbuttons[0].label = BTN_PUMP;
|
||||
//aqdata->aqbuttons[0].label = "Filter Pump";
|
||||
aqdata->aqbuttons[0].label = name2label(BTN_PUMP);
|
||||
aqdata->aqbuttons[0].name = BTN_PUMP;
|
||||
aqdata->aqbuttons[0].code = KEY_PUMP;
|
||||
aqdata->aqbuttons[0].dz_idx = DZ_NULL_IDX;
|
||||
|
||||
|
||||
aqdata->aqbuttons[1].led = &aqdata->aqualinkleds[6-1];
|
||||
aqdata->aqbuttons[1].led->state = LED_S_UNKNOWN;
|
||||
aqdata->aqbuttons[1].label = name2label(BTN_SPA);
|
||||
aqdata->aqbuttons[1].name = BTN_SPA;
|
||||
aqdata->aqbuttons[1].code = KEY_SPA;
|
||||
aqdata->aqbuttons[1].dz_idx = DZ_NULL_IDX;
|
||||
|
||||
|
||||
aqdata->aqbuttons[2].led = &aqdata->aqualinkleds[5-1];
|
||||
aqdata->aqbuttons[2].led->state = LED_S_UNKNOWN;
|
||||
aqdata->aqbuttons[2].label = name2label(BTN_AUX1);
|
||||
aqdata->aqbuttons[2].name = BTN_AUX1;
|
||||
aqdata->aqbuttons[2].code = KEY_AUX1;
|
||||
aqdata->aqbuttons[2].dz_idx = DZ_NULL_IDX;
|
||||
|
||||
|
||||
aqdata->aqbuttons[3].led = &aqdata->aqualinkleds[4-1];
|
||||
aqdata->aqbuttons[3].led->state = LED_S_UNKNOWN;
|
||||
aqdata->aqbuttons[3].label = name2label(BTN_AUX2);
|
||||
aqdata->aqbuttons[3].name = BTN_AUX2;
|
||||
aqdata->aqbuttons[3].code = KEY_AUX2;
|
||||
aqdata->aqbuttons[3].dz_idx = DZ_NULL_IDX;
|
||||
|
||||
|
||||
aqdata->aqbuttons[4].led = &aqdata->aqualinkleds[3-1];
|
||||
aqdata->aqbuttons[4].led->state = LED_S_UNKNOWN;
|
||||
aqdata->aqbuttons[4].label = name2label(BTN_AUX3);
|
||||
aqdata->aqbuttons[4].name = BTN_AUX3;
|
||||
aqdata->aqbuttons[4].code = KEY_AUX3;
|
||||
aqdata->aqbuttons[4].dz_idx = DZ_NULL_IDX;
|
||||
|
||||
|
||||
aqdata->aqbuttons[5].led = &aqdata->aqualinkleds[9-1];
|
||||
aqdata->aqbuttons[5].led->state = LED_S_UNKNOWN;
|
||||
aqdata->aqbuttons[5].label = name2label(BTN_AUX4);
|
||||
aqdata->aqbuttons[5].name = BTN_AUX4;
|
||||
aqdata->aqbuttons[5].code = KEY_AUX4;
|
||||
aqdata->aqbuttons[5].dz_idx = DZ_NULL_IDX;
|
||||
|
||||
|
||||
aqdata->aqbuttons[6].led = &aqdata->aqualinkleds[8-1];
|
||||
aqdata->aqbuttons[6].led->state = LED_S_UNKNOWN;
|
||||
aqdata->aqbuttons[6].label = name2label(BTN_AUX5);
|
||||
aqdata->aqbuttons[6].name = BTN_AUX5;
|
||||
aqdata->aqbuttons[6].code = KEY_AUX5;
|
||||
aqdata->aqbuttons[6].dz_idx = DZ_NULL_IDX;
|
||||
|
||||
|
||||
aqdata->aqbuttons[7].led = &aqdata->aqualinkleds[12-1];
|
||||
aqdata->aqbuttons[7].led->state = LED_S_UNKNOWN;
|
||||
aqdata->aqbuttons[7].label = name2label(BTN_AUX6);
|
||||
aqdata->aqbuttons[7].name = BTN_AUX6;
|
||||
aqdata->aqbuttons[7].code = KEY_AUX6;
|
||||
aqdata->aqbuttons[7].dz_idx = DZ_NULL_IDX;
|
||||
|
||||
|
||||
aqdata->aqbuttons[8].led = &aqdata->aqualinkleds[1-1];
|
||||
aqdata->aqbuttons[8].led->state = LED_S_UNKNOWN;
|
||||
aqdata->aqbuttons[8].label = name2label(BTN_AUX7);
|
||||
aqdata->aqbuttons[8].name = BTN_AUX7;
|
||||
aqdata->aqbuttons[8].code = KEY_AUX7;
|
||||
aqdata->aqbuttons[8].dz_idx = DZ_NULL_IDX;
|
||||
|
||||
|
||||
aqdata->aqbuttons[9].led = &aqdata->aqualinkleds[15-1];
|
||||
aqdata->aqbuttons[9].led->state = LED_S_UNKNOWN;
|
||||
aqdata->aqbuttons[9].label = name2label(BTN_POOL_HTR);
|
||||
aqdata->aqbuttons[9].name = BTN_POOL_HTR;
|
||||
aqdata->aqbuttons[9].code = KEY_POOL_HTR;
|
||||
aqdata->aqbuttons[9].dz_idx = DZ_NULL_IDX;
|
||||
|
||||
|
||||
aqdata->aqbuttons[10].led = &aqdata->aqualinkleds[17-1];
|
||||
aqdata->aqbuttons[10].led->state = LED_S_UNKNOWN;
|
||||
aqdata->aqbuttons[10].label = name2label(BTN_SPA_HTR);
|
||||
aqdata->aqbuttons[10].name = BTN_SPA_HTR;
|
||||
aqdata->aqbuttons[10].code = KEY_SPA_HTR;
|
||||
aqdata->aqbuttons[10].dz_idx = DZ_NULL_IDX;
|
||||
|
||||
|
||||
aqdata->aqbuttons[11].led = &aqdata->aqualinkleds[19-1];
|
||||
aqdata->aqbuttons[11].led->state = LED_S_UNKNOWN;
|
||||
aqdata->aqbuttons[11].label = name2label(BTN_SOLAR_HTR);
|
||||
aqdata->aqbuttons[11].name = BTN_SOLAR_HTR;
|
||||
aqdata->aqbuttons[11].code = KEY_SOLAR_HTR;
|
||||
aqdata->aqbuttons[11].dz_idx = DZ_NULL_IDX;
|
||||
|
||||
#ifdef AQ_PDA
|
||||
aqdata->aqbuttons[0].pda_label = BTN_PDA_PUMP;
|
||||
aqdata->aqbuttons[1].pda_label = BTN_PDA_SPA;
|
||||
aqdata->aqbuttons[2].pda_label = BTN_PDA_AUX1;
|
||||
aqdata->aqbuttons[3].pda_label = BTN_PDA_AUX2;
|
||||
aqdata->aqbuttons[4].pda_label = BTN_PDA_AUX3;
|
||||
aqdata->aqbuttons[5].pda_label = BTN_PDA_AUX4;
|
||||
aqdata->aqbuttons[6].pda_label = BTN_PDA_AUX5;
|
||||
aqdata->aqbuttons[7].pda_label = BTN_PDA_AUX6;
|
||||
aqdata->aqbuttons[7].pda_label = BTN_PDA_AUX6;
|
||||
aqdata->aqbuttons[8].pda_label = BTN_PDA_AUX7;
|
||||
aqdata->aqbuttons[9].pda_label = BTN_PDA_POOL_HTR;
|
||||
aqdata->aqbuttons[10].pda_label = BTN_PDA_SPA_HTR;
|
||||
aqdata->aqbuttons[11].pda_label = BTN_PDA_SOLAR_HTR;
|
||||
#endif
|
||||
|
||||
}
|
||||
|
||||
#ifdef AQ_RS16
|
||||
|
||||
void initButtons_RS16(struct aqualinkdata *aqdata)
|
||||
{
|
||||
// All buttons up to AUX4 are identical on all panels, so no need to change
|
||||
|
||||
// AUX4 to AUX7 use different LED index & button key codes on RS12 & 16.
|
||||
aqdata->aqbuttons[5].led = &aqdata->aqualinkleds[2-1]; // Change
|
||||
aqdata->aqbuttons[5].code = KEY_RS16_AUX4;
|
||||
aqdata->aqbuttons[6].led = &aqdata->aqualinkleds[11-1]; // Change
|
||||
aqdata->aqbuttons[6].code = KEY_RS16_AUX5;
|
||||
aqdata->aqbuttons[7].led = &aqdata->aqualinkleds[10-1]; // Change
|
||||
aqdata->aqbuttons[7].code = KEY_RS16_AUX6;
|
||||
aqdata->aqbuttons[8].led = &aqdata->aqualinkleds[9-1]; // change
|
||||
aqdata->aqbuttons[8].code = KEY_RS16_AUX7;
|
||||
|
||||
// AUX8 (B1) and beyone are either new or totally different on RS12 & 16
|
||||
|
||||
aqdata->aqbuttons[9].led = &aqdata->aqualinkleds[8-1];
|
||||
aqdata->aqbuttons[9].led->state = LED_S_UNKNOWN;
|
||||
aqdata->aqbuttons[9].label = name2label(BTN_AUXB1); // AUX8
|
||||
aqdata->aqbuttons[9].name = BTN_AUXB1;
|
||||
aqdata->aqbuttons[9].code = KEY_AUXB1;
|
||||
aqdata->aqbuttons[9].dz_idx = DZ_NULL_IDX;
|
||||
|
||||
|
||||
aqdata->aqbuttons[10].led = &aqdata->aqualinkleds[12-1];
|
||||
aqdata->aqbuttons[10].led->state = LED_S_UNKNOWN;
|
||||
aqdata->aqbuttons[10].label = name2label(BTN_AUXB2); // AUX9
|
||||
aqdata->aqbuttons[10].name = BTN_AUXB2;
|
||||
aqdata->aqbuttons[10].code = KEY_AUXB2;
|
||||
aqdata->aqbuttons[10].dz_idx = DZ_NULL_IDX;
|
||||
|
||||
|
||||
aqdata->aqbuttons[11].led = &aqdata->aqualinkleds[1-1];
|
||||
aqdata->aqbuttons[11].led->state = LED_S_UNKNOWN;
|
||||
aqdata->aqbuttons[11].label = name2label(BTN_AUXB3); // AUX10
|
||||
aqdata->aqbuttons[11].name = BTN_AUXB3;
|
||||
aqdata->aqbuttons[11].code = KEY_AUXB3;
|
||||
aqdata->aqbuttons[11].dz_idx = DZ_NULL_IDX;
|
||||
|
||||
|
||||
aqdata->aqbuttons[12].led = &aqdata->aqualinkleds[13-1];
|
||||
aqdata->aqbuttons[12].led->state = LED_S_UNKNOWN;
|
||||
aqdata->aqbuttons[12].label = name2label(BTN_AUXB4); // AUX11
|
||||
aqdata->aqbuttons[12].name = BTN_AUXB4;
|
||||
aqdata->aqbuttons[12].code = KEY_AUXB4;
|
||||
aqdata->aqbuttons[12].dz_idx = DZ_NULL_IDX;
|
||||
|
||||
|
||||
aqdata->aqbuttons[13].led = &aqdata->aqualinkleds[21-1]; // doesn't actually exist
|
||||
aqdata->aqbuttons[13].led->state = OFF; // Since there is no LED in data, set to off and allow messages to turn it on
|
||||
aqdata->aqbuttons[13].label = name2label(BTN_AUXB5);
|
||||
aqdata->aqbuttons[13].name = BTN_AUXB5;
|
||||
aqdata->aqbuttons[13].code = KEY_AUXB5;
|
||||
aqdata->aqbuttons[13].dz_idx = DZ_NULL_IDX;
|
||||
|
||||
|
||||
aqdata->aqbuttons[14].led = &aqdata->aqualinkleds[22-1]; // doesn't actually exist
|
||||
aqdata->aqbuttons[14].led->state = OFF; // Since there is no LED in data, set to off and allow messages to turn it on
|
||||
aqdata->aqbuttons[14].label = name2label(BTN_AUXB6);
|
||||
aqdata->aqbuttons[14].name = BTN_AUXB6;
|
||||
aqdata->aqbuttons[14].code = KEY_AUXB6;
|
||||
aqdata->aqbuttons[14].dz_idx = DZ_NULL_IDX;
|
||||
|
||||
|
||||
aqdata->aqbuttons[15].led = &aqdata->aqualinkleds[23-1]; // doesn't actually exist
|
||||
aqdata->aqbuttons[15].led->state = OFF; // Since there is no LED in data, set to off and allow messages to turn it on
|
||||
aqdata->aqbuttons[15].label = name2label(BTN_AUXB7);
|
||||
aqdata->aqbuttons[15].name = BTN_AUXB7;
|
||||
aqdata->aqbuttons[15].code = KEY_AUXB7;
|
||||
aqdata->aqbuttons[15].dz_idx = DZ_NULL_IDX;
|
||||
|
||||
|
||||
aqdata->aqbuttons[16].led = &aqdata->aqualinkleds[24-1]; // doesn't actually exist
|
||||
aqdata->aqbuttons[16].led->state = OFF; // Since there is no LED in data, set to off and allow messages to turn it on
|
||||
aqdata->aqbuttons[16].label = name2label(BTN_AUXB8);
|
||||
aqdata->aqbuttons[16].name = BTN_AUXB8;
|
||||
aqdata->aqbuttons[16].code = KEY_AUXB8;
|
||||
aqdata->aqbuttons[16].dz_idx = DZ_NULL_IDX;
|
||||
|
||||
|
||||
aqdata->aqbuttons[17].led = &aqdata->aqualinkleds[15-1];
|
||||
aqdata->aqbuttons[17].led->state = LED_S_UNKNOWN;
|
||||
aqdata->aqbuttons[17].label = name2label(BTN_POOL_HTR);
|
||||
aqdata->aqbuttons[17].name = BTN_POOL_HTR;
|
||||
aqdata->aqbuttons[17].code = KEY_POOL_HTR;
|
||||
aqdata->aqbuttons[17].dz_idx = DZ_NULL_IDX;
|
||||
|
||||
|
||||
aqdata->aqbuttons[18].led = &aqdata->aqualinkleds[17-1];
|
||||
aqdata->aqbuttons[18].led->state = LED_S_UNKNOWN;
|
||||
aqdata->aqbuttons[18].label = name2label(BTN_SPA_HTR);
|
||||
aqdata->aqbuttons[18].name = BTN_SPA_HTR;
|
||||
aqdata->aqbuttons[18].code = KEY_SPA_HTR;
|
||||
aqdata->aqbuttons[18].dz_idx = DZ_NULL_IDX;
|
||||
|
||||
|
||||
aqdata->aqbuttons[19].led = &aqdata->aqualinkleds[19-1];
|
||||
aqdata->aqbuttons[19].led->state = LED_S_UNKNOWN;
|
||||
aqdata->aqbuttons[19].label = name2label(BTN_SOLAR_HTR);
|
||||
aqdata->aqbuttons[19].name = BTN_SOLAR_HTR;
|
||||
aqdata->aqbuttons[19].code = KEY_SOLAR_HTR;
|
||||
aqdata->aqbuttons[19].dz_idx = DZ_NULL_IDX;
|
||||
|
||||
|
||||
#ifdef AQ_PDA
|
||||
aqdata->aqbuttons[9].pda_label = BTN_PDA_AUX1;
|
||||
aqdata->aqbuttons[10].pda_label = BTN_PDA_AUX2;
|
||||
aqdata->aqbuttons[11].pda_label = BTN_PDA_AUX3;
|
||||
aqdata->aqbuttons[12].pda_label = BTN_PDA_AUX4;
|
||||
aqdata->aqbuttons[13].pda_label = BTN_PDA_AUX5;
|
||||
aqdata->aqbuttons[14].pda_label = BTN_PDA_AUX6;
|
||||
aqdata->aqbuttons[15].pda_label = BTN_PDA_AUX7;
|
||||
aqdata->aqbuttons[16].pda_label = BTN_PDA_AUX7;
|
||||
aqdata->aqbuttons[17].pda_label = BTN_PDA_POOL_HTR;
|
||||
aqdata->aqbuttons[18].pda_label = BTN_PDA_SPA_HTR;
|
||||
aqdata->aqbuttons[19].pda_label = BTN_PDA_SOLAR_HTR;
|
||||
#endif
|
||||
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
#ifdef DO_NOT_COMPILE
|
||||
|
||||
void initButtons_OLD_RS16(struct aqualinkdata *aqdata)
|
||||
{
|
||||
aqdata->aqbuttons[0].led = &aqdata->aqualinkleds[7-1];
|
||||
aqdata->aqbuttons[0].led->state = LED_S_UNKNOWN;
|
||||
aqdata->aqbuttons[0].label = name2label(BTN_PUMP);
|
||||
aqdata->aqbuttons[0].name = BTN_PUMP;
|
||||
//aqdata->aqbuttons[0].code = (unsigned char *)KEY_PUMP;
|
||||
aqdata->aqbuttons[0].code = KEY_PUMP;
|
||||
aqdata->aqbuttons[0].dz_idx = DZ_NULL_IDX;
|
||||
aqdata->aqbuttons[0].pda_label = BTN_PDA_PUMP;
|
||||
|
||||
aqdata->aqbuttons[1].led = &aqdata->aqualinkleds[6-1];
|
||||
aqdata->aqbuttons[1].led->state = LED_S_UNKNOWN;
|
||||
aqdata->aqbuttons[1].label = BTN_SPA;
|
||||
//aqdata->aqbuttons[1].label = "Spa Mode";
|
||||
aqdata->aqbuttons[1].label = name2label(BTN_SPA);
|
||||
aqdata->aqbuttons[1].name = BTN_SPA;
|
||||
//aqdata->aqbuttons[1].code = (unsigned char *)KEY_SPA;
|
||||
aqdata->aqbuttons[1].code = KEY_SPA;
|
||||
aqdata->aqbuttons[1].dz_idx = DZ_NULL_IDX;
|
||||
aqdata->aqbuttons[1].pda_label = BTN_PDA_SPA;
|
||||
|
||||
aqdata->aqbuttons[2].led = &aqdata->aqualinkleds[5-1];
|
||||
aqdata->aqbuttons[2].led->state = LED_S_UNKNOWN;
|
||||
aqdata->aqbuttons[2].label = BTN_AUX1;
|
||||
//aqdata->aqbuttons[2].label = "Cleaner";
|
||||
aqdata->aqbuttons[2].label = name2label(BTN_AUX1);
|
||||
aqdata->aqbuttons[2].name = BTN_AUX1;
|
||||
//aqdata->aqbuttons[2].code = (unsigned char *)KEY_AUX1;
|
||||
aqdata->aqbuttons[2].code = KEY_AUX1;
|
||||
aqdata->aqbuttons[2].dz_idx = DZ_NULL_IDX;
|
||||
aqdata->aqbuttons[2].pda_label = BTN_PDA_AUX1;
|
||||
//aqdata->aqbuttons[2].pda_label = "CLEANER";
|
||||
|
||||
aqdata->aqbuttons[3].led = &aqdata->aqualinkleds[4-1];
|
||||
aqdata->aqbuttons[3].led->state = LED_S_UNKNOWN;
|
||||
aqdata->aqbuttons[3].label = BTN_AUX2;
|
||||
//aqdata->aqbuttons[3].label = "Waterfall";
|
||||
aqdata->aqbuttons[3].label = name2label(BTN_AUX2);
|
||||
aqdata->aqbuttons[3].name = BTN_AUX2;
|
||||
//aqdata->aqbuttons[3].code = (unsigned char *)KEY_AUX2;
|
||||
aqdata->aqbuttons[3].code = KEY_AUX2;
|
||||
aqdata->aqbuttons[3].dz_idx = DZ_NULL_IDX;
|
||||
aqdata->aqbuttons[3].pda_label = BTN_PDA_AUX2;
|
||||
|
@ -72,79 +324,141 @@ void initButtons(struct aqualinkdata *aqdata)
|
|||
aqdata->aqbuttons[4].led = &aqdata->aqualinkleds[3-1];
|
||||
aqdata->aqbuttons[4].led->state = LED_S_UNKNOWN;
|
||||
aqdata->aqbuttons[4].label = BTN_AUX3;
|
||||
//aqdata->aqbuttons[4].label = "Spa Blower";
|
||||
aqdata->aqbuttons[4].name = BTN_AUX3;
|
||||
//aqdata->aqbuttons[4].code = (unsigned char *)KEY_AUX3;
|
||||
aqdata->aqbuttons[4].code = KEY_AUX3;
|
||||
aqdata->aqbuttons[4].dz_idx = DZ_NULL_IDX;
|
||||
aqdata->aqbuttons[4].pda_label = BTN_PDA_AUX3;
|
||||
|
||||
aqdata->aqbuttons[5].led = &aqdata->aqualinkleds[9-1];
|
||||
aqdata->aqbuttons[5].led = &aqdata->aqualinkleds[2-1]; // Change
|
||||
aqdata->aqbuttons[5].led->state = LED_S_UNKNOWN;
|
||||
aqdata->aqbuttons[5].label = BTN_AUX4;
|
||||
//aqdata->aqbuttons[5].label = "Pool Light";
|
||||
aqdata->aqbuttons[5].label = name2label(BTN_AUX4);
|
||||
aqdata->aqbuttons[5].name = BTN_AUX4;
|
||||
//aqdata->aqbuttons[5].code = (unsigned char *)KEY_AUX4;
|
||||
aqdata->aqbuttons[5].code = KEY_AUX4;
|
||||
aqdata->aqbuttons[5].dz_idx = DZ_NULL_IDX;
|
||||
aqdata->aqbuttons[5].pda_label = BTN_PDA_AUX4;
|
||||
|
||||
aqdata->aqbuttons[6].led = &aqdata->aqualinkleds[8-1];
|
||||
aqdata->aqbuttons[6].led = &aqdata->aqualinkleds[11-1]; // Change
|
||||
aqdata->aqbuttons[6].led->state = LED_S_UNKNOWN;
|
||||
aqdata->aqbuttons[6].label = BTN_AUX5;
|
||||
//aqdata->aqbuttons[6].label = "Spa Light";
|
||||
aqdata->aqbuttons[6].label = name2label(BTN_AUX5);
|
||||
aqdata->aqbuttons[6].name = BTN_AUX5;
|
||||
//aqdata->aqbuttons[6].code = (unsigned char *)KEY_AUX5;
|
||||
aqdata->aqbuttons[6].code = KEY_AUX5;
|
||||
aqdata->aqbuttons[6].dz_idx = DZ_NULL_IDX;
|
||||
aqdata->aqbuttons[6].pda_label = BTN_PDA_AUX5;
|
||||
|
||||
aqdata->aqbuttons[7].led = &aqdata->aqualinkleds[12-1];
|
||||
aqdata->aqbuttons[7].led = &aqdata->aqualinkleds[10-1]; // Change
|
||||
aqdata->aqbuttons[7].led->state = LED_S_UNKNOWN;
|
||||
aqdata->aqbuttons[7].label = BTN_AUX6;
|
||||
aqdata->aqbuttons[7].label = name2label(BTN_AUX6);
|
||||
aqdata->aqbuttons[7].name = BTN_AUX6;
|
||||
//aqdata->aqbuttons[7].code = (unsigned char *)KEY_AUX6;
|
||||
aqdata->aqbuttons[7].code = KEY_AUX6;
|
||||
aqdata->aqbuttons[7].dz_idx = DZ_NULL_IDX;
|
||||
aqdata->aqbuttons[7].pda_label = BTN_PDA_AUX6;
|
||||
|
||||
aqdata->aqbuttons[8].led = &aqdata->aqualinkleds[1-1];
|
||||
aqdata->aqbuttons[8].led = &aqdata->aqualinkleds[9-1]; // change
|
||||
aqdata->aqbuttons[8].led->state = LED_S_UNKNOWN;
|
||||
aqdata->aqbuttons[8].label = BTN_AUX7;
|
||||
aqdata->aqbuttons[8].label = name2label(BTN_AUX7);
|
||||
aqdata->aqbuttons[8].name = BTN_AUX7;
|
||||
//aqdata->aqbuttons[8].code = (unsigned char *)KEY_AUX7;
|
||||
aqdata->aqbuttons[8].code = KEY_AUX7;
|
||||
aqdata->aqbuttons[8].dz_idx = DZ_NULL_IDX;
|
||||
aqdata->aqbuttons[8].pda_label = BTN_PDA_AUX7;
|
||||
|
||||
aqdata->aqbuttons[9].led = &aqdata->aqualinkleds[15-1];
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
aqdata->aqbuttons[9].led = &aqdata->aqualinkleds[8-1];
|
||||
aqdata->aqbuttons[9].led->state = LED_S_UNKNOWN;
|
||||
aqdata->aqbuttons[9].label = BTN_POOL_HTR;
|
||||
//aqdata->aqbuttons[9].label = "Heater";
|
||||
aqdata->aqbuttons[9].name = BTN_POOL_HTR;
|
||||
//aqdata->aqbuttons[9].code = (unsigned char *)KEY_POOL_HTR;
|
||||
aqdata->aqbuttons[9].code = KEY_POOL_HTR;
|
||||
aqdata->aqbuttons[9].label = name2label(BTN_AUXB1); // AUX8
|
||||
aqdata->aqbuttons[9].name = BTN_AUXB1;
|
||||
aqdata->aqbuttons[9].code = KEY_AUXB1;
|
||||
aqdata->aqbuttons[9].dz_idx = DZ_NULL_IDX;
|
||||
aqdata->aqbuttons[9].pda_label = BTN_PDA_POOL_HTR;
|
||||
aqdata->aqbuttons[9].pda_label = BTN_PDA_AUX1;
|
||||
|
||||
aqdata->aqbuttons[10].led = &aqdata->aqualinkleds[17-1];
|
||||
aqdata->aqbuttons[10].led = &aqdata->aqualinkleds[12-1];
|
||||
aqdata->aqbuttons[10].led->state = LED_S_UNKNOWN;
|
||||
aqdata->aqbuttons[10].label = BTN_SPA_HTR;
|
||||
//aqdata->aqbuttons[10].label = "Heater";
|
||||
aqdata->aqbuttons[10].name = BTN_SPA_HTR;
|
||||
//aqdata->aqbuttons[10].code = (unsigned char *)KEY_SPA_HTR;
|
||||
aqdata->aqbuttons[10].code = KEY_SPA_HTR;
|
||||
aqdata->aqbuttons[10].label = name2label(BTN_AUXB2); // AUX9
|
||||
aqdata->aqbuttons[10].name = BTN_AUXB2;
|
||||
aqdata->aqbuttons[10].code = KEY_AUXB2;
|
||||
aqdata->aqbuttons[10].dz_idx = DZ_NULL_IDX;
|
||||
aqdata->aqbuttons[10].pda_label = BTN_PDA_SPA_HTR;
|
||||
aqdata->aqbuttons[10].pda_label = BTN_PDA_AUX2;
|
||||
|
||||
aqdata->aqbuttons[11].led = &aqdata->aqualinkleds[19-1];
|
||||
aqdata->aqbuttons[11].led = &aqdata->aqualinkleds[1-1];
|
||||
aqdata->aqbuttons[11].led->state = LED_S_UNKNOWN;
|
||||
aqdata->aqbuttons[11].label = BTN_SOLAR_HTR;
|
||||
//aqdata->aqbuttons[11].label = "Solar Heater";
|
||||
aqdata->aqbuttons[11].name = BTN_SOLAR_HTR;
|
||||
//aqdata->aqbuttons[11].code = (unsigned char *)KEY_SOLAR_HTR;
|
||||
aqdata->aqbuttons[11].code = KEY_SOLAR_HTR;
|
||||
aqdata->aqbuttons[11].label = name2label(BTN_AUXB3); // AUX10
|
||||
aqdata->aqbuttons[11].name = BTN_AUXB3;
|
||||
aqdata->aqbuttons[11].code = KEY_AUXB3;
|
||||
aqdata->aqbuttons[11].dz_idx = DZ_NULL_IDX;
|
||||
aqdata->aqbuttons[11].pda_label = BTN_PDA_SOLAR_HTR;
|
||||
aqdata->aqbuttons[11].pda_label = BTN_PDA_AUX3;
|
||||
|
||||
}
|
||||
aqdata->aqbuttons[12].led = &aqdata->aqualinkleds[13-1];
|
||||
aqdata->aqbuttons[12].led->state = LED_S_UNKNOWN;
|
||||
aqdata->aqbuttons[12].label = name2label(BTN_AUXB4); // AUX11
|
||||
aqdata->aqbuttons[12].name = BTN_AUXB4;
|
||||
aqdata->aqbuttons[12].code = KEY_AUXB4;
|
||||
aqdata->aqbuttons[12].dz_idx = DZ_NULL_IDX;
|
||||
aqdata->aqbuttons[12].pda_label = BTN_PDA_AUX4;
|
||||
|
||||
aqdata->aqbuttons[13].led = &aqdata->aqualinkleds[21-1]; // doesn't actually exist
|
||||
aqdata->aqbuttons[13].led->state = LED_S_UNKNOWN;
|
||||
aqdata->aqbuttons[13].label = name2label(BTN_AUXB5);
|
||||
aqdata->aqbuttons[13].name = BTN_AUXB5;
|
||||
aqdata->aqbuttons[13].code = KEY_AUXB5;
|
||||
aqdata->aqbuttons[13].dz_idx = DZ_NULL_IDX;
|
||||
aqdata->aqbuttons[13].pda_label = BTN_PDA_AUX5;
|
||||
|
||||
aqdata->aqbuttons[14].led = &aqdata->aqualinkleds[22-1]; // doesn't actually exist
|
||||
aqdata->aqbuttons[14].led->state = LED_S_UNKNOWN;
|
||||
aqdata->aqbuttons[14].label = name2label(BTN_AUXB6);
|
||||
aqdata->aqbuttons[14].name = BTN_AUXB6;
|
||||
aqdata->aqbuttons[14].code = KEY_AUXB6;
|
||||
aqdata->aqbuttons[14].dz_idx = DZ_NULL_IDX;
|
||||
aqdata->aqbuttons[14].pda_label = BTN_PDA_AUX6;
|
||||
|
||||
aqdata->aqbuttons[15].led = &aqdata->aqualinkleds[23-1]; // doesn't actually exist
|
||||
aqdata->aqbuttons[15].led->state = LED_S_UNKNOWN;
|
||||
aqdata->aqbuttons[15].label = name2label(BTN_AUXB7);
|
||||
aqdata->aqbuttons[15].name = BTN_AUXB7;
|
||||
aqdata->aqbuttons[15].code = KEY_AUXB7;
|
||||
aqdata->aqbuttons[15].dz_idx = DZ_NULL_IDX;
|
||||
aqdata->aqbuttons[15].pda_label = BTN_PDA_AUX7;
|
||||
|
||||
aqdata->aqbuttons[16].led = &aqdata->aqualinkleds[24-1]; // doesn't actually exist
|
||||
aqdata->aqbuttons[16].led->state = LED_S_UNKNOWN;
|
||||
aqdata->aqbuttons[16].label = name2label(BTN_AUXB8);
|
||||
aqdata->aqbuttons[16].name = BTN_AUXB8;
|
||||
aqdata->aqbuttons[16].code = KEY_AUXB8;
|
||||
aqdata->aqbuttons[16].dz_idx = DZ_NULL_IDX;
|
||||
aqdata->aqbuttons[16].pda_label = BTN_PDA_AUX7;
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
aqdata->aqbuttons[17].led = &aqdata->aqualinkleds[15-1];
|
||||
aqdata->aqbuttons[17].led->state = LED_S_UNKNOWN;
|
||||
aqdata->aqbuttons[17].label = name2label(BTN_POOL_HTR);
|
||||
aqdata->aqbuttons[17].name = BTN_POOL_HTR;
|
||||
aqdata->aqbuttons[17].code = KEY_POOL_HTR;
|
||||
aqdata->aqbuttons[17].dz_idx = DZ_NULL_IDX;
|
||||
aqdata->aqbuttons[17].pda_label = BTN_PDA_POOL_HTR;
|
||||
|
||||
aqdata->aqbuttons[18].led = &aqdata->aqualinkleds[17-1];
|
||||
aqdata->aqbuttons[18].led->state = LED_S_UNKNOWN;
|
||||
aqdata->aqbuttons[18].label = name2label(BTN_SPA_HTR);
|
||||
aqdata->aqbuttons[18].name = BTN_SPA_HTR;
|
||||
aqdata->aqbuttons[18].code = KEY_SPA_HTR;
|
||||
aqdata->aqbuttons[18].dz_idx = DZ_NULL_IDX;
|
||||
aqdata->aqbuttons[18].pda_label = BTN_PDA_SPA_HTR;
|
||||
|
||||
aqdata->aqbuttons[19].led = &aqdata->aqualinkleds[19-1];
|
||||
aqdata->aqbuttons[19].led->state = LED_S_UNKNOWN;
|
||||
aqdata->aqbuttons[19].label = name2label(BTN_SOLAR_HTR);
|
||||
aqdata->aqbuttons[19].name = BTN_SOLAR_HTR;
|
||||
aqdata->aqbuttons[19].code = KEY_SOLAR_HTR;
|
||||
aqdata->aqbuttons[19].dz_idx = DZ_NULL_IDX;
|
||||
aqdata->aqbuttons[19].pda_label = BTN_PDA_SOLAR_HTR;
|
||||
|
||||
}
|
||||
|
||||
#endif
|
|
@ -9,6 +9,12 @@
|
|||
|
||||
void initButtons(struct aqualinkdata *aqdata);
|
||||
|
||||
#ifndef AQ_RS16
|
||||
#define TOTAL_BUTONS 12
|
||||
#else
|
||||
#define TOTAL_BUTONS 20
|
||||
// This needs to be called AFTER and as well as initButtons
|
||||
void initButtons_RS16(struct aqualinkdata *aqdata);
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
|
117
json_messages.c
117
json_messages.c
|
@ -216,7 +216,7 @@ int build_device_JSON(struct aqualinkdata *aqdata, char* buffer, int size, bool
|
|||
|
||||
length += sprintf(buffer+length, ", \"devices\": [");
|
||||
|
||||
for (i=0; i < TOTAL_BUTTONS; i++)
|
||||
for (i=0; i < aqdata->total_buttons; i++)
|
||||
{
|
||||
if ( strcmp(BTN_POOL_HTR,aqdata->aqbuttons[i].name) == 0 && aqdata->pool_htr_set_point != TEMP_UNKNOWN) {
|
||||
length += sprintf(buffer+length, "{\"type\": \"setpoint_thermo\", \"id\": \"%s\", \"name\": \"%s\", \"state\": \"%s\", \"status\": \"%s\", \"spvalue\": \"%.*f\", \"value\": \"%.*f\", \"int_status\": \"%d\" },",
|
||||
|
@ -468,30 +468,12 @@ int build_aqualink_status_JSON(struct aqualinkdata *aqdata, char* buffer, int si
|
|||
length += sprintf(buffer+length, ",\"chem_orp\":\"%d\"",aqdata->orp );
|
||||
|
||||
length += sprintf(buffer+length, ",\"leds\":{" );
|
||||
for (i=0; i < TOTAL_BUTTONS; i++)
|
||||
for (i=0; i < aqdata->total_buttons; i++)
|
||||
{
|
||||
/*
|
||||
char *state = JSON_OFF;
|
||||
switch (aqdata->aqbuttons[i].led->state)
|
||||
{
|
||||
case ON:
|
||||
state = JSON_ON;
|
||||
break;
|
||||
case OFF:
|
||||
case LED_S_UNKNOWN:
|
||||
state = JSON_OFF;
|
||||
break;
|
||||
case FLASH:
|
||||
state = JSON_FLASH;
|
||||
break;
|
||||
case ENABLE:
|
||||
state = JSON_ENABLED;
|
||||
break;
|
||||
}*/
|
||||
char *state = LED2text(aqdata->aqbuttons[i].led->state);
|
||||
length += sprintf(buffer+length, "\"%s\": \"%s\"", aqdata->aqbuttons[i].name, state);
|
||||
|
||||
if (i+1 < TOTAL_BUTTONS)
|
||||
if (i+1 < aqdata->total_buttons)
|
||||
length += sprintf(buffer+length, "," );
|
||||
}
|
||||
|
||||
|
@ -524,40 +506,6 @@ int build_aqualink_status_JSON(struct aqualinkdata *aqdata, char* buffer, int si
|
|||
length += sprintf(buffer+length, "}" );
|
||||
|
||||
buffer[length] = '\0';
|
||||
|
||||
/*
|
||||
buffer[length] = '\0';
|
||||
|
||||
strncpy(buffer2, test_message, strlen(test_message)+1);
|
||||
|
||||
for (i=0; i < strlen(buffer); i++) {
|
||||
logMessage (LOG_DEBUG, "buffer[%d] = '%c' | '%c'\n",i,buffer[i],buffer2[i]);
|
||||
}
|
||||
|
||||
logMessage (LOG_DEBUG, "JSON Size %d\n",strlen(buffer));
|
||||
printf("%s\n",buffer);
|
||||
for (i=strlen(buffer); i > strlen(buffer)-10; i--) {
|
||||
logMessage (LOG_DEBUG, "buffer[%d] = '%c'\n",i,buffer[i]);
|
||||
}
|
||||
for (i=10; i >= 0; i--) {
|
||||
logMessage (LOG_DEBUG, "buffer[%d] = '%c'\n",i,buffer[i]);
|
||||
}
|
||||
|
||||
//return length-1;
|
||||
|
||||
|
||||
logMessage (LOG_DEBUG, "JSON Size %d\n",strlen(buffer2));
|
||||
printf("%s\n",buffer2);
|
||||
for (i=strlen(buffer2); i > strlen(buffer2)-10; i--) {
|
||||
logMessage (LOG_DEBUG, "buffer[%d] = '%c'\n",i,buffer2[i]);
|
||||
}
|
||||
for (i=10; i >= 0; i--) {
|
||||
logMessage (LOG_DEBUG, "buffer[%d] = '%c'\n",i,buffer2[i]);
|
||||
}
|
||||
//return strlen(test_message);
|
||||
*/
|
||||
|
||||
//printf("Buffer = %d, JSON = %d",size ,strlen(buffer));
|
||||
|
||||
return strlen(buffer);
|
||||
}
|
||||
|
@ -570,7 +518,7 @@ int build_aux_labels_JSON(struct aqualinkdata *aqdata, char* buffer, int size)
|
|||
|
||||
length += sprintf(buffer+length, "{\"type\": \"aux_labels\"");
|
||||
|
||||
for (i=0; i < TOTAL_BUTTONS; i++)
|
||||
for (i=0; i < aqdata->total_buttons; i++)
|
||||
{
|
||||
length += sprintf(buffer+length, ",\"%s\": \"%s\"", aqdata->aqbuttons[i].name, aqdata->aqbuttons[i].label);
|
||||
}
|
||||
|
@ -588,6 +536,63 @@ int build_aux_labels_JSON(struct aqualinkdata *aqdata, char* buffer, int size)
|
|||
// WS Received '{"command":"KEY_HTR_POOL"}'
|
||||
// WS Received '{"command":"GET_AUX_LABELS"}'
|
||||
|
||||
bool parseJSONrequest(char *buffer, struct JSONkvptr *request)
|
||||
{
|
||||
int i=0;
|
||||
int found=0;
|
||||
bool reading = false;
|
||||
|
||||
request->kv[0].key = NULL;
|
||||
request->kv[0].value = NULL;
|
||||
request->kv[1].key = NULL;
|
||||
request->kv[1].value = NULL;
|
||||
request->kv[2].key = NULL;
|
||||
request->kv[2].value = NULL;
|
||||
request->kv[3].key = NULL;
|
||||
request->kv[3].value = NULL;
|
||||
|
||||
int length = strlen(buffer);
|
||||
|
||||
while ( i < length )
|
||||
{
|
||||
//printf ("Reading %c",buffer[i]);
|
||||
switch (buffer[i]) {
|
||||
case '{':
|
||||
case '"':
|
||||
case '}':
|
||||
case ':':
|
||||
case ',':
|
||||
case ' ':
|
||||
// Ignore space , : if reading a string
|
||||
if (reading == true && buffer[i] != ' ' && buffer[i] != ',' && buffer[i] != ':'){
|
||||
//printf (" <- END");
|
||||
reading = false;
|
||||
buffer[i] = '\0';
|
||||
found++;
|
||||
}
|
||||
break;
|
||||
|
||||
default:
|
||||
if (reading == false) {
|
||||
//printf (" <- START");
|
||||
reading = true;
|
||||
if ( found%2 == 0 )
|
||||
request->kv[found / 2].key = &buffer[i];
|
||||
else
|
||||
request->kv[(found-1) / 2].value = &buffer[i];
|
||||
}
|
||||
break;
|
||||
}
|
||||
//printf ("\n");
|
||||
if (found >= 8)
|
||||
break;
|
||||
|
||||
i++;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
bool parseJSONwebrequest(char *buffer, struct JSONwebrequest *request)
|
||||
{
|
||||
int i=0;
|
||||
|
|
|
@ -3,9 +3,13 @@
|
|||
|
||||
//FUNCTION PROTOTYPES
|
||||
|
||||
#define JSON_LABEL_SIZE 300
|
||||
#define JSON_BUFFER_SIZE 4000
|
||||
#define JSON_STATUS_SIZE 1024
|
||||
//#define JSON_LABEL_SIZE 300
|
||||
//#define JSON_BUFFER_SIZE 4000
|
||||
//#define JSON_STATUS_SIZE 1024
|
||||
#define JSON_LABEL_SIZE 600
|
||||
#define JSON_BUFFER_SIZE 5120
|
||||
#define JSON_STATUS_SIZE 2048
|
||||
|
||||
#define JSON_MQTT_MSG_SIZE 100
|
||||
|
||||
#define JSON_ON "on"
|
||||
|
@ -34,10 +38,15 @@ struct JSONwebrequest {
|
|||
struct JSONkeyvalue second;
|
||||
struct JSONkeyvalue third;
|
||||
};
|
||||
struct JSONkvptr {
|
||||
struct JSONkeyvalue kv[4];
|
||||
};
|
||||
|
||||
int build_aqualink_status_JSON(struct aqualinkdata *aqdata, char* buffer, int size);
|
||||
int build_aux_labels_JSON(struct aqualinkdata *aqdata, char* buffer, int size);
|
||||
bool parseJSONwebrequest(char *buffer, struct JSONwebrequest *request);
|
||||
bool parseJSONrequest(char *buffer, struct JSONkvptr *request);
|
||||
|
||||
int build_mqtt_status_JSON(char* buffer, int size, int idx, int nvalue, float setpoint/*char *svalue*/);
|
||||
bool parseJSONmqttrequest(const char *str, size_t len, int *idx, int *nvalue, char *svalue);
|
||||
int build_aqualink_error_status_JSON(char* buffer, int size, char *msg);
|
||||
|
|
1338
net_services.c
1338
net_services.c
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
|
@ -6,6 +6,11 @@
|
|||
#define GET_RTN_NOT_CHANGED "Not Changed"
|
||||
#define GET_RTN_ERROR "Error"
|
||||
|
||||
|
||||
#define CONTENT_JSON "Content-Type: application/json"
|
||||
#define CONTENT_JS "Content-Type: text/javascript"
|
||||
#define CONTENT_TEXT "Content-Type: text/plain"
|
||||
|
||||
//void main_server();
|
||||
//void main_server_TEST(struct aqualinkdata *aqdata, char *s_http_port);
|
||||
//bool start_web_server(struct mg_mgr *mgr, struct aqualinkdata *aqdata, char *port, char* web_root);
|
||||
|
|
56
onetouch.c
56
onetouch.c
|
@ -12,6 +12,7 @@
|
|||
#include "packetLogger.h"
|
||||
#include "aq_programmer.h"
|
||||
#include "aqualink.h"
|
||||
#include "config.h"
|
||||
//#include "pda_menu.h"
|
||||
|
||||
|
||||
|
@ -23,6 +24,9 @@ struct ot_macro _macros[3];
|
|||
|
||||
void set_macro_status();
|
||||
void pump_update(struct aqualinkdata *aq_data, int updated);
|
||||
#ifdef AQ_RS16
|
||||
void rs16led_update(struct aqualinkdata *aq_data, int updated);
|
||||
#endif
|
||||
|
||||
void print_onetouch_menu()
|
||||
{
|
||||
|
@ -234,6 +238,7 @@ bool log_freeze_setpoints(struct aqualinkdata *aq_data)
|
|||
|
||||
bool log_qeuiptment_status(struct aqualinkdata *aq_data)
|
||||
{
|
||||
int i;
|
||||
bool rtn = false;
|
||||
|
||||
if (ot_strcmp(_menu[2],"Intelliflo VS") == 0 ||
|
||||
|
@ -261,7 +266,6 @@ bool log_qeuiptment_status(struct aqualinkdata *aq_data)
|
|||
|
||||
logMessage(LOG_DEBUG, "OneTouch Pump %s, Index %d, RPM %d, Watts %d, GPM %d\n",_menu[2],pump_index,rpm,watts,gpm);
|
||||
|
||||
int i;
|
||||
for (i=0; i < aq_data->num_pumps; i++) {
|
||||
if (aq_data->pumps[i].pumpIndex == pump_index) {
|
||||
//printf("**** FOUND PUMP %d at index %d *****\n",pump_index,i);
|
||||
|
@ -301,6 +305,10 @@ bool log_qeuiptment_status(struct aqualinkdata *aq_data)
|
|||
}
|
||||
logMessage(LOG_DEBUG, "OneTouch PPM = %d\n",ppm);
|
||||
}
|
||||
// If it's off, turn it on.
|
||||
if (aq_data->ar_swg_status == SWG_STATUS_OFF || aq_data->ar_swg_status == SWG_STATUS_UNKNOWN)
|
||||
aq_data->ar_swg_status = SWG_STATUS_ON;
|
||||
|
||||
} else if (ot_strcmp(_menu[2],"Chemlink") == 0) {
|
||||
/* Info: OneTouch Menu Line 0 = Equipment Status
|
||||
Info: OneTouch Menu Line 1 =
|
||||
|
@ -319,6 +327,22 @@ bool log_qeuiptment_status(struct aqualinkdata *aq_data)
|
|||
}
|
||||
}
|
||||
|
||||
#ifdef AQ_RS16
|
||||
else if (_aqconfig_.rs_panel_size >= 16 ) { // Run over devices that have no status LED's on RS12&16 panels.
|
||||
int j;
|
||||
for (i=2; i <= ONETOUCH_LINES; i++) {
|
||||
for (j = RS16_VBUTTONS_START; j <= RS16_VBUTTONS_END; j++) {
|
||||
if ( ot_strcmp(_menu[i], aq_data->aqbuttons[j].label) == 0 ) {
|
||||
//Matched must be on.
|
||||
logMessage(LOG_DEBUG, "OneTouch equiptment status '%s' matched '%s'\n",_menu[i],aq_data->aqbuttons[j].label);
|
||||
rs16led_update(aq_data, j);
|
||||
aq_data->aqbuttons[j].led->state = ON;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
return rtn;
|
||||
|
@ -371,6 +395,32 @@ void pump_update(struct aqualinkdata *aq_data, int updated) {
|
|||
}
|
||||
}
|
||||
|
||||
#ifdef AQ_RS16
|
||||
void rs16led_update(struct aqualinkdata *aq_data, int updated) {
|
||||
//logMessage(LOG_INFO, "******* VLED check %d ******\n",updated);
|
||||
const int bitmask[4] = {1,2,4,8};
|
||||
static unsigned char updates = '\0';
|
||||
int i;
|
||||
|
||||
if (_aqconfig_.rs_panel_size < 16)
|
||||
return;
|
||||
|
||||
if (updated == -1) {
|
||||
for(i=RS16_VBUTTONS_START; i <= RS16_VBUTTONS_END; i++) {
|
||||
if ((updates & bitmask[i-RS16_VBUTTONS_START]) != bitmask[i-RS16_VBUTTONS_START]) {
|
||||
aq_data->aqbuttons[i].led->state = OFF;
|
||||
//logMessage(LOG_INFO, "******* Turning off VLED %d ******\n",i);
|
||||
}
|
||||
}
|
||||
updates = '\0';
|
||||
} else if (updated >= RS16_VBUTTONS_START && updated <= RS16_VBUTTONS_END) {
|
||||
updates |= bitmask[updated - RS16_VBUTTONS_START];
|
||||
//logMessage(LOG_INFO, "******* Updated VLED status %d ******\n",updated);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
bool new_menu(struct aqualinkdata *aq_data)
|
||||
{
|
||||
static bool initRS = false;
|
||||
|
@ -416,6 +466,10 @@ bool new_menu(struct aqualinkdata *aq_data)
|
|||
if (last_menu_type == OTM_EQUIPTMENT_STATUS && menu_type != OTM_EQUIPTMENT_STATUS ) {
|
||||
// End of equiptment status chain of menus, reset any pump that wasn't listed in menus
|
||||
pump_update(aq_data, -1);
|
||||
#ifdef AQ_RS16
|
||||
if (_aqconfig_.rs_panel_size >= 16)
|
||||
rs16led_update(aq_data, -1);
|
||||
#endif
|
||||
}
|
||||
|
||||
last_menu_type = menu_type;
|
||||
|
|
|
@ -400,7 +400,7 @@ void *set_aqualink_pump_rpm( void *ptr )
|
|||
|
||||
waitForSingleThreadOrTerminate(threadCtrl, AQ_SET_ONETOUCH_PUMP_RPM);
|
||||
|
||||
logMessage(LOG_NOTICE, "OneTouch Set Pump %d to RPM %d\n",pumpIndex,pumpRPM);
|
||||
logMessage(LOG_INFO, "OneTouch Set Pump %d to RPM %d\n",pumpIndex,pumpRPM);
|
||||
|
||||
|
||||
if (! goto_onetouch_menu(aq_data, OTM_EQUIPTMENT_ONOFF) ){
|
||||
|
|
|
@ -12,6 +12,7 @@ static bool _log2file = false;
|
|||
static bool _includePentair = false;
|
||||
|
||||
void _logPacket(unsigned char *packet_buffer, int packet_length, bool error, bool force);
|
||||
int _beautifyPacket(char *buff, unsigned char *packet_buffer, int packet_length, bool error);
|
||||
|
||||
void startPacketLogger(bool debug_RSProtocol_packets, bool read_pentair_packets) {
|
||||
_log2file = debug_RSProtocol_packets;
|
||||
|
@ -55,6 +56,41 @@ void _logPacket(unsigned char *packet_buffer, int packet_length, bool error, boo
|
|||
return;
|
||||
|
||||
char buff[1000];
|
||||
//int i = 0;
|
||||
//int cnt = 0;
|
||||
|
||||
_beautifyPacket(buff, packet_buffer, packet_length, error);
|
||||
/*
|
||||
if (_includePentair) {
|
||||
cnt = sprintf(buff, "%s%8.8s Packet | HEX: ",(error?"BAD PACKET ":""),getProtocolType(packet_buffer)==JANDY?"Jandy":"Pentair");
|
||||
} else {
|
||||
cnt = sprintf(buff, "%sTo 0x%02hhx of type %8.8s | HEX: ",(error?"BAD PACKET ":""), packet_buffer[PKT_DEST], get_packet_type(packet_buffer, packet_length));
|
||||
}
|
||||
|
||||
for (i = 0; i < packet_length; i++)
|
||||
cnt += sprintf(buff + cnt, "0x%02hhx|", packet_buffer[i]);
|
||||
|
||||
cnt += sprintf(buff + cnt, "\n");
|
||||
*/
|
||||
if (_log2file)
|
||||
writePacketLog(buff);
|
||||
|
||||
if (error == true)
|
||||
logMessage(LOG_WARNING, "%s", buff);
|
||||
else {
|
||||
if (force)
|
||||
logMessage(LOG_DEBUG, "%s", buff);
|
||||
else
|
||||
logMessage(LOG_DEBUG_SERIAL, "%s", buff);
|
||||
}
|
||||
}
|
||||
|
||||
int beautifyPacket(char *buff, unsigned char *packet_buffer, int packet_length)
|
||||
{
|
||||
return _beautifyPacket(buff, packet_buffer, packet_length, false);
|
||||
}
|
||||
int _beautifyPacket(char *buff, unsigned char *packet_buffer, int packet_length, bool error)
|
||||
{
|
||||
int i = 0;
|
||||
int cnt = 0;
|
||||
|
||||
|
@ -69,17 +105,7 @@ void _logPacket(unsigned char *packet_buffer, int packet_length, bool error, boo
|
|||
|
||||
cnt += sprintf(buff + cnt, "\n");
|
||||
|
||||
if (_log2file)
|
||||
writePacketLog(buff);
|
||||
|
||||
if (error == true)
|
||||
logMessage(LOG_WARNING, "%s", buff);
|
||||
else {
|
||||
if (force)
|
||||
logMessage(LOG_DEBUG, "%s", buff);
|
||||
else
|
||||
logMessage(LOG_DEBUG_SERIAL, "%s", buff);
|
||||
}
|
||||
return cnt;
|
||||
}
|
||||
|
||||
//#define RAW_BUFFER_SIZE 100
|
||||
|
|
|
@ -15,6 +15,6 @@ void logPacketByte(unsigned char *byte);
|
|||
|
||||
// Only use for manual debugging
|
||||
void debuglogPacket(unsigned char *packet_buffer, int packet_length);
|
||||
|
||||
int beautifyPacket(char *buff, unsigned char *packet_buffer, int packet_length);
|
||||
|
||||
#endif //PACKETLOGGER_H_
|
8
pda.c
8
pda.c
|
@ -222,7 +222,7 @@ void pass_pda_equiptment_status_item(char *msg)
|
|||
}
|
||||
else
|
||||
{
|
||||
for (i = 0; i < TOTAL_BUTTONS; i++)
|
||||
for (i = 0; i < _aqualink_data->total_buttons; i++)
|
||||
{
|
||||
if (strcasecmp(msg, _aqualink_data->aqbuttons[i].pda_label) == 0)
|
||||
{
|
||||
|
@ -304,7 +304,7 @@ void process_pda_packet_msg_long_equipment_control(const char *msg)
|
|||
|
||||
logMessage(LOG_DEBUG, "*** Checking Equiptment '%s'\n", labelBuff);
|
||||
|
||||
for (i = 0; i < TOTAL_BUTTONS; i++)
|
||||
for (i = 0; i < _aqualink_data->total_buttons; i++)
|
||||
{
|
||||
if (strcasecmp(stripwhitespace(labelBuff), _aqualink_data->aqbuttons[i].pda_label) == 0)
|
||||
{
|
||||
|
@ -474,7 +474,7 @@ void process_pda_packet_msg_long_unknown(const char *msg)
|
|||
// So we are not in any PDA menu, try to catch that message here so we catch new device state ASAP.
|
||||
if (msg[AQ_MSGLEN - 1] == 'N' || msg[AQ_MSGLEN - 1] == 'F' || msg[AQ_MSGLEN - 1] == 'A' || msg[AQ_MSGLEN - 1] == '*')
|
||||
{
|
||||
for (i = 0; i < TOTAL_BUTTONS; i++)
|
||||
for (i = 0; i < _aqualink_data->total_buttons; i++)
|
||||
{
|
||||
if (stristr(msg, _aqualink_data->aqbuttons[i].pda_label) != NULL)
|
||||
{
|
||||
|
@ -593,7 +593,7 @@ bool process_pda_packet(unsigned char *packet, int length)
|
|||
|
||||
if (pda_m_line(PDA_LINES - 1)[0] == '\0')
|
||||
{
|
||||
for (i = 0; i < TOTAL_BUTTONS; i++)
|
||||
for (i = 0; i < _aqualink_data->total_buttons; i++)
|
||||
{
|
||||
if (_aqualink_data->aqbuttons[i].led->state != FLASH)
|
||||
{
|
||||
|
|
|
@ -475,7 +475,7 @@ void *set_aqualink_PDA_device_on_off( void *ptr )
|
|||
unsigned int device = atoi(&buf[0]);
|
||||
unsigned int state = atoi(&buf[5]);
|
||||
|
||||
if (device > TOTAL_BUTTONS) {
|
||||
if (device > aq_data->total_buttons) {
|
||||
logMessage(LOG_ERR, "PDA Device On/Off :- bad device number '%d'\n",device);
|
||||
cleanAndTerminateThread(threadCtrl);
|
||||
return ptr;
|
||||
|
|
Binary file not shown.
|
@ -63,6 +63,8 @@ report_zero_pool_temp = no
|
|||
# Working RS ID's are 0x0a 0x0b 0x09 0x08 <- 0x08 is usually taken
|
||||
# You can use 0x00 and AqualinkD will find an ID for you, but this makes a slow startup
|
||||
device_id=0x0a
|
||||
# If your panel is a PDA only model, then PDA device ID's are 0x60, 0x61, 0x62, 0x63.
|
||||
# (These are NOT recomended to use unless you absolutly have no other option)
|
||||
|
||||
# The ID for extended settings, These are ONE TOUCH MACROS & VARIABLE SPEED PUMP RPM
|
||||
# Do not enable this if you don't use either, you'll just waste memory and cpu cycles
|
||||
|
|
Binary file not shown.
|
@ -190,6 +190,7 @@ void printHex(char *pk, int length)
|
|||
|
||||
void printPacket(unsigned char ID, unsigned char *packet_buffer, int packet_length)
|
||||
{
|
||||
int i;
|
||||
//if (_filter != 0x00 && ID != _filter && packet_buffer[PKT_DEST] != _filter )
|
||||
// return;
|
||||
if (_rawlog) {
|
||||
|
@ -200,7 +201,7 @@ void printPacket(unsigned char ID, unsigned char *packet_buffer, int packet_leng
|
|||
|
||||
if (_filters != 0)
|
||||
{
|
||||
int i;
|
||||
//int i;
|
||||
bool dest_match = false;
|
||||
bool src_match = false;
|
||||
|
||||
|
@ -236,7 +237,11 @@ void printPacket(unsigned char ID, unsigned char *packet_buffer, int packet_leng
|
|||
if (packet_buffer[PKT_CMD] == CMD_MSG || packet_buffer[PKT_CMD] == CMD_MSG_LONG) {
|
||||
printf(" Message : ");
|
||||
//fwrite(packet_buffer + 4, 1, AQ_MSGLEN+1, stdout);
|
||||
fwrite(packet_buffer + 4, 1, packet_length-7, stdout);
|
||||
//fwrite(packet_buffer + 4, 1, packet_length-7, stdout);
|
||||
for(i=4; i < packet_length-3; i++) {
|
||||
if (packet_buffer[i] >= 32 && packet_buffer[i] <= 126)
|
||||
printf("%c",packet_buffer[i]);
|
||||
}
|
||||
}
|
||||
|
||||
//if (packet_buffer[PKT_DEST]==0x00)
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
|
||||
|
||||
#define AQUALINKD_NAME "Aqualink Daemon"
|
||||
#define AQUALINKD_VERSION "2.0.1"
|
||||
#define AQUALINKD_VERSION "2.1.0"
|
||||
|
|
|
@ -14,6 +14,14 @@
|
|||
"Aux_5",
|
||||
"Aux_6",
|
||||
"Aux_7",
|
||||
"Aux_B1",
|
||||
"Aux_B2",
|
||||
"Aux_B3",
|
||||
"Aux_B4",
|
||||
"Aux_B5",
|
||||
"Aux_B6",
|
||||
"Aux_B7",
|
||||
"Aux_B8",
|
||||
"Pool_Heater",
|
||||
"Spa_Heater",
|
||||
"SWG",
|
||||
|
@ -66,7 +74,11 @@
|
|||
|
||||
// By default all Variable Speed Pumps will show RPM.
|
||||
// this will show GPM on VSP's that you can only set GPM (ie Jandy VF pumps)
|
||||
//var show_vsp_gpm=false;
|
||||
//var show_vsp_gpm=false;
|
||||
|
||||
// By default all Temperatures & Value tiles are off.
|
||||
// this will turn them on
|
||||
var turn_on_sensortiles = true;
|
||||
|
||||
var body_background = "#EBEBEA";
|
||||
var body_text = "#000000";
|
||||
|
|
|
@ -11,7 +11,8 @@
|
|||
<link href='aqualinkd.png' rel='apple-touch-icon'>
|
||||
<link href='aqualinkd.png' rel='icon'>
|
||||
<script src='config.js'></script>
|
||||
<script src='?command=dynamic_config'></script>
|
||||
<!--<script src='?command=dynamic_config'></script>-->
|
||||
<script src='/api/dynamicconfig'></script>
|
||||
<style>
|
||||
:root {
|
||||
--fonts: 'HelveticaNeue-Light', 'Helvetica Neue Light', 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif;
|
||||
|
@ -755,11 +756,12 @@
|
|||
function setTileState(id, state) {
|
||||
try {
|
||||
if (state == (document.getElementById(id).getAttribute('status') == 'off')) {
|
||||
send_command(id);
|
||||
send_command(id, (state==true?1:0) );
|
||||
//console.log("Switch state "+id+" to "+(state)?"on":"off");
|
||||
} else {
|
||||
//console.log("state "+id+" to "+(state)?"on":"off")
|
||||
}
|
||||
|
||||
setTileOn(id, ((state) ? "on" : "off"));
|
||||
} catch(exception) {}
|
||||
}
|
||||
|
@ -772,22 +774,62 @@
|
|||
tile.setAttribute('setpoint', sp_value);
|
||||
send_setpoint(id);
|
||||
}
|
||||
|
||||
/*
|
||||
function setTileValue(id, value) {
|
||||
var ext = '';
|
||||
var type;
|
||||
if (value == undefined || value.startsWith("-999") || value.startsWith(" "))
|
||||
value = '--';
|
||||
else {
|
||||
try {
|
||||
if ((type = document.getElementById(id).getAttribute('type')) != null) {
|
||||
if ((type = document.getElementById(id).getAttribute('type')) != null) {
|
||||
if (type == 'temperature' || type == 'setpoint_thermo' || type == 'setpoint_freeze')
|
||||
ext = '°';
|
||||
else if (type == 'setpoint_swg')
|
||||
ext = '%';
|
||||
|
||||
if ((type == 'temperature' || type == 'value') && turn_on_sensortiles == true) {
|
||||
if (value == 0 || value == '--')
|
||||
setTileOn(id, 'off');
|
||||
else
|
||||
setTileOn(id, 'on');
|
||||
}
|
||||
}
|
||||
} catch (e) {
|
||||
//console.log('ERROR id=' + id + ' Line 764 | element = '+document.getElementById(id));
|
||||
}
|
||||
}
|
||||
//document.getElementById(id + '_tile_icon_value').textContent = value;
|
||||
var tile;
|
||||
if ((tile = document.getElementById(id + '_tile_icon_value')) != null)
|
||||
tile.innerHTML = value + ext;
|
||||
}
|
||||
*/
|
||||
function setTileValue(id, value) {
|
||||
var ext = '';
|
||||
var type = null;
|
||||
try {
|
||||
type = document.getElementById(id).getAttribute('type');
|
||||
|
||||
if (value == undefined || value.startsWith("-999") || value.startsWith(" ")) {
|
||||
value = '--';
|
||||
} else {
|
||||
if ((type = document.getElementById(id).getAttribute('type')) != null) {
|
||||
if (type == 'temperature' || type == 'setpoint_thermo' || type == 'setpoint_freeze')
|
||||
ext = '°';
|
||||
else if (type == 'setpoint_swg')
|
||||
ext = '%';
|
||||
}
|
||||
} catch (e) {
|
||||
//console.log('ERROR id=' + id + ' Line 764 | element = '+document.getElementById(id));
|
||||
}
|
||||
|
||||
if ((type == 'temperature' || type == 'value') && turn_on_sensortiles == true) {
|
||||
if (value == 0 || value == '--')
|
||||
setTileOn(id, 'off');
|
||||
else
|
||||
setTileOn(id, 'on');
|
||||
}
|
||||
} catch (e) {
|
||||
console.log('ERROR id=' + id + ' Line 829 | element = '+document.getElementById(id));
|
||||
}
|
||||
//document.getElementById(id + '_tile_icon_value').textContent = value;
|
||||
var tile;
|
||||
|
@ -847,13 +889,14 @@
|
|||
}
|
||||
|
||||
function setTileOn(id, status) {
|
||||
//function setTileOn(id, status, text) {
|
||||
//console.log("setTileOn "+id+ " "+status);
|
||||
var tile;
|
||||
var text;
|
||||
if ((tile = document.getElementById(id)) == null) {
|
||||
//console.log("Error unknown ID '"+id+"' can't set to '"+status+"'");
|
||||
return;
|
||||
}
|
||||
// Display is a special status to "brighten up" sensor values.
|
||||
if (status != "on" && status != "off" && status != "enabled" && status != "flash") {
|
||||
console.log("Error unknown status '" + status + "' for '" + id + "'");
|
||||
return;
|
||||
|
@ -907,7 +950,10 @@
|
|||
}
|
||||
text = "Off";
|
||||
}
|
||||
document.getElementById(id + '_status').innerHTML = text;
|
||||
|
||||
try {
|
||||
document.getElementById(id + '_status').innerHTML = text;
|
||||
} catch (e) {}
|
||||
var tile_icon = document.getElementById(id + '_tile_icon_value');
|
||||
type = tile.getAttribute('type');
|
||||
if (status != null && tile_icon != null) {
|
||||
|
@ -921,7 +967,8 @@
|
|||
tile_icon.classList.add("disabled");
|
||||
tile_icon.classList.remove("cool");
|
||||
tile_icon.classList.remove("heat");
|
||||
} else if (status == 'on' && type != 'setpoint_swg' && type != 'setpoint_freeze') {
|
||||
//} else if (status == 'on' && type != 'setpoint_swg' && type != 'setpoint_freeze' && type != 'temperature' && type != 'value') {
|
||||
} else if (status == 'on' && type == 'setpoint_thermo') {
|
||||
tile_icon.classList.remove("enabled");
|
||||
tile_icon.classList.remove("disabled");
|
||||
tile_icon.classList.remove("cool");
|
||||
|
@ -1237,7 +1284,7 @@
|
|||
//console.log ("state = "+state);
|
||||
if (state == (tile.getAttribute('Boost') == 'off')) {
|
||||
//console.log ("change boost");
|
||||
send_command( 'SWG/Boost', (state==true?"on":"off") );
|
||||
send_command( 'SWG/Boost', (state==true?"1":"0") );
|
||||
} else {
|
||||
if (sp_value != slider.value && slider.value != 101) // Don't change setpoint if slider is on boost
|
||||
setThermostatSetpoint(id, slider.value);
|
||||
|
@ -1456,8 +1503,12 @@
|
|||
}
|
||||
|
||||
function get_devices() {
|
||||
/*
|
||||
var msg = {
|
||||
command: "GET_DEVICES"
|
||||
};*/
|
||||
var msg = {
|
||||
uri: "devices"
|
||||
};
|
||||
socket_di.send(JSON.stringify(msg));
|
||||
}
|
||||
|
@ -1465,31 +1516,41 @@
|
|||
function send_command(cmd, value=null) {
|
||||
var _cmd = {};
|
||||
_cmd.command = cmd;
|
||||
if (value != null)
|
||||
_cmd.value = value;
|
||||
_cmd.uri = cmd+"/set";
|
||||
if (value != null) {
|
||||
_cmd.value = value;
|
||||
}
|
||||
socket_di.send(JSON.stringify(_cmd));
|
||||
}
|
||||
|
||||
function send_setpoint(id) {
|
||||
var temperature = {};
|
||||
var message = {};
|
||||
var tile;
|
||||
if ((tile = document.getElementById(id)) == null) {
|
||||
return;
|
||||
}
|
||||
if (tile.getAttribute('setpoint'))
|
||||
temperature.parameter = tile.getAttribute('id');
|
||||
temperature.value = tile.getAttribute('setpoint');
|
||||
var type = tile.getAttribute('type');
|
||||
message.parameter = tile.getAttribute('id');
|
||||
message.value = tile.getAttribute('setpoint');
|
||||
|
||||
if (type == "setpoint_swg")
|
||||
message.uri = id+"/percent/set";
|
||||
else if (type == "switch_vsp")
|
||||
message.uri = id+"/RPM/set";
|
||||
else
|
||||
message.uri = id+"/setpoint/set";
|
||||
//console.log("Send value back "+temperature.parameter+" "+temperature.value);
|
||||
socket_di.send(JSON.stringify(temperature));
|
||||
socket_di.send(JSON.stringify(message));
|
||||
}
|
||||
|
||||
function send_light_mode(value, id, textvalue) {
|
||||
console.log("Set light mode to "+value+" id="+id+" text="+textvalue);
|
||||
var mode = {};
|
||||
//mode.parameter = 'POOL_LIGHT_MODE';
|
||||
mode.parameter = 'LIGHT_MODE';
|
||||
//mode.parameter = 'LIGHT_MODE';
|
||||
mode.value = value;
|
||||
mode.button = id;
|
||||
mode.uri = id+"/program/set";
|
||||
mode.text_value = textvalue;
|
||||
socket_di.send(JSON.stringify(mode));
|
||||
}
|
||||
|
|
|
@ -0,0 +1 @@
|
|||
switch-on.png
|
|
@ -0,0 +1 @@
|
|||
switch-off.png
|
|
@ -0,0 +1 @@
|
|||
switch-on.png
|
|
@ -0,0 +1 @@
|
|||
switch-off.png
|
|
@ -0,0 +1 @@
|
|||
switch-on.png
|
|
@ -0,0 +1 @@
|
|||
switch-off.png
|
|
@ -0,0 +1 @@
|
|||
switch-on.png
|
|
@ -0,0 +1 @@
|
|||
switch-off.png
|
|
@ -0,0 +1 @@
|
|||
switch-on.png
|
|
@ -0,0 +1 @@
|
|||
switch-off.png
|
|
@ -0,0 +1 @@
|
|||
switch-on.png
|
|
@ -0,0 +1 @@
|
|||
switch-off.png
|
|
@ -0,0 +1 @@
|
|||
switch-on.png
|
|
@ -0,0 +1 @@
|
|||
switch-off.png
|
|
@ -0,0 +1 @@
|
|||
switch-on.png
|
|
@ -0,0 +1 @@
|
|||
switch-off.png
|
|
@ -0,0 +1 @@
|
|||
switch-on.png
|
Loading…
Reference in New Issue