Version 1.3.5c

pull/90/head
sfeakes 2019-08-23 18:14:14 -05:00
parent 5f6eb03d85
commit 200e0cd821
85 changed files with 97 additions and 1291 deletions

0
LICENSE.md Executable file → Normal file
View File

4
README.md Executable file → Normal file
View File

@ -64,11 +64,13 @@ Designed to mimic AqualinkRS6 All Button keypad and (like the keypad) is used to
* http://aqualink.ip/simple.html <- (Simple opion if you don't like the above) * http://aqualink.ip/simple.html <- (Simple opion if you don't like the above)
* http://aqualink.ip/simulator.html <- (RS8 All Button Control Panel simulator) * http://aqualink.ip/simulator.html <- (RS8 All Button Control Panel simulator)
#<a name="release"></a> #<a name="release"></a>
# Update in Release 1.3.5a,b # Update in Release 1.3.5a,b,c
* Note to Homekit users. Upgrading to 1.3.5c (and above) will add an aditional SWG PPM tile, (look in default room). You'll need to update homebridge-aqualinkd to 0.0.8 (or later) to remove the old tile (or delete you homebridge cache). This is due to a bug in homebridge-aqualinkd < 0.0.7 that didn't delete unused tiles.
* Logic for SWG RS486 checksum_errors. * Logic for SWG RS486 checksum_errors.
* Fixed pentair packet logging, missing last byte. * Fixed pentair packet logging, missing last byte.
* Support for two programmable lights. (Note must update your aqualinkd.conf). * Support for two programmable lights. (Note must update your aqualinkd.conf).
* Can now display warnings and errors in the web UI (as well as log). * Can now display warnings and errors in the web UI (as well as log).
* Memory issue with PDA.
# Update in Release 1.3.5 # Update in Release 1.3.5
* Fixed SWG bug showing off/0% every ~15 seconds (introduced in 1.3.3). * Fixed SWG bug showing off/0% every ~15 seconds (introduced in 1.3.3).
* PDA updates for freeze protect/SWG and general speed increase. * PDA updates for freeze protect/SWG and general speed increase.

0
aq_mqtt.h Executable file → Normal file
View File

16
aq_programmer.c Executable file → Normal file
View File

@ -708,39 +708,37 @@ void *set_aqualink_light_colormode( void *ptr )
// Needs to start programming sequence with light on, if off we need to turn on for 15 seconds // Needs to start programming sequence with light on, if off we need to turn on for 15 seconds
// before we can send the next off. // before we can send the next off.
if ( button->led->state != ON ) { if ( button->led->state != ON ) {
logMessage(LOG_INFO, "Pool Light Initial state off, turning on for 15 seconds\n"); logMessage(LOG_INFO, "Light Programming Initial state off, turning on for %d seconds\n",iOn);
send_cmd(code); send_cmd(code);
//delay(15 * seconds);
delay(iOn * seconds); delay(iOn * seconds);
} }
logMessage(LOG_INFO, "Pool Light turn off for 12 seconds\n"); logMessage(LOG_INFO, "Light Programming turn off for %d seconds\n",iOff);
// Now need to turn off for between 11 and 14 seconds to reset light. // Now need to turn off for between 11 and 14 seconds to reset light.
send_cmd(code); send_cmd(code);
//delay(12 * seconds);
delay(iOff * seconds); delay(iOff * seconds);
// Now light is reset, pulse the appropiate number of times to advance program. // Now light is reset, pulse the appropiate number of times to advance program.
logMessage(LOG_INFO, "Pool Light button pulsing on/off %d times\n", val); logMessage(LOG_INFO, "Light Programming button pulsing on/off %d times\n", val);
// Program light in safe mode (slowley), or quick mode // Program light in safe mode (slowley), or quick mode
if (pmode > 0) { if (pmode > 0) {
for (i = 1; i < (val * 2); i++) { for (i = 1; i < (val * 2); i++) {
logMessage(LOG_INFO, "Pool Light button press number %d - %s of %d\n", i, i % 2 == 0 ? "Off" : "On", val); logMessage(LOG_INFO, "Light Programming button press number %d - %s of %d\n", i, i % 2 == 0 ? "Off" : "On", val);
send_cmd(code); send_cmd(code);
delay(pmode * seconds); // 0.3 works, but using 0.4 to be safe delay(pmode * seconds); // 0.3 works, but using 0.4 to be safe
} }
} else { } else {
for (i = 1; i < val; i++) { for (i = 1; i < val; i++) {
logMessage(LOG_INFO, "Pool Light button press number %d - %s of %d\n", i, "ON", val); logMessage(LOG_INFO, "Light Programming button press number %d - %s of %d\n", i, "ON", val);
send_cmd(code); send_cmd(code);
waitForButtonState(aq_data, button, ON, 2); waitForButtonState(aq_data, button, ON, 2);
logMessage(LOG_INFO, "Pool Light button press number %d - %s of %d\n", i, "OFF", val); logMessage(LOG_INFO, "Light Programming button press number %d - %s of %d\n", i, "OFF", val);
send_cmd(code); send_cmd(code);
waitForButtonState(aq_data, button, OFF, 2); waitForButtonState(aq_data, button, OFF, 2);
} }
logMessage(LOG_INFO, "Finished - Pool Light button press number %d - %s of %d\n", i, "ON", val); logMessage(LOG_INFO, "Finished - Light Programming button press number %d - %s of %d\n", i, "ON", val);
send_cmd(code); send_cmd(code);
} }
//waitForButtonState(aq_data, &aq_data->aqbuttons[btn], ON, 2); //waitForButtonState(aq_data, &aq_data->aqbuttons[btn], ON, 2);

0
aq_programmer.h Executable file → Normal file
View File

0
aq_serial.c Executable file → Normal file
View File

0
aq_serial.h Executable file → Normal file
View File

0
aqualink.h Executable file → Normal file
View File

6
aqualinkd.c Executable file → Normal file
View File

@ -566,6 +566,12 @@ bool process_packet(unsigned char *packet, int length)
{ {
_aqualink_data.pool_temp = TEMP_UNKNOWN; _aqualink_data.pool_temp = TEMP_UNKNOWN;
} }
// COLOR MODE programming relies on state changes, so let any threads know
if (_aqualink_data.active_thread.ptype == AQ_SET_COLORMODE) {
//printf ("Light thread kicking\n");
kick_aq_program_thread(&_aqualink_data);
}
break; break;
case CMD_MSG: case CMD_MSG:
memset(message, 0, AQ_MSGLONGLEN + 1); memset(message, 0, AQ_MSGLONGLEN + 1);

0
config.c Executable file → Normal file
View File

0
config.h Executable file → Normal file
View File

0
domoticz.h Executable file → Normal file
View File

0
extras/HASSIO.Implementation.txt Executable file → Normal file
View File

0
extras/HomeAssistant.png Executable file → Normal file
View File

Before

Width:  |  Height:  |  Size: 190 KiB

After

Width:  |  Height:  |  Size: 190 KiB

0
extras/HomeAssistant2.png Executable file → Normal file
View File

Before

Width:  |  Height:  |  Size: 118 KiB

After

Width:  |  Height:  |  Size: 118 KiB

0
extras/HomeKit.png Executable file → Normal file
View File

Before

Width:  |  Height:  |  Size: 3.8 MiB

After

Width:  |  Height:  |  Size: 3.8 MiB

0
extras/HomeKit2.png Executable file → Normal file
View File

Before

Width:  |  Height:  |  Size: 4.0 MiB

After

Width:  |  Height:  |  Size: 4.0 MiB

0
extras/IMG_0251.PNG Executable file → Normal file
View File

Before

Width:  |  Height:  |  Size: 1.2 MiB

After

Width:  |  Height:  |  Size: 1.2 MiB

0
extras/aqualinkd_icon.psd Executable file → Normal file
View File

0
extras/homebridge.defaults Executable file → Normal file
View File

0
extras/homebridge.service Executable file → Normal file
View File

0
extras/homekit2mqtt.defaults Executable file → Normal file
View File

0
extras/homekit2mqtt.json Executable file → Normal file
View File

0
extras/homekit2mqtt.service Executable file → Normal file
View File

0
extras/meteohub-aq-plugin.sh Executable file → Normal file
View File

0
extras/simple.png Executable file → Normal file
View File

Before

Width:  |  Height:  |  Size: 71 KiB

After

Width:  |  Height:  |  Size: 71 KiB

0
extras/simulator.png Executable file → Normal file
View File

Before

Width:  |  Height:  |  Size: 21 KiB

After

Width:  |  Height:  |  Size: 21 KiB

0
extras/web_ui.png Executable file → Normal file
View File

Before

Width:  |  Height:  |  Size: 413 KiB

After

Width:  |  Height:  |  Size: 413 KiB

0
init_buttons.c Executable file → Normal file
View File

0
init_buttons.h Executable file → Normal file
View File

43
json_messages.c Executable file → Normal file
View File

@ -186,6 +186,9 @@ int build_device_JSON(struct aqualinkdata *aqdata, int programable_switch1, int
int length = 0; int length = 0;
int i; int i;
// IF temp units are F assume homekit is using F
bool homekit_f = (homekit && aqdata->temp_units==FAHRENHEIT);
length += sprintf(buffer+length, "{\"type\": \"devices\""); length += sprintf(buffer+length, "{\"type\": \"devices\"");
length += sprintf(buffer+length, ",\"date\":\"%s\"",aqdata->date );//"09/01/16 THU", length += sprintf(buffer+length, ",\"date\":\"%s\"",aqdata->date );//"09/01/16 THU",
length += sprintf(buffer+length, ",\"time\":\"%s\"",aqdata->time );//"1:16 PM", length += sprintf(buffer+length, ",\"time\":\"%s\"",aqdata->time );//"1:16 PM",
@ -207,9 +210,9 @@ int build_device_JSON(struct aqualinkdata *aqdata, int programable_switch1, int
aqdata->aqbuttons[i].led->state==ON?JSON_ON:JSON_OFF, aqdata->aqbuttons[i].led->state==ON?JSON_ON:JSON_OFF,
LED2text(aqdata->aqbuttons[i].led->state), LED2text(aqdata->aqbuttons[i].led->state),
((homekit)?2:0), ((homekit)?2:0),
((homekit && aqdata->temp_units==FAHRENHEIT)?degFtoC(aqdata->pool_htr_set_point):aqdata->pool_htr_set_point), ((homekit_f)?degFtoC(aqdata->pool_htr_set_point):aqdata->pool_htr_set_point),
((homekit)?2:0), ((homekit)?2:0),
((homekit && aqdata->temp_units==FAHRENHEIT)?degFtoC(aqdata->pool_temp):aqdata->pool_temp), ((homekit_f)?degFtoC(aqdata->pool_temp):aqdata->pool_temp),
LED2int(aqdata->aqbuttons[i].led->state)); LED2int(aqdata->aqbuttons[i].led->state));
} else if ( strcmp(BTN_SPA_HTR,aqdata->aqbuttons[i].name)==0 && aqdata->spa_htr_set_point != TEMP_UNKNOWN) { } else if ( strcmp(BTN_SPA_HTR,aqdata->aqbuttons[i].name)==0 && aqdata->spa_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\" },", length += sprintf(buffer+length, "{\"type\": \"setpoint_thermo\", \"id\": \"%s\", \"name\": \"%s\", \"state\": \"%s\", \"status\": \"%s\", \"spvalue\": \"%.*f\", \"value\": \"%.*f\", \"int_status\": \"%d\" },",
@ -218,9 +221,9 @@ int build_device_JSON(struct aqualinkdata *aqdata, int programable_switch1, int
aqdata->aqbuttons[i].led->state==ON?JSON_ON:JSON_OFF, aqdata->aqbuttons[i].led->state==ON?JSON_ON:JSON_OFF,
LED2text(aqdata->aqbuttons[i].led->state), LED2text(aqdata->aqbuttons[i].led->state),
((homekit)?2:0), ((homekit)?2:0),
((homekit && aqdata->temp_units==FAHRENHEIT)?degFtoC(aqdata->spa_htr_set_point):aqdata->spa_htr_set_point), ((homekit_f)?degFtoC(aqdata->spa_htr_set_point):aqdata->spa_htr_set_point),
((homekit)?2:0), ((homekit)?2:0),
((homekit && aqdata->temp_units==FAHRENHEIT)?degFtoC(aqdata->spa_temp):aqdata->spa_temp), ((homekit_f)?degFtoC(aqdata->spa_temp):aqdata->spa_temp),
LED2int(aqdata->aqbuttons[i].led->state)); LED2int(aqdata->aqbuttons[i].led->state));
} else if ( (programable_switch1 > 0 && programable_switch1 == i) || } else if ( (programable_switch1 > 0 && programable_switch1 == i) ||
(programable_switch2 > 0 && programable_switch2 == i)) { (programable_switch2 > 0 && programable_switch2 == i)) {
@ -251,9 +254,9 @@ int build_device_JSON(struct aqualinkdata *aqdata, int programable_switch1, int
//JSON_ENABLED, //JSON_ENABLED,
aqdata->frz_protect_state==ON?LED2text(ON):LED2text(ENABLE), aqdata->frz_protect_state==ON?LED2text(ON):LED2text(ENABLE),
((homekit)?2:0), ((homekit)?2:0),
((homekit && aqdata->temp_units==FAHRENHEIT)?degFtoC(aqdata->frz_protect_set_point):aqdata->frz_protect_set_point), ((homekit_f)?degFtoC(aqdata->frz_protect_set_point):aqdata->frz_protect_set_point),
((homekit)?2:0), ((homekit)?2:0),
((homekit && aqdata->temp_units==FAHRENHEIT)?degFtoC(aqdata->air_temp):aqdata->air_temp), ((homekit_f)?degFtoC(aqdata->air_temp):aqdata->air_temp),
aqdata->frz_protect_state==ON?1:0); aqdata->frz_protect_state==ON?1:0);
} }
@ -264,26 +267,36 @@ int build_device_JSON(struct aqualinkdata *aqdata, int programable_switch1, int
aqdata->ar_swg_status == 0x00?JSON_ON:JSON_OFF, aqdata->ar_swg_status == 0x00?JSON_ON:JSON_OFF,
aqdata->ar_swg_status == 0x00?JSON_ON:JSON_OFF, aqdata->ar_swg_status == 0x00?JSON_ON:JSON_OFF,
((homekit)?2:0), ((homekit)?2:0),
((homekit)?degFtoC(aqdata->swg_percent):aqdata->swg_percent), ((homekit_f)?degFtoC(aqdata->swg_percent):aqdata->swg_percent),
((homekit)?2:0), ((homekit)?2:0),
((homekit)?degFtoC(aqdata->swg_percent):aqdata->swg_percent), ((homekit_f)?degFtoC(aqdata->swg_percent):aqdata->swg_percent),
aqdata->ar_swg_status == 0x00?1:0); aqdata->ar_swg_status == 0x00?1:0);
//length += sprintf(buffer+length, "{\"type\": \"value\", \"id\": \"%s\", \"name\": \"%s\", \"state\": \"%s\", \"value\": \"%d\" },", //length += sprintf(buffer+length, "{\"type\": \"value\", \"id\": \"%s\", \"name\": \"%s\", \"state\": \"%s\", \"value\": \"%d\" },",
length += sprintf(buffer+length, "{\"type\": \"value\", \"id\": \"%s\", \"name\": \"%s\", \"state\": \"%s\", \"value\": \"%.*f\" },", length += sprintf(buffer+length, "{\"type\": \"value\", \"id\": \"%s\", \"name\": \"%s\", \"state\": \"%s\", \"value\": \"%.*f\" },",
((homekit)?SWG_PERCENT_F_TOPIC:SWG_PERCENT_TOPIC), ((homekit_f)?SWG_PERCENT_F_TOPIC:SWG_PERCENT_TOPIC),
"Salt Water Generator Percent", "Salt Water Generator Percent",
"on", "on",
((homekit)?2:0), ((homekit_f)?2:0),
((homekit)?degFtoC(aqdata->swg_percent):aqdata->swg_percent)); ((homekit_f)?degFtoC(aqdata->swg_percent):aqdata->swg_percent));
} }
if ( aqdata->swg_ppm != TEMP_UNKNOWN ) { if ( aqdata->swg_ppm != TEMP_UNKNOWN ) {
length += sprintf(buffer+length, "{\"type\": \"value\", \"id\": \"%s\", \"name\": \"%s\", \"state\": \"%s\", \"value\": \"%d\" },",
length += sprintf(buffer+length, "{\"type\": \"value\", \"id\": \"%s\", \"name\": \"%s\", \"state\": \"%s\", \"value\": \"%.*f\" },",
((homekit_f)?SWG_PPM_F_TOPIC:SWG_PPM_TOPIC),
"Salt Level PPM",
"on",
((homekit)?2:0),
((homekit_f)?roundf(degFtoC(aqdata->swg_ppm)):aqdata->swg_ppm));
/*
length += sprintf(buffer+length, "{\"type\": \"value\", \"id\": \"%s\", \"name\": \"%s\", \"state\": \"%s\", \"value\": \"%d\" },",
SWG_PPM_TOPIC, SWG_PPM_TOPIC,
"Salt Level PPM", "Salt Level PPM",
"on", "on",
aqdata->swg_ppm); aqdata->swg_ppm);
*/
} }
length += sprintf(buffer+length, "{\"type\": \"temperature\", \"id\": \"%s\", \"name\": \"%s\", \"state\": \"%s\", \"value\": \"%.*f\" },", length += sprintf(buffer+length, "{\"type\": \"temperature\", \"id\": \"%s\", \"name\": \"%s\", \"state\": \"%s\", \"value\": \"%.*f\" },",
@ -292,21 +305,21 @@ int build_device_JSON(struct aqualinkdata *aqdata, int programable_switch1, int
"Pool Air Temperature", "Pool Air Temperature",
"on", "on",
((homekit)?2:0), ((homekit)?2:0),
((homekit && aqdata->temp_units==FAHRENHEIT)?degFtoC(aqdata->air_temp):aqdata->air_temp)); ((homekit_f)?degFtoC(aqdata->air_temp):aqdata->air_temp));
length += sprintf(buffer+length, "{\"type\": \"temperature\", \"id\": \"%s\", \"name\": \"%s\", \"state\": \"%s\", \"value\": \"%.*f\" },", length += sprintf(buffer+length, "{\"type\": \"temperature\", \"id\": \"%s\", \"name\": \"%s\", \"state\": \"%s\", \"value\": \"%.*f\" },",
POOL_TEMP_TOPIC, POOL_TEMP_TOPIC,
/*POOL_TEMPERATURE,*/ /*POOL_TEMPERATURE,*/
"Pool Water Temperature", "Pool Water Temperature",
"on", "on",
((homekit)?2:0), ((homekit)?2:0),
((homekit && aqdata->temp_units==FAHRENHEIT)?degFtoC(aqdata->air_temp):aqdata->pool_temp)); ((homekit_f)?degFtoC(aqdata->air_temp):aqdata->pool_temp));
length += sprintf(buffer+length, "{\"type\": \"temperature\", \"id\": \"%s\", \"name\": \"%s\", \"state\": \"%s\", \"value\": \"%.*f\" }", length += sprintf(buffer+length, "{\"type\": \"temperature\", \"id\": \"%s\", \"name\": \"%s\", \"state\": \"%s\", \"value\": \"%.*f\" }",
SPA_TEMP_TOPIC, SPA_TEMP_TOPIC,
/*SPA_TEMPERATURE,*/ /*SPA_TEMPERATURE,*/
"Spa Water Temperature", "Spa Water Temperature",
"on", "on",
((homekit)?2:0), ((homekit)?2:0),
((homekit && aqdata->temp_units==FAHRENHEIT)?degFtoC(aqdata->air_temp):aqdata->spa_temp)); ((homekit_f)?degFtoC(aqdata->air_temp):aqdata->spa_temp));
/* /*
length += sprintf(buffer+length, "], \"aux_device_detail\": ["); length += sprintf(buffer+length, "], \"aux_device_detail\": [");

0
json_messages.h Executable file → Normal file
View File

0
log_reader.c Executable file → Normal file
View File

0
mongoose.c Executable file → Normal file
View File

0
mongoose.h Executable file → Normal file
View File

2
net_services.c Executable file → Normal file
View File

@ -410,7 +410,7 @@ void mqtt_broadcast_aqualinkstate(struct mg_connection *nc)
if (_aqualink_data->swg_ppm != TEMP_UNKNOWN && ( force_update || _aqualink_data->swg_ppm != _last_mqtt_aqualinkdata.swg_ppm)) { if (_aqualink_data->swg_ppm != TEMP_UNKNOWN && ( force_update || _aqualink_data->swg_ppm != _last_mqtt_aqualinkdata.swg_ppm)) {
_last_mqtt_aqualinkdata.swg_ppm = _aqualink_data->swg_ppm; _last_mqtt_aqualinkdata.swg_ppm = _aqualink_data->swg_ppm;
send_mqtt_numeric_msg(nc, SWG_PPM_TOPIC, _aqualink_data->swg_ppm); send_mqtt_numeric_msg(nc, SWG_PPM_TOPIC, _aqualink_data->swg_ppm);
send_mqtt_numeric_msg(nc, SWG_PPM_F_TOPIC, roundf(degFtoC(_aqualink_data->swg_ppm))); send_mqtt_float_msg(nc, SWG_PPM_F_TOPIC, roundf(degFtoC(_aqualink_data->swg_ppm)));
send_domoticz_mqtt_numeric_msg(nc, _aqualink_config->dzidx_swg_ppm, _aqualink_data->swg_ppm); send_domoticz_mqtt_numeric_msg(nc, _aqualink_config->dzidx_swg_ppm, _aqualink_data->swg_ppm);
} }
} }

0
net_services.h Executable file → Normal file
View File

0
packetLogger.c Executable file → Normal file
View File

0
packetLogger.h Executable file → Normal file
View File

0
pda.c Executable file → Normal file
View File

0
pda.h Executable file → Normal file
View File

28
pda_aq_programmer.c Executable file → Normal file
View File

@ -133,6 +133,7 @@ bool waitForPDAnextMenu(struct aqualinkdata *aq_data) {
bool loopover_devices(struct aqualinkdata *aq_data) { bool loopover_devices(struct aqualinkdata *aq_data) {
int i; int i;
int index = -1; int index = -1;
if (! goto_pda_menu(aq_data, PM_EQUIPTMENT_CONTROL)) { if (! goto_pda_menu(aq_data, PM_EQUIPTMENT_CONTROL)) {
logMessage(LOG_ERR, "loopover_devices :- can't goto PM_EQUIPTMENT_CONTROL menu\n"); logMessage(LOG_ERR, "loopover_devices :- can't goto PM_EQUIPTMENT_CONTROL menu\n");
//cleanAndTerminateThread(threadCtrl); //cleanAndTerminateThread(threadCtrl);
@ -142,13 +143,14 @@ bool loopover_devices(struct aqualinkdata *aq_data) {
// Should look for message "ALL OFF", that's end of device list. // Should look for message "ALL OFF", that's end of device list.
for (i=0; i < 18 && (index = pda_find_m_index("ALL OFF")) == -1 ; i++) { for (i=0; i < 18 && (index = pda_find_m_index("ALL OFF")) == -1 ; i++) {
send_cmd(KEY_PDA_DOWN); send_cmd(KEY_PDA_DOWN);
// Wait for highlight change or shift and update of current line //waitForMessage(aq_data, NULL, 1);
waitForPDAMessageTypes(aq_data,CMD_PDA_HIGHLIGHT,CMD_MSG_LONG,8); waitForPDAMessageTypes(aq_data,CMD_PDA_HIGHLIGHT,CMD_MSG_LONG,8);
} }
if (index == -1) { if (index == -1) {
logMessage(LOG_ERR, "loopover_devices :- can't find ALL OFF\n"); logMessage(LOG_ERR, "loopover_devices :- can't find ALL OFF\n");
return false; return false;
} }
return true; return true;
} }
@ -172,6 +174,7 @@ bool find_pda_menu_item(struct aqualinkdata *aq_data, char *menuText, int charli
send_cmd(KEY_PDA_DOWN); send_cmd(KEY_PDA_DOWN);
//delay(500); //delay(500);
//wait_for_empty_cmd_buffer(); //wait_for_empty_cmd_buffer();
//waitForPDAMessageType(aq_data,CMD_PDA_HIGHLIGHT,2);
waitForPDAMessageTypes(aq_data,CMD_PDA_HIGHLIGHT,CMD_MSG_LONG,8); waitForPDAMessageTypes(aq_data,CMD_PDA_HIGHLIGHT,CMD_MSG_LONG,8);
//waitForMessage(aq_data, NULL, 1); //waitForMessage(aq_data, NULL, 1);
index = (charlimit == 0)?pda_find_m_index(menuText):pda_find_m_index_case(menuText, charlimit); index = (charlimit == 0)?pda_find_m_index(menuText):pda_find_m_index_case(menuText, charlimit);
@ -185,8 +188,7 @@ bool find_pda_menu_item(struct aqualinkdata *aq_data, char *menuText, int charli
return false; return false;
} }
} else { } else {
logMessage(LOG_ERR, "PDA Device programmer couldn't find menu item '%s' in menu %d index %d\n", logMessage(LOG_ERR, "PDA Device programmer couldn't find menu item '%s' in menu %d index %d\n", menuText, pda_m_type(), index);
menuText, pda_m_type(), index);
return false; return false;
} }
} }
@ -307,9 +309,9 @@ bool goto_pda_menu(struct aqualinkdata *aq_data, pda_menu_type menu) {
while (ret && (pda_m_type() != menu)) { while (ret && (pda_m_type() != menu)) {
switch (menu) { switch (menu) {
case PM_HOME: case PM_HOME:
send_cmd(KEY_PDA_BACK); send_cmd(KEY_PDA_BACK);
ret = waitForPDAnextMenu(aq_data); ret = waitForPDAnextMenu(aq_data);
break; break;
case PM_EQUIPTMENT_CONTROL: case PM_EQUIPTMENT_CONTROL:
if (pda_m_type() == PM_HOME) { if (pda_m_type() == PM_HOME) {
ret = select_pda_menu_item(aq_data, "EQUIPMENT ON/OFF", true); ret = select_pda_menu_item(aq_data, "EQUIPMENT ON/OFF", true);
@ -417,8 +419,7 @@ bool goto_pda_menu(struct aqualinkdata *aq_data, pda_menu_type menu) {
menu, pda_m_type()); menu, pda_m_type());
} }
if (pda_m_type() != menu) { if (pda_m_type() != menu) {
logMessage(LOG_ERR, "PDA Device programmer didn't find a requested menu %d, current %d\n", logMessage(LOG_ERR, "PDA Device programmer didn't find a requested menu %d, current %d\n", menu, pda_m_type());
menu, pda_m_type());
return false; return false;
} }
@ -505,6 +506,8 @@ void *set_aqualink_PDA_device_on_off( void *ptr )
} }
void *get_aqualink_PDA_device_status( void *ptr ) void *get_aqualink_PDA_device_status( void *ptr )
{ {
struct programmingThreadCtrl *threadCtrl; struct programmingThreadCtrl *threadCtrl;
@ -582,10 +585,6 @@ void *set_aqualink_PDA_init( void *ptr )
logMessage(LOG_ERR, "PDA Init :- Error getting freeze setpoints\n"); logMessage(LOG_ERR, "PDA Init :- Error getting freeze setpoints\n");
} }
// shift line test
// goto_pda_menu(aq_data,PM_SYSTEM_SETUP);
// select_pda_menu_item(aq_data, "SERVICE INFO", true);
pda_reset_sleep(); pda_reset_sleep();
cleanAndTerminateThread(threadCtrl); cleanAndTerminateThread(threadCtrl);
@ -757,6 +756,7 @@ bool set_PDA_numeric_field_value(struct aqualinkdata *aq_data, int val, int *cur
if (select_label != NULL) { if (select_label != NULL) {
// :TODO: Should probably change below to call find_pda_menu_item(), rather than doing it here // :TODO: Should probably change below to call find_pda_menu_item(), rather than doing it here
// If we lease this, need to limit on the number of loops // If we lease this, need to limit on the number of loops
//while ( strncasecmp(pda_m_hlight(), select_label, 8) != 0 ) {
while ( strncasecmp(pda_m_hlight(), select_label, strlen(select_label)) != 0 ) { while ( strncasecmp(pda_m_hlight(), select_label, strlen(select_label)) != 0 ) {
send_cmd(KEY_PDA_DOWN); send_cmd(KEY_PDA_DOWN);
delay(500); // Last message probably was CMD_PDA_HIGHLIGHT, so wait before checking. delay(500); // Last message probably was CMD_PDA_HIGHLIGHT, so wait before checking.

0
pda_aq_programmer.h Executable file → Normal file
View File

40
pda_menu.c Executable file → Normal file
View File

@ -205,25 +205,25 @@ bool process_pda_menu_packet(unsigned char* packet, int length)
if (getLogLevel() >= LOG_DEBUG){print_menu();} if (getLogLevel() >= LOG_DEBUG){print_menu();}
break; break;
case CMD_PDA_SHIFTLINES: case CMD_PDA_SHIFTLINES:
// press up from top - shift menu down by 1 /// press up from top - shift menu down by 1
// PDA Shif | HEX: 0x10|0x02|0x62|0x0f|0x01|0x08|0x01|0x8d|0x10|0x03| // PDA Shif | HEX: 0x10|0x02|0x62|0x0f|0x01|0x08|0x01|0x8d|0x10|0x03|
// press down from bottom - shift menu up by 1 // press down from bottom - shift menu up by 1
// PDA Shif | HEX: 0x10|0x02|0x62|0x0f|0x01|0x08|0xff|0x8b|0x10|0x03| // PDA Shif | HEX: 0x10|0x02|0x62|0x0f|0x01|0x08|0xff|0x8b|0x10|0x03|
first_line = (signed char)(packet[4]); first_line = (signed char)(packet[4]);
last_line = (signed char)(packet[5]); last_line = (signed char)(packet[5]);
line_shift = (signed char)(packet[6]); line_shift = (signed char)(packet[6]);
logMessage(LOG_DEBUG, "\n"); logMessage(LOG_DEBUG, "\n");
if (line_shift < 0) { if (line_shift < 0) {
for (i = first_line-line_shift; i <= last_line; i++) { for (i = first_line-line_shift; i <= last_line; i++) {
memcpy(_menu[i+line_shift], _menu[i], AQ_MSGLEN+1); memcpy(_menu[i+line_shift], _menu[i], AQ_MSGLEN+1);
} }
} else { } else {
for (i = last_line; i >= first_line+line_shift; i--) { for (i = last_line; i >= first_line+line_shift; i--) {
memcpy(_menu[i], _menu[i-line_shift], AQ_MSGLEN+1); memcpy(_menu[i], _menu[i-line_shift], AQ_MSGLEN+1);
} }
} }
if (getLogLevel() >= LOG_DEBUG){print_menu();} if (getLogLevel() >= LOG_DEBUG){print_menu();}
break; break;
} }
return rtn; return rtn;
@ -305,4 +305,4 @@ bool NEW_process_pda_menu_packet_NEW(unsigned char* packet, int length)
return rtn; return rtn;
} }
#endif #endif

0
pda_menu.h Executable file → Normal file
View File

0
pentair_messages.c Executable file → Normal file
View File

0
pentair_messages.h Executable file → Normal file
View File

Binary file not shown.

0
release/aqualinkd.defaults Executable file → Normal file
View File

0
release/aqualinkd.service.avahi Executable file → Normal file
View File

0
release/aqualinkd.upstart.conf Executable file → Normal file
View File

Binary file not shown.

0
serial_logger.c Executable file → Normal file
View File

0
timespec_subtract.c Executable file → Normal file
View File

0
timespec_subtract.h Executable file → Normal file
View File

35
utils.c Executable file → Normal file
View File

@ -44,7 +44,7 @@
static bool _daemonise = false; static bool _daemonise = false;
static bool _log2file = false; static bool _log2file = false;
static int _log_level = -1; static int _log_level = LOG_ERR;
static char *_log_filename = NULL; static char *_log_filename = NULL;
static char *_loq_display_message = NULL; static char *_loq_display_message = NULL;
@ -283,8 +283,14 @@ void test(int msg_level, char *msg)
} }
} }
void logMessage(int msg_level, char *format, ...) void logMessage(int msg_level, char *format, ...)
{ {
// Simply return ASAP.
if (msg_level > _log_level) {
return;
}
char buffer[1024]; char buffer[1024];
va_list args; va_list args;
va_start(args, format); va_start(args, format);
@ -295,12 +301,11 @@ void logMessage(int msg_level, char *format, ...)
//test(msg_level, buffer); //test(msg_level, buffer);
//fprintf (stderr, buffer); //fprintf (stderr, buffer);
// Logging has not been setup yet, so STD error & syslog
if (_log_level == -1) { if (_log_level == -1) {
fprintf (stderr, buffer); fprintf (stderr, buffer);
syslog (msg_level, "%s", &buffer[8]); syslog (msg_level, "%s", &buffer[8]);
closelog (); closelog ();
} else if (msg_level > _log_level) {
return;
} }
if (_daemonise == TRUE) if (_daemonise == TRUE)
@ -313,26 +318,20 @@ void logMessage(int msg_level, char *format, ...)
//return; //return;
} }
//if (_log2file == TRUE && _log_filename != NULL) { int len;
int len; char *strLevel = elevel2text(msg_level);
char *strLevel = elevel2text(msg_level); strncpy(buffer, strLevel, strlen(strLevel));
len = strlen(buffer);
strncpy(buffer, strLevel, strlen(strLevel)); if ( buffer[len-1] != '\n') {
strcat(buffer, "\n");
len = strlen(buffer); }
//printf( " '%s' last chrs '%d''%d'\n", buffer, buffer[len-1],buffer[len]);
if ( buffer[len-1] != '\n') {
strcat(buffer, "\n");
}
// Sent the log to the UI if configured.
if (msg_level <= LOG_WARNING && _loq_display_message != NULL) { if (msg_level <= LOG_WARNING && _loq_display_message != NULL) {
snprintf(_loq_display_message, 127, buffer); snprintf(_loq_display_message, 127, buffer);
} }
if (_log2file == TRUE && _log_filename != NULL) {
if (_log2file == TRUE && _log_filename != NULL) {
char time[TIMESTAMP_LENGTH]; char time[TIMESTAMP_LENGTH];
int fp = open(_log_filename, O_WRONLY | O_APPEND | O_CREAT, S_IRUSR | S_IWUSR | S_IRGRP | S_IWGRP | S_IROTH | S_IWOTH); int fp = open(_log_filename, O_WRONLY | O_APPEND | O_CREAT, S_IRUSR | S_IWUSR | S_IRGRP | S_IWGRP | S_IROTH | S_IWOTH);
if (fp != -1) { if (fp != -1) {

0
utils.h Executable file → Normal file
View File

2
version.h Executable file → Normal file
View File

@ -1,4 +1,4 @@
#define AQUALINKD_NAME "Aqualink Daemon" #define AQUALINKD_NAME "Aqualink Daemon"
#define AQUALINKD_VERSION "1.3.5b" #define AQUALINKD_VERSION "1.3.5c"

0
web/aqualink-black.png Executable file → Normal file
View File

Before

Width:  |  Height:  |  Size: 24 KiB

After

Width:  |  Height:  |  Size: 24 KiB

0
web/aqualink-transparent.png Executable file → Normal file
View File

Before

Width:  |  Height:  |  Size: 26 KiB

After

Width:  |  Height:  |  Size: 26 KiB

0
web/aqualinkd-new.png Executable file → Normal file
View File

Before

Width:  |  Height:  |  Size: 23 KiB

After

Width:  |  Height:  |  Size: 23 KiB

0
web/aqualinkd-white.png Executable file → Normal file
View File

Before

Width:  |  Height:  |  Size: 30 KiB

After

Width:  |  Height:  |  Size: 30 KiB

0
web/aqualinkd.png Executable file → Normal file
View File

Before

Width:  |  Height:  |  Size: 26 KiB

After

Width:  |  Height:  |  Size: 26 KiB

0
web/aqualinkd_62.png Executable file → Normal file
View File

Before

Width:  |  Height:  |  Size: 19 KiB

After

Width:  |  Height:  |  Size: 19 KiB

0
web/config.js Executable file → Normal file
View File

0
web/controller.html Executable file → Normal file
View File

0
web/controller.old.html Executable file → Normal file
View File

0
web/hk/aqualinkd.png Executable file → Normal file
View File

Before

Width:  |  Height:  |  Size: 23 KiB

After

Width:  |  Height:  |  Size: 23 KiB

0
web/hk/background.jpg Executable file → Normal file
View File

Before

Width:  |  Height:  |  Size: 846 KiB

After

Width:  |  Height:  |  Size: 846 KiB

File diff suppressed because it is too large Load Diff

0
web/hk/switch-off-black.png Executable file → Normal file
View File

Before

Width:  |  Height:  |  Size: 18 KiB

After

Width:  |  Height:  |  Size: 18 KiB

0
web/hk/switch-off.png Executable file → Normal file
View File

Before

Width:  |  Height:  |  Size: 18 KiB

After

Width:  |  Height:  |  Size: 18 KiB

0
web/hk/switch-on.png Executable file → Normal file
View File

Before

Width:  |  Height:  |  Size: 19 KiB

After

Width:  |  Height:  |  Size: 19 KiB

0
web/old/controller.html Executable file → Normal file
View File

0
web/old/css/small_ff.css Executable file → Normal file
View File

0
web/old/images/battery_blank.png Executable file → Normal file
View File

Before

Width:  |  Height:  |  Size: 3.4 KiB

After

Width:  |  Height:  |  Size: 3.4 KiB

0
web/old/images/battery_low.png Executable file → Normal file
View File

Before

Width:  |  Height:  |  Size: 2.3 KiB

After

Width:  |  Height:  |  Size: 2.3 KiB

0
web/old/images/battery_ok.png Executable file → Normal file
View File

Before

Width:  |  Height:  |  Size: 2.4 KiB

After

Width:  |  Height:  |  Size: 2.4 KiB

0
web/old/images/net_green.png Executable file → Normal file
View File

Before

Width:  |  Height:  |  Size: 3.2 KiB

After

Width:  |  Height:  |  Size: 3.2 KiB

0
web/old/images/net_off.png Executable file → Normal file
View File

Before

Width:  |  Height:  |  Size: 3.2 KiB

After

Width:  |  Height:  |  Size: 3.2 KiB

0
web/old/images/net_red.png Executable file → Normal file
View File

Before

Width:  |  Height:  |  Size: 3.2 KiB

After

Width:  |  Height:  |  Size: 3.2 KiB

0
web/old/images/net_yellow.png Executable file → Normal file
View File

Before

Width:  |  Height:  |  Size: 3.2 KiB

After

Width:  |  Height:  |  Size: 3.2 KiB

0
web/old/js/aqualink.js Executable file → Normal file
View File

0
web/simple.html Executable file → Normal file
View File

0
web/simulator.html Executable file → Normal file
View File