mirror of https://github.com/sfeakes/AqualinkD.git
Updates to fix mongoose issues
parent
b60ec3ac55
commit
51e4e633ac
4
Makefile
4
Makefile
|
@ -6,8 +6,8 @@ LIBS := -lpthread -lm
|
|||
#LIBS := -lpthread -lwebsockets
|
||||
|
||||
# debug of not
|
||||
#$DBG = -g
|
||||
$DBG =
|
||||
#DBG = -g
|
||||
DBG =
|
||||
|
||||
# USe below to remove unused functions and global variables.
|
||||
#LFLAGS = -Wl,--gc-sections,--print-gc-sections
|
||||
|
|
|
@ -64,12 +64,13 @@ Designed to mimic AqualinkRS6 All Button keypad, and just like the keypad you ca
|
|||
* http://aqualink.ip/simple.html <- (Anothr opion if you don't like the above)
|
||||
* http://aqualink.ip/simulator.html <- (RS8 All Button Control Panel simulator)
|
||||
#<a name="release"></a>
|
||||
## Update in Release 1.2.6e (This is a quick update, please only use if you need one of the items below.)
|
||||
## Update in Release 1.2.6f
|
||||
* Solution to overcome bug in Mosquitto 1.6.
|
||||
* Fixed Salt Water Generator when % was set to 0.
|
||||
* Added support for different SWG % for pool & spa.
|
||||
* Increased speed of SWG messages.
|
||||
* Changed version of mongoose.
|
||||
## Update in Release 1.2.6e (This is a quick update, please only use if you need one of the items below.)
|
||||
* Unstable update.
|
||||
## Update in Release 1.2.6c
|
||||
* Fix some merge issues
|
||||
* Added MQTT topic for delayed start on buttons.
|
||||
|
|
|
@ -27,6 +27,7 @@
|
|||
#include "aq_programmer.h"
|
||||
#include "aq_serial.h"
|
||||
#include "pda_menu.h"
|
||||
#include "init_buttons.h"
|
||||
|
||||
bool select_sub_menu_item(struct aqualinkdata *aq_data, char* item_string);
|
||||
bool select_menu_item(struct aqualinkdata *aq_data, char* item_string);
|
||||
|
@ -311,7 +312,12 @@ void aq_programmer(program_type type, char *args, struct aqualinkdata *aq_data)
|
|||
break;
|
||||
}
|
||||
|
||||
pthread_detach(programmingthread->thread_id);
|
||||
if ( programmingthread->thread_id != 0 ) {
|
||||
//logMessage (LOG_DEBUG, "********* DID pthread_detach %d\n",programmingthread->thread_id);
|
||||
pthread_detach(programmingthread->thread_id);
|
||||
} else {
|
||||
//logMessage (LOG_DEBUG, "********* DID NOT pthread_detach\n");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
@ -486,28 +492,49 @@ void *set_aqualink_SWG( void *ptr )
|
|||
logMessage(LOG_DEBUG, "programming SWG percent to %d\n", val);
|
||||
|
||||
if ( select_menu_item(aq_data, "SET AQUAPURE") != true ) {
|
||||
logMessage(LOG_WARNING, "Could not select SET TEMP menu\n");
|
||||
logMessage(LOG_WARNING, "Could not select SET AQUAPURE menu\n");
|
||||
cancel_menu(aq_data);
|
||||
cleanAndTerminateThread(threadCtrl);
|
||||
return ptr;
|
||||
}
|
||||
|
||||
// If spa is on, set SWG for spa, if not set SWG for pool
|
||||
if (aq_data->aqbuttons[SPA_INDEX].led->state != OFF) {
|
||||
if (select_sub_menu_item(aq_data, "SET SPA SP") != true) {
|
||||
logMessage(LOG_WARNING, "Could not select SWG setpoint menu for SPA\n");
|
||||
cancel_menu(aq_data);
|
||||
cleanAndTerminateThread(threadCtrl);
|
||||
return ptr;
|
||||
}
|
||||
setAqualinkNumericField_new(aq_data, "SPA SP", val, 5);
|
||||
} else {
|
||||
if (select_sub_menu_item(aq_data, "SET POOL SP") != true) {
|
||||
logMessage(LOG_WARNING, "Could not select SWG setpoint menu\n");
|
||||
cancel_menu(aq_data);
|
||||
cleanAndTerminateThread(threadCtrl);
|
||||
return ptr;
|
||||
}
|
||||
setAqualinkNumericField_new(aq_data, "POOL SP", val, 5);
|
||||
}
|
||||
|
||||
/*
|
||||
if (select_sub_menu_item(aq_data, "SET POOL SP") != true) {
|
||||
logMessage(LOG_WARNING, "Could not select SET POOL TEMP menu\n");
|
||||
logMessage(LOG_WARNING, "Could not select SWG setpoint menu\n");
|
||||
cancel_menu(aq_data);
|
||||
cleanAndTerminateThread(threadCtrl);
|
||||
return ptr;
|
||||
}
|
||||
|
||||
setAqualinkNumericField_new(aq_data, "POOL SP", val, 5);
|
||||
|
||||
*/
|
||||
// usually miss this message, not sure why, but wait anyway to make sure programming has ended
|
||||
// NSF have see the below message RS Message :-
|
||||
// NSF have see the below message RS Message :-
|
||||
// 'Pool set to 20%'
|
||||
// 'POOL SP IS SET TO 20%'
|
||||
waitForMessage(threadCtrl->aq_data, "SET TO", 1);
|
||||
//waitForMessage(threadCtrl->aq_data, "POOL SP IS SET TO", 1);
|
||||
|
||||
|
||||
cleanAndTerminateThread(threadCtrl);
|
||||
|
||||
// just stop compiler error, ptr is not valid as it's just been freed
|
||||
|
|
4913
mongoose.c
4913
mongoose.c
File diff suppressed because it is too large
Load Diff
803
mongoose.h
803
mongoose.h
File diff suppressed because it is too large
Load Diff
|
@ -828,7 +828,15 @@ void action_websocket_request(struct mg_connection *nc, struct websocket_message
|
|||
} else if (strcmp(request.first.value, "SPA_HTR") == 0 || strcmp(request.first.value, BTN_SPA_HTR) == 0) {
|
||||
aq_programmer(AQ_SET_SPA_HEATER_TEMP, request.second.value, _aqualink_data);
|
||||
} else if (strcmp(request.first.value, SWG_TOPIC) == 0) {
|
||||
aq_programmer(AQ_SET_SWG_PERCENT, request.second.value, _aqualink_data);
|
||||
//aq_programmer(AQ_SET_SWG_PERCENT, request.second.value, _aqualink_data);
|
||||
int value = setpoint_check(SWG_SETPOINT, atoi(request.second.value), _aqualink_data);
|
||||
if (_aqualink_data->ar_swg_status == SWG_STATUS_OFF ) {
|
||||
// SWG is off, can't set %, so delay the set until it's on.
|
||||
_aqualink_data->swg_delayed_percent = value;
|
||||
} else {
|
||||
aq_programmer(AQ_SET_SWG_PERCENT, request.second.value, _aqualink_data);
|
||||
_aqualink_data->swg_percent = value; // Set the value as if it's already been set, just incase it's 0 as we won't get that message, or will update next time
|
||||
}
|
||||
} else if (strcmp(request.first.value, "POOL_LIGHT_MODE") == 0) {
|
||||
//aq_programmer(AQ_SET_COLORMODE, request.second.value, _aqualink_data);
|
||||
set_light_mode(request.second.value);
|
||||
|
@ -1068,7 +1076,6 @@ static void ev_handler(struct mg_connection *nc, int ev, void *ev_data) {
|
|||
opts.will_message = MQTT_OFF;
|
||||
|
||||
mg_set_protocol_mqtt(nc);
|
||||
//mg_send_mqtt_handshake_opt(nc, "aqualinkd_b827eb689", opts);
|
||||
mg_send_mqtt_handshake_opt(nc, _aqualink_config->mqtt_ID, opts);
|
||||
logMessage(LOG_INFO, "MQTT: Subscribing mqtt with id of: %s\n", _aqualink_config->mqtt_ID);
|
||||
//last_control_time = mg_time();
|
||||
|
|
Binary file not shown.
Loading…
Reference in New Issue