Skip to content

Commit

Permalink
2.4.1 (Dev 0.2)
Browse files Browse the repository at this point in the history
  • Loading branch information
sfeakes committed Sep 30, 2024
1 parent d447c13 commit 32f3d8b
Show file tree
Hide file tree
Showing 31 changed files with 802 additions and 190 deletions.
11 changes: 10 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,8 @@ CC_AMD64 = x86_64-linux-gnu-gcc
#LIBS := -lpthread -lm
#LIBS := -l pthread -l m
#LIBS := -l pthread -l m -static # Take out -static, just for dev
LIBS := -lpthread -lm
# from documentation -lrt would be needed for glibc 2.17 & prior (debug clock realtime messages), but seems to be needed for armhf 2.24
LIBS := -lpthread -lm -lrt

# Standard compile flags
GCCFLAGS = -Wall -O3
Expand Down Expand Up @@ -222,10 +223,18 @@ release:
sudo docker run -it --mount type=bind,source=./,target=/build aqualinkd-releasebin make buildrelease
$(info Binaries for release have been built)

quick:
sudo docker run -it --mount type=bind,source=./,target=/build aqualinkd-releasebin make quickbuild
$(info Binaries for release have been built)

# This is run inside container Dockerfile.releaseBinariies (aqualinkd-releasebin)
buildrelease: clean armhf arm64
$(shell cd release && ln -s ./aqualinkd-armhf ./aqualinkd && ln -s ./serial_logger-armhf ./serial_logger)

# This is run inside container Dockerfile.releaseBinariies (aqualinkd-releasebin)
quickbuild: armhf arm64
$(shell cd release && [ ! -f "./aqualinkd-armhf" ] && ln -s ./aqualinkd-armhf ./aqualinkd && ln -s ./serial_logger-armhf ./serial_logger)


# Rules to pass to make.
all: $(MAIN) $(SLOG)
Expand Down
19 changes: 18 additions & 1 deletion docker/Dockerfile.releaseBinaries
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,25 @@
# docker run -it --mount type=bind,source=./build,target=/build aqualinkd-releasebin bash
#
# clean method
# docker system prune
# docker system prune
#
# armhf =
# COLLECT_GCC=arm-linux-gnueabihf-gcc
# COLLECT_LTO_WRAPPER=/opt/cross-pi-gcc/libexec/gcc/arm-linux-gnueabihf/6.3.0/lto-wrapper
# Target: arm-linux-gnueabihf
# Configured with: ../gcc-6.3.0/configure --prefix=/opt/cross-pi-gcc --target=arm-linux-gnueabihf --enable-languages=c,c++,fortran --with-arch=armv6 --with-fpu=vfp --with-float=hard --disable-multilib --enable-linker-build-id
# Thread model: posix
# gcc version 6.3.0 (GCC)
# GLIBC version 2.24
#
# arm64 =
# COLLECT_GCC=aarch64-linux-gnu-gcc
# COLLECT_LTO_WRAPPER=/usr/lib/gcc-cross/aarch64-linux-gnu/8/lto-wrapper
# Target: aarch64-linux-gnu
# Configured with: ../src/configure -v --with-pkgversion='Debian 8.3.0-2' --with-bugurl=file:///usr/share/doc/gcc-8/README.Bugs --enable-languages=c,ada,c++,go,d,fortran,objc,obj-c++ --prefix=/usr --with-gcc-major-version-only --program-suffix=-8 --enable-shared --enable-linker-build-id --libexecdir=/usr/lib --without-included-gettext --enable-threads=posix --libdir=/usr/lib --enable-nls --with-sysroot=/ --enable-clocale=gnu --enable-libstdcxx-debug --enable-libstdcxx-time=yes --with-default-libstdcxx-abi=new --enable-gnu-unique-object --disable-libquadmath --disable-libquadmath-support --enable-plugin --enable-default-pie --with-system-zlib --disable-libphobos --enable-multiarch --enable-fix-cortex-a53-843419 --disable-werror --enable-checking=release --build=x86_64-linux-gnu --host=x86_64-linux-gnu --target=aarch64-linux-gnu --program-prefix=aarch64-linux-gnu- --includedir=/usr/aarch64-linux-gnu/include
# Thread model: posix
# gcc version 8.3.0 (Debian 8.3.0-2)
# GLIBC 2.28-10+deb10u3
#####################################

FROM debian:buster
Expand Down
Binary file modified release/aqualinkd-amd64
Binary file not shown.
Binary file modified release/aqualinkd-arm64
Binary file not shown.
Binary file modified release/aqualinkd-armhf
Binary file not shown.
Binary file modified release/serial_logger-amd64
Binary file not shown.
Binary file modified release/serial_logger-arm64
Binary file not shown.
Binary file modified release/serial_logger-armhf
Binary file not shown.
52 changes: 40 additions & 12 deletions source/aq_panel.c
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@
#include "aq_timer.h"
#include "allbutton_aq_programmer.h"
#include "rs_msg_utils.h"
#include "iaqualink.h"

void initPanelButtons(struct aqualinkdata *aqdata, bool rspda, int size, bool combo, bool dual);
void programDeviceLightMode(struct aqualinkdata *aqdata, int value, int button);
Expand Down Expand Up @@ -351,8 +352,19 @@ aqkey *addVirtualButton(struct aqualinkdata *aqdata, char *label, int vindex) {
if (strlen(label) <= 0) {
button->label = name;
} else {
button->label = label;
button->label = label;
}
// These 3 vbuttons have a button code on iaqualink protocol, so use that for rssd_code.
if (strncasecmp (button->label, "ALL OFF", 7) == 0) {
button->rssd_code = IAQ_ALL_OFF;
} else if (strncasecmp (button->label, "Spa Mode", 8) == 0) {
button->rssd_code = IAQ_SPA_MODE;
} else if (strncasecmp (button->label, "Clean Mode", 10) == 0) {
button->rssd_code = IAQ_CLEAN_MODE;
} else {
button->rssd_code = NUL;
}

button->code = NUL;
button->dz_idx = DZ_NULL_IDX;
button->special_mask |= VIRTUAL_BUTTON; // Could change to special mask vbutton
Expand Down Expand Up @@ -614,6 +626,7 @@ void initPanelButtons(struct aqualinkdata *aqdata, bool rs, int size, bool combo
aqdata->aqbuttons[index].code = KEY_POOL_HTR;
aqdata->aqbuttons[index].dz_idx = DZ_NULL_IDX;
aqdata->aqbuttons[index].special_mask = 0;
aqdata->aqbuttons[index].rssd_code = RS_SA_POOLHT;
index++;

aqdata->aqbuttons[index].led = &aqdata->aqualinkleds[17-1];
Expand All @@ -623,6 +636,7 @@ void initPanelButtons(struct aqualinkdata *aqdata, bool rs, int size, bool combo
aqdata->aqbuttons[index].code = KEY_SPA_HTR;
aqdata->aqbuttons[index].dz_idx = DZ_NULL_IDX;
aqdata->aqbuttons[index].special_mask = 0;
aqdata->aqbuttons[index].rssd_code = RS_SA_SPAHT;
index++;

aqdata->aqbuttons[index].led = &aqdata->aqualinkleds[19-1];
Expand Down Expand Up @@ -743,7 +757,8 @@ bool setDeviceState(struct aqualinkdata *aqdata, int deviceIndex, bool isON, req
{
aqkey *button = &aqdata->aqbuttons[deviceIndex];

if (button->special_mask & VIRTUAL_BUTTON && button->special_mask & VS_PUMP) {
//if ( button->special_mask & VIRTUAL_BUTTON && button->special_mask & VS_PUMP) {
if ( isVS_PUMP(button->special_mask) && isVBUTTON(button->special_mask)) {
// Virtual Button with VSP is always on.
LOG(PANL_LOG, LOG_INFO, "received '%s' for '%s', virtual pump is always on, ignoring", (isON == false ? "OFF" : "ON"), button->name);
button->led->state = ON;
Expand All @@ -763,9 +778,14 @@ bool setDeviceState(struct aqualinkdata *aqdata, int deviceIndex, bool isON, req
// AqualinkTouch in PDA mode, we can program light. (if turing off, use standard AQ_PDA_DEVICE_ON_OFF below)
programDeviceLightMode(aqdata, (isON?0:-1), deviceIndex); // -1 means off 0 means use current light mode
} else {
char msg[PTHREAD_ARG];
sprintf(msg, "%-5d%-5d", deviceIndex, (isON == false ? OFF : ON));
aq_programmer(AQ_PDA_DEVICE_ON_OFF, msg, aqdata);
// If we are using AqualinkTouch with iAqualink enabled, we can send button on/off much faster using that.
if ( isPDA_IAQT && isIAQL_ACTIVE) {
set_iaqualink_aux_state(button, isON);
} else {
char msg[PTHREAD_ARG];
sprintf(msg, "%-5d%-5d", deviceIndex, (isON == false ? OFF : ON));
aq_programmer(AQ_PDA_DEVICE_ON_OFF, msg, aqdata);
}
}
} else
#endif
Expand All @@ -776,28 +796,36 @@ bool setDeviceState(struct aqualinkdata *aqdata, int deviceIndex, bool isON, req
// OK Programable light, and no light mode selected. Now let's work out best way to turn it on. serial_adapter protocol will to it without questions,
// all other will require programmig.
if (isRSSA_ENABLED) {
set_aqualink_rssadapter_aux_state(deviceIndex, true);
set_aqualink_rssadapter_aux_state(button, true);
} else {
//set_light_mode("0", deviceIndex); // 0 means use current light mode
programDeviceLightMode(aqdata, 0, deviceIndex); // 0 means use current light mode
}
} else if (button->special_mask & VIRTUAL_BUTTON) {
} else if (isVBUTTON(button->special_mask)) {
// Virtual buttons only supported with Aqualink Touch
LOG(PANL_LOG, LOG_NOTICE, "********** %s code=0x%02hhx iaq enabled=%s *****\n",button->name, button->rssd_code, isIAQT_ENABLED?"Yes":"No");
if (isIAQT_ENABLED) {
char msg[PTHREAD_ARG];
sprintf(msg, "%-5d%-5d", deviceIndex, (isON == false ? OFF : ON));
aq_programmer(AQ_SET_IAQTOUCH_DEVICE_ON_OFF, msg, aqdata);
// If it's one of the pre-defined onces & iaqualink is enabled, we can set it easile with button.
if ( isIAQL_ACTIVE && button->rssd_code != NUL)
{
set_iaqualink_aux_state(button, isON);
} else {
char msg[PTHREAD_ARG];
sprintf(msg, "%-5d%-5d", deviceIndex, (isON == false ? OFF : ON));
aq_programmer(AQ_SET_IAQTOUCH_DEVICE_ON_OFF, msg, aqdata);
}
} else {
LOG(PANL_LOG, LOG_ERR, "Can only use Aqualink Touch protocol for Virtual Buttons");
}
} else if ( source == NET_DZMQTT && isRSSA_ENABLED ) {
// Domoticz has a bad habbit of resending the same state back to us, when we use the PRESTATE_ONOFF option
// since allbutton (default) is stateless, and rssaadapter is statefull, use rssaadapter for any domoricz requests
set_aqualink_rssadapter_aux_state(deviceIndex, isON);
set_aqualink_rssadapter_aux_state(button, isON);
} else if (button->special_mask & PROGRAM_LIGHT && isRSSA_ENABLED) {
// If off and program light, use the RS serial adapter since that is overiding the state now.
set_aqualink_rssadapter_aux_state(deviceIndex, isON);
set_aqualink_rssadapter_aux_state(button, isON);
} else {
//set_iaqualink_aux_state(button, isON);
aq_send_allb_cmd(button->code);
}

Expand Down
7 changes: 7 additions & 0 deletions source/aq_panel.h
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,13 @@ aqkey *addVirtualButton(struct aqualinkdata *aqdata, char *label, int vindex);
#define isIAQT_ENABLED ((_aqconfig_.paneltype_mask & RSP_IAQT) == RSP_IAQT)
#define isRSSA_ENABLED ((_aqconfig_.paneltype_mask & RSP_RSSA) == RSP_RSSA)
#define isEXTP_ENABLED ((_aqconfig_.paneltype_mask & RSP_EXT_PROG) == RSP_EXT_PROG)

#define isIAQL_ACTIVE ((_aqconfig_.extended_device_id2 != NUL))

#define isVS_PUMP(mask) ((mask & VS_PUMP) == VS_PUMP)
#define isVBUTTON(mask) ((mask & VIRTUAL_BUTTON) == VIRTUAL_BUTTON)
#define isPLIGHT(mask) ((mask & PROGRAM_LIGHT) == PROGRAM_LIGHT)

int PANEL_SIZE();
//
//#define PANEL_SIZE PANEL_SIZE()
Expand Down
60 changes: 42 additions & 18 deletions source/aq_programmer.c
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@
#include "color_lights.h"
#include "config.h"
#include "devices_jandy.h"
#include "iaqualink.h"

#ifdef AQ_DEBUG
#include <time.h>
Expand Down Expand Up @@ -585,8 +586,16 @@ void _aq_programmer(program_type r_type, char *args, struct aqualinkdata *aq_dat
return;
}
pda_reset_sleep();
} else if (isPDA_PANEL && isPDA_IAQT)
}
else if (isPDA_PANEL && isPDA_IAQT)
{
if (isIAQL_ACTIVE) { // if we have iAqualink and AqualinkTouch active on PDA, use iAqualink for setpoints.
if (r_type == AQ_SET_POOL_HEATER_TEMP) {
type = AQ_SET_IAQLINK_POOL_HEATER_TEMP;
} else if (r_type == AQ_SET_SPA_HEATER_TEMP) {
type = AQ_SET_IAQLINK_SPA_HEATER_TEMP;
}
}
if ( get_programming_mode(type) != IAQTOUCH) {
LOG(PROG_LOG, LOG_ERR, "Selected Programming mode '%s' '%d' not supported with PDA control panel in iAqualinkTouch mode\n",ptypeName(type),type);
return;
Expand Down Expand Up @@ -629,6 +638,14 @@ void _aq_programmer(program_type r_type, char *args, struct aqualinkdata *aq_dat
increase_aqualink_rssadapter_spa_setpoint(args, aq_data);
return; // No need to create this as thread.
break;
case AQ_SET_IAQLINK_POOL_HEATER_TEMP:
set_iaqualink_heater_setpoint(atoi(args), true);
return; // No need to create this as thread.
break;
case AQ_SET_IAQLINK_SPA_HEATER_TEMP:
set_iaqualink_heater_setpoint(atoi(args), false);
return; // No need to create this as thread.
break;
default:
// Should check that _prog_functions[type] is valid.
if( pthread_create( &programmingthread->thread_id , NULL , _prog_functions[type], (void*)programmingthread) < 0) {
Expand Down Expand Up @@ -821,43 +838,50 @@ const char *ptypeName(program_type type)
#endif
#ifdef AQ_IAQTOUCH
case AQ_SET_IAQTOUCH_PUMP_VS_PROGRAM:
return "Set iAqualink Touch Pump VS Program";
return "Set AqualinkTouch Touch Pump VS Program";
break;
case AQ_SET_IAQTOUCH_PUMP_RPM:
return "Set iAqualink Touch Pump RPM";
return "Set AqualinkTouch Touch Pump RPM";
break;
case AQ_GET_IAQTOUCH_VSP_ASSIGNMENT:
return "Get iAqualink Touch Pump Assignment";
return "Get AqualinkTouch Touch Pump Assignment";
break;
case AQ_GET_IAQTOUCH_SETPOINTS:
return "Get iAqualink Touch Setpoints";
return "Get AqualinkTouch Touch Setpoints";
break;
case AQ_GET_IAQTOUCH_FREEZEPROTECT:
return "Get iAqualink Touch Freezeprotect";
return "Get AqualinkTouch Touch Freezeprotect";
break;
case AQ_GET_IAQTOUCH_AUX_LABELS:
return "Get iAqualink AUX Labels";
return "Get AqualinkTouch AUX Labels";
break;
case AQ_SET_IAQTOUCH_SWG_PERCENT:
return "Set iAqualink SWG Percent";
break;
case AQ_SET_IAQTOUCH_SWG_BOOST:
return "Set iAqualink Boost";
break;
case AQ_SET_IAQTOUCH_SPA_HEATER_TEMP:
return "Set iAqualink Spa Heater";
return "Set AqualinkTouch SWG Percent";
break;
case AQ_SET_IAQTOUCH_POOL_HEATER_TEMP:
return "Set iAqualink Pool Heater";
return "Set AqualinkTouch Pool Heater";
break;
case AQ_SET_IAQTOUCH_SET_TIME:
return "Set iAqualink Set Time";
return "Set AqualinkTouch Set Time";
break;
case AQ_SET_IAQTOUCH_DEVICE_ON_OFF:
return "Set iAqualink Device On/Off";
return "Set AqualinkTouch Device On/Off";
break;
case AQ_SET_IAQTOUCH_LIGHTCOLOR_MODE:
return "Set iAqualink Light Color (using panel)";
return "Set AqualinkTouch Light Color (using panel)";
break;
case AQ_SET_IAQTOUCH_SWG_BOOST:
return "Set AqualinkTouch Boost";
break;
case AQ_SET_IAQTOUCH_SPA_HEATER_TEMP:
return "Set AqualinkTouch Spa Heater";
break;
// These to same as above, but on the iAqualink protocol, not AqualinkTouch protocol
case AQ_SET_IAQLINK_POOL_HEATER_TEMP:
return "Set iAqualink Pool Heater";
break;
case AQ_SET_IAQLINK_SPA_HEATER_TEMP:
return "Set iAqualink Pool Heater";
break;
#endif
#ifdef AQ_PDA
Expand Down
6 changes: 4 additions & 2 deletions source/aq_programmer.h
Original file line number Diff line number Diff line change
Expand Up @@ -94,10 +94,12 @@ typedef enum {
AQ_GET_IAQTOUCH_AUX_LABELS,
AQ_SET_IAQTOUCH_SWG_PERCENT,
AQ_SET_IAQTOUCH_SWG_BOOST,
AQ_SET_IAQTOUCH_POOL_HEATER_TEMP,
AQ_SET_IAQTOUCH_SPA_HEATER_TEMP,
AQ_SET_IAQTOUCH_SET_TIME,
AQ_SET_IAQTOUCH_DEVICE_ON_OFF,
AQ_SET_IAQTOUCH_POOL_HEATER_TEMP,
AQ_SET_IAQTOUCH_SPA_HEATER_TEMP,
AQ_SET_IAQLINK_POOL_HEATER_TEMP, // Same as above but using iAqualink not AqualinkTouch
AQ_SET_IAQLINK_SPA_HEATER_TEMP, // Same as above but using iAqualink not AqualinkTouch
AQ_SET_IAQTOUCH_LIGHTCOLOR_MODE,
// ******** RS Serial Adapter Delimiter make sure to change MAX/MIN below
AQ_GET_RSSADAPTER_SETPOINTS,
Expand Down
Loading

0 comments on commit 32f3d8b

Please sign in to comment.