Skip to content

Commit

Permalink
Merge branch 'master' into dev/iaqt_page_button_name
Browse files Browse the repository at this point in the history
  • Loading branch information
sfeakes authored Jun 11, 2024
2 parents 2af8f55 + b85f3b5 commit 2f7c001
Show file tree
Hide file tree
Showing 37 changed files with 4,446 additions and 523 deletions.
44 changes: 40 additions & 4 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -146,8 +146,10 @@ SL_OBJ_DIR := $(OBJ_DIR)/slog

OBJ_DIR_ARMHF := $(OBJ_DIR)/armhf
OBJ_DIR_ARM64 := $(OBJ_DIR)/arm64
OBJ_DIR_AMD64 := $(OBJ_DIR)/amd64
SL_OBJ_DIR_ARMHF := $(OBJ_DIR_ARMHF)/slog
SL_OBJ_DIR_ARM64 := $(OBJ_DIR_ARM64)/slog
SL_OBJ_DIR_AMD64 := $(OBJ_DIR_AMD64)/slog

# Object files
OBJ_FILES := $(patsubst %.c,$(OBJ_DIR)/%.o,$(SRCS))
Expand All @@ -156,8 +158,11 @@ SL_OBJ_FILES := $(patsubst %.c,$(SL_OBJ_DIR)/%.o,$(SL_SRC))

OBJ_FILES_ARMHF := $(patsubst %.c,$(OBJ_DIR_ARMHF)/%.o,$(SRCS))
OBJ_FILES_ARM64 := $(patsubst %.c,$(OBJ_DIR_ARM64)/%.o,$(SRCS))
OBJ_FILES_AMD64 := $(patsubst %.c,$(OBJ_DIR_AMD64)/%.o,$(SRCS))

SL_OBJ_FILES_ARMHF := $(patsubst %.c,$(SL_OBJ_DIR_ARMHF)/%.o,$(SL_SRC))
SL_OBJ_FILES_ARM64 := $(patsubst %.c,$(SL_OBJ_DIR_ARM64)/%.o,$(SL_SRC))
SL_OBJ_FILES_AMD64 := $(patsubst %.c,$(SL_OBJ_DIR_AMD64)/%.o,$(SL_SRC))
#MG_OBJ_FILES := $(patsubst %.c,$(OBJ_DIR)/%.o,$(MG_SRC))

# define the executable file
Expand All @@ -167,21 +172,30 @@ DEBG = ./release/aqualinkd-debug

MAIN_ARM64 = ./release/aqualinkd-arm64
MAIN_ARMHF = ./release/aqualinkd-armhf
MAIN_AMD64 = ./release/aqualinkd-amd64

SLOG_ARM64 = ./release/serial_logger-arm64
SLOG_ARMHF = ./release/serial_logger-armhf
SLOG_AMD64 = ./release/serial_logger-amd64

#LOGR = ./release/log_reader
#PLAY = ./release/aqualinkd-player


# Rules with no targets
.PHONY: clean clean-buildfiles buildrelease release install

# Default target
.DEFAULT_GOAL := all

# Before the below works, you need to build the aqualinkd-releasebin docker for compiling.
# sudo docker build -f Dockerfile.releaseBinaries -t aqualinkd-releasebin .
release:
sudo docker run -it --mount type=bind,source=./,target=/build aqualinkd-releasebin make buildrelease
$(info Binaries for release have been built)

# This is run inside container Dockerfile.releaseBinariies
buildrelease: clean armhf arm64
# 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)


Expand Down Expand Up @@ -220,6 +234,12 @@ arm64: $(MAIN_ARM64) $(SLOG_ARM64)
$(info $(MAIN_ARM64) has been compiled)
$(info $(SLOG_ARM64) has been compiled)

# amd64
amd64: CC := $(CC_AMD64)
amd64: $(MAIN_AMD64) $(SLOG_AMD64)
$(info $(MAIN_AMD64) has been compiled)
$(info $(SLOG_AMD64) has been compiled)

#debug, Just change compile flags and call MAIN
debug: CFLAGS = $(DFLAGS)
debug: $(MAIN) $(SLOG)
Expand Down Expand Up @@ -253,6 +273,11 @@ $(OBJ_DIR_ARM64)/%.o: %.c | $(OBJ_DIR_ARM64)
$(SL_OBJ_DIR_ARM64)/%.o: %.c | $(SL_OBJ_DIR_ARM64)
$(CC) $(CFLAGS) $(INCLUDES) -c -o $@ $<

$(OBJ_DIR_AMD64)/%.o: %.c | $(OBJ_DIR_AMD64)
$(CC) $(CFLAGS) $(INCLUDES) -c -o $@ $<

$(SL_OBJ_DIR_AMD64)/%.o: %.c | $(SL_OBJ_DIR_AMD64)
$(CC) $(CFLAGS) $(INCLUDES) -c -o $@ $<

# Rules to link
$(MAIN): $(OBJ_FILES)
Expand All @@ -262,6 +287,9 @@ $(MAIN_ARM64): $(OBJ_FILES_ARM64)
$(CC) $(CFLAGS) $(INCLUDES) -o $@ $^ $(LIBS)

$(MAIN_ARMHF): $(OBJ_FILES_ARMHF)
$(CC) $(CFLAGS) $(INCLUDES) -o $@ $^ $(LIBS)

$(MAIN_AMD64): $(OBJ_FILES_AMD64)
$(CC) $(CFLAGS) $(INCLUDES) -o $@ $^ $(LIBS)

$(DEBG): $(DBG_OBJ_FILES)
Expand All @@ -279,6 +307,9 @@ $(SLOG_ARM64): CFLAGS := $(CFLAGS) -D SERIAL_LOGGER
$(SLOG_ARM64): $(SL_OBJ_FILES_ARM64)
$(CC) $(CFLAGS) $(INCLUDES) -o $@ $^ $(LIBS)

$(SLOG_AMD64): CFLAGS := $(CFLAGS) -D SERIAL_LOGGER
$(SLOG_AMD64): $(SL_OBJ_FILES_AMD64)
$(CC) $(CFLAGS) $(INCLUDES) -o $@ $^ $(LIBS)

# Rules to make object directories.
$(OBJ_DIR):
Expand All @@ -302,14 +333,19 @@ $(OBJ_DIR_ARM64):
$(SL_OBJ_DIR_ARM64):
$(MKDIR) $(call FixPath,$@)

$(OBJ_DIR_AMD64):
$(MKDIR) $(call FixPath,$@)

$(SL_OBJ_DIR_AMD64):
$(MKDIR) $(call FixPath,$@)

# Clean rules

clean: clean-buildfiles
$(RM) *.o *~ $(MAIN) $(MAIN_U) $(PLAY) $(PL_EXOBJ) $(DEBG)
$(RM) $(wildcard *.o) $(wildcard *~) $(MAIN) $(MAIN_ARM64) $(MAIN_ARMHF) $(SLOG) $(SLOG_ARM64) $(SLOG_ARMHF) $(MAIN_U) $(PLAY) $(PL_EXOBJ) $(LOGR) $(PLAY) $(DEBG)
$(RM) $(wildcard *.o) $(wildcard *~) $(MAIN) $(MAIN_ARM64) $(MAIN_ARMHF) $(MAIN_AMD64) $(SLOG) $(SLOG_ARM64) $(SLOG_ARMHF) $(SLOG_AMD64) $(MAIN_U) $(PLAY) $(PL_EXOBJ) $(LOGR) $(PLAY) $(DEBG)

clean-buildfiles:
$(RM) $(wildcard *.o) $(wildcard *~) $(OBJ_FILES) $(DBG_OBJ_FILES) $(SL_OBJ_FILES) $(OBJ_FILES_ARMHF) $(OBJ_FILES_ARM64) $(SL_OBJ_FILES_ARMHF) $(SL_OBJ_FILES_ARM64)
$(RM) $(wildcard *.o) $(wildcard *~) $(OBJ_FILES) $(DBG_OBJ_FILES) $(SL_OBJ_FILES) $(OBJ_FILES_ARMHF) $(OBJ_FILES_ARM64) $(OBJ_FILES_AMD64) $(SL_OBJ_FILES_ARMHF) $(SL_OBJ_FILES_ARM64) $(SL_OBJ_FILES_AMD64)


10 changes: 10 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -110,6 +110,16 @@ Designed to mimic AqualinkRS devices, used to fully configure the master control
# Call for Help.
* The only Jandy devices I have not decoded yet are LX heater & Chemical Feeder. If you have either of these devices and are willing to post some logs, please let me know, or post in the [Discussions area](https://github.com/sfeakes/AqualinkD/discussions)

# (Comming) Updates in Release 2.3.7
* Fix for Pentair VSP losing connection & bouncing SWG to 0 and back.
* Added more VSP data (Mode, Status, Pressure Curve, both RPM & GPM) for all Pentair Pumps (VS/VF/VSF).
* Few updates to HomeAssistant integration.
* Updates to serial_logger.
* Few updates to UI.
* Will display both RPM & GPM for VSP (space providing)
* Fix freeze protect button in UI not showing enabled.
* Few updates to AQmanager UI.

# Update in Release 2.3.6
* No functionality changes
* Build & Docker changes
Expand Down
3 changes: 3 additions & 0 deletions aq_mqtt.h
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,9 @@
#define PUMP_RPM_TOPIC "/RPM"
#define PUMP_GPM_TOPIC "/GPM"
#define PUMP_WATTS_TOPIC "/Watts"
#define PUMP_MODE_TOPIC "/Mode"
#define PUMP_STATUS_TOPIC "/Status"
#define PUMP_PPC_TOPIC "/PPC"
/*
#define AIR_TEMPERATURE "Air"
#define POOL_TEMPERATURE "Pool_Water"
Expand Down
117 changes: 99 additions & 18 deletions aq_panel.c
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ void changePanelToMode_Only() {

void changePanelToExtendedIDProgramming() {
_aqconfig_.paneltype_mask |= RSP_EXT_PROG;
LOG(AQUA_LOG,LOG_NOTICE, "AqualinkD is using use %s mode for programming (where supported)\n",isONET_ENABLED?"ONETOUCH":"IAQ TOUCH");
LOG(PANL_LOG,LOG_NOTICE, "AqualinkD is using use %s mode for programming (where supported)\n",isONET_ENABLED?"ONETOUCH":"IAQ TOUCH");
}

void addPanelRSserialAdapterInterface() {
Expand Down Expand Up @@ -83,7 +83,7 @@ int PANEL_SIZE() {
else if ((_aqconfig_.paneltype_mask & RSP_16) == RSP_16)
return 16;

LOG(AQUA_LOG,LOG_ERR, "Internal error, panel size not set, using 8\n");
LOG(PANL_LOG,LOG_ERR, "Internal error, panel size not set, using 8\n");
return 8;
}
//bool setPanel(const char *str);
Expand Down Expand Up @@ -133,7 +133,7 @@ int setSizeMask(int size)
int rtn_size = 0;

if ( size > TOTAL_BUTTONS) {
LOG(AQUA_LOG,LOG_ERR, "Panel size is either invalid or too large for compiled parameters, ignoring %d using %d\n",size, TOTAL_BUTTONS);
LOG(PANL_LOG,LOG_ERR, "Panel size is either invalid or too large for compiled parameters, ignoring %d using %d\n",size, TOTAL_BUTTONS);
rtn_size = TOTAL_BUTTONS;
}

Expand All @@ -160,7 +160,7 @@ int setSizeMask(int size)
_aqconfig_.paneltype_mask |= RSP_16;
break;
default:
LOG(AQUA_LOG,LOG_ERR, "Didn't understand panel size, '%d' setting to size to 8\n",size);
LOG(PANL_LOG,LOG_ERR, "Didn't understand panel size, '%d' setting to size to 8\n",size);
_aqconfig_.paneltype_mask |= RSP_8;
rtn_size = 8;
break;
Expand All @@ -176,7 +176,7 @@ void setPanel(struct aqualinkdata *aqdata, bool rs, int size, bool combo, bool d
{
#ifndef AQ_PDA
if (!rs) {
LOG(AQUA_LOG,LOG_ERR, "Can't use PDA mode, AqualinkD has not been compiled with PDA Enabled\n");
LOG(PANL_LOG,LOG_ERR, "Can't use PDA mode, AqualinkD has not been compiled with PDA Enabled\n");
rs = true;
}
#endif
Expand Down Expand Up @@ -228,7 +228,7 @@ void setPanelByName(struct aqualinkdata *aqdata, const char *str)
else // Account for PDA-8
size = atoi(&str[4]);
} else {
LOG(AQUA_LOG,LOG_ERR, "Didn't understand panel type, '%.2s' from '%s' setting to size to RS-8\n",str,str);
LOG(PANL_LOG,LOG_ERR, "Didn't understand panel type, '%.2s' from '%s' setting to size to RS-8\n",str,str);
rs = true;
size = 8;
}
Expand All @@ -245,7 +245,7 @@ void setPanelByName(struct aqualinkdata *aqdata, const char *str)
} else if (str[i+1] == 'D' || str[i+1] == 'd') {
dual = true;
} else {
LOG(AQUA_LOG,LOG_ERR, "Didn't understand panel type, '%s' from '%s' setting to Combo\n",&str[i+1],str);
LOG(PANL_LOG,LOG_ERR, "Didn't understand panel type, '%s' from '%s' setting to Combo\n",&str[i+1],str);
combo = true;
}

Expand Down Expand Up @@ -503,9 +503,84 @@ void initPanelButtons(struct aqualinkdata *aqdata, bool rs, int size, bool combo
#endif
}

const char* getRequestName(request_source source)
{
switch(source) {
case NET_MQTT:
return "MQTT";
break;
case NET_API:
return "API";
break;
case NET_WS:
return "WebSocket";
break;
case NET_DZMQTT:
return "Domoticz";
break;
case NET_TIMER:
return "Timer";
break;
}

static char buf[25];
sprintf(buf, "Unknown %d", source);
return buf;
}
const char* getActionName(action_type type)
{


switch (type) {
case ON_OFF:
return "OnOff";
break;
case NO_ACTION:
return "No Action";
break;
case POOL_HTR_SETOINT:
return "Pool Heater Setpoint";
break;
case SPA_HTR_SETOINT:
return "Spa Heater Setpoint";
break;
case FREEZE_SETPOINT:
return "Freeze Protect Setpoint";
break;
case SWG_SETPOINT:
return "SWG Percent";
break;
case SWG_BOOST:
return "SWG Boost";
break;
case PUMP_RPM:
return "VSP RPM/GPM";
break;
case PUMP_VSPROGRAM:
return "VSP Program";
break;
case POOL_HTR_INCREMENT:
return "Pool Heater Increment";
break;
case SPA_HTR_INCREMENT:
return "Spa Heater Increment";
break;
case TIMER:
return "Timer";
break;
case LIGHT_MODE:
return "Light Mode";
break;
case DATE_TIME:
return "Date Time";
break;
}

static char buf[25];
sprintf(buf, "Unknown %d", type);
return buf;
}

//void create_PDA_on_off_request(aqkey *button, bool isON);
//bool create_panel_request(struct aqualinkdata *aqdata, netRequest requester, int buttonIndex, int value, bool timer);
//void create_program_request(struct aqualinkdata *aqdata, netRequest requester, action_type type, int value, int id); // id is only valid for PUMP RPM
Expand All @@ -519,10 +594,10 @@ bool setDeviceState(struct aqualinkdata *aqdata, int deviceIndex, bool isON)
if ((button->led->state == OFF && isON == false) ||
(isON > 0 && (button->led->state == ON || button->led->state == FLASH ||
button->led->state == ENABLE))) {
LOG(AQUA_LOG, LOG_INFO, "received '%s' for '%s', already '%s', Ignoring\n", (isON == false ? "OFF" : "ON"), button->name, (isON == false ? "OFF" : "ON"));
LOG(PANL_LOG, LOG_INFO, "received '%s' for '%s', already '%s', Ignoring\n", (isON == false ? "OFF" : "ON"), button->name, (isON == false ? "OFF" : "ON"));
//return false;
} else {
LOG(AQUA_LOG, LOG_INFO, "received '%s' for '%s', turning '%s'\n", (isON == false ? "OFF" : "ON"), button->name, (isON == false ? "OFF" : "ON"));
LOG(PANL_LOG, LOG_INFO, "received '%s' for '%s', turning '%s'\n", (isON == false ? "OFF" : "ON"), button->name, (isON == false ? "OFF" : "ON"));
#ifdef AQ_PDA
if (isPDA_PANEL) {
if (button->special_mask & PROGRAM_LIGHT && isPDA_IAQT) {
Expand Down Expand Up @@ -570,16 +645,16 @@ bool setDeviceState(struct aqualinkdata *aqdata, int deviceIndex, bool isON)
bool programDeviceValue(struct aqualinkdata *aqdata, action_type type, int value, int id, bool expectMultiple) // id is only valid for PUMP RPM
{
if (aqdata->unactioned.type != NO_ACTION && type != aqdata->unactioned.type)
LOG(AQUA_LOG,LOG_ERR, "about to overwrite unactioned panel program\n");
LOG(PANL_LOG,LOG_ERR, "about to overwrite unactioned panel program\n");

if (type == POOL_HTR_SETOINT || type == SPA_HTR_SETOINT || type == FREEZE_SETPOINT || type == SWG_SETPOINT ) {
aqdata->unactioned.value = setpoint_check(type, value, aqdata);
if (value != aqdata->unactioned.value)
LOG(AQUA_LOG,LOG_NOTICE, "requested setpoint value %d is invalid, change to %d\n", value, aqdata->unactioned.value);
LOG(PANL_LOG,LOG_NOTICE, "requested setpoint value %d is invalid, change to %d\n", value, aqdata->unactioned.value);
} else if (type == PUMP_RPM) {
aqdata->unactioned.value = value;
} else if (type == PUMP_VSPROGRAM) {
LOG(AQUA_LOG,LOG_ERR, "requested Pump vsp program is not implimented yet\n", value, aqdata->unactioned.value);
LOG(PANL_LOG,LOG_ERR, "requested Pump vsp program is not implimented yet\n", value, aqdata->unactioned.value);
} else {
// SWG_BOOST & PUMP_RPM & SETPOINT incrment
aqdata->unactioned.value = value;
Expand All @@ -604,7 +679,7 @@ void programDeviceLightMode(struct aqualinkdata *aqdata, int value, int button)
clight_detail *light = NULL;
#ifdef AQ_PDA
if (isPDA_PANEL && !isPDA_IAQT) {
LOG(AQUA_LOG,LOG_ERR, "Light mode control not supported in PDA mode\n");
LOG(PANL_LOG,LOG_ERR, "Light mode control not supported in PDA mode\n");
return;
}
#endif
Expand All @@ -617,7 +692,7 @@ void programDeviceLightMode(struct aqualinkdata *aqdata, int value, int button)
}

if (light == NULL) {
LOG(AQUA_LOG,LOG_ERR, "Light mode control not configured for button %d\n",button);
LOG(PANL_LOG,LOG_ERR, "Light mode control not configured for button %d\n",button);
return;
}

Expand Down Expand Up @@ -647,20 +722,26 @@ void programDeviceLightMode(struct aqualinkdata *aqdata, int value, int button)
//bool panel_device_request(struct aqualinkdata *aqdata, action_type type, int deviceIndex, int value, int subIndex, bool fromMQTT)
bool panel_device_request(struct aqualinkdata *aqdata, action_type type, int deviceIndex, int value, request_source source)
{
LOG(AQUA_LOG,LOG_INFO, "Device request type %d for deviceindex %d of value %d from %d\n",type,deviceIndex, value, source);
LOG(PANL_LOG,LOG_INFO, "Device request type '%s' for deviceindex %d '%s' of value %d from '%s'\n",
getActionName(type),
deviceIndex,aqdata->aqbuttons[deviceIndex].label,
value,
getRequestName(source));
switch (type) {
case ON_OFF:
//setDeviceState(&aqdata->aqbuttons[deviceIndex], value<=0?false:true, deviceIndex );
setDeviceState(aqdata, deviceIndex, value<=0?false:true );
// Clear timer if off request and timer is active
if (value<=0 && (aqdata->aqbuttons[deviceIndex].special_mask & TIMER_ACTIVE) == TIMER_ACTIVE ) {
clear_timer(aqdata, &aqdata->aqbuttons[deviceIndex]);
//clear_timer(aqdata, &aqdata->aqbuttons[deviceIndex]);
clear_timer(aqdata, deviceIndex);
}
break;
case TIMER:
//setDeviceState(&aqdata->aqbuttons[deviceIndex], true);
setDeviceState(aqdata, deviceIndex, true);
start_timer(aqdata, &aqdata->aqbuttons[deviceIndex], value);
//start_timer(aqdata, &aqdata->aqbuttons[deviceIndex], deviceIndex, value);
start_timer(aqdata, deviceIndex, value);
break;
case LIGHT_MODE:
programDeviceLightMode(aqdata, value, deviceIndex);
Expand All @@ -680,7 +761,7 @@ bool panel_device_request(struct aqualinkdata *aqdata, action_type type, int dev
aq_programmer(AQ_SET_TIME, NULL, aqdata);
break;
default:
LOG(AQUA_LOG,LOG_ERR, "Unknown device request type %d for deviceindex %d\n",type,deviceIndex);
LOG(PANL_LOG,LOG_ERR, "Unknown device request type %d for deviceindex %d\n",type,deviceIndex);
break;
}

Expand Down
Loading

0 comments on commit 2f7c001

Please sign in to comment.