PDA-Update
sfeakes 2024-05-13 17:34:46 -05:00
parent 868cb8b790
commit 7c37a7cc23
16 changed files with 61 additions and 9 deletions

View File

@ -14,6 +14,7 @@ AQ_PDA = true
AQ_ONETOUCH = true AQ_ONETOUCH = true
AQ_IAQTOUCH = true AQ_IAQTOUCH = true
AQ_MANAGER =true AQ_MANAGER =true
#AQ_RS_EXTRA_OPTS = false #AQ_RS_EXTRA_OPTS = false
#AQ_CONTAINER = false // this is for compiling for containers #AQ_CONTAINER = false // this is for compiling for containers
#AQ_MEMCMP = true // Not implimented correctly yet. #AQ_MEMCMP = true // Not implimented correctly yet.

BIN
a.out Executable file

Binary file not shown.

View File

@ -756,8 +756,11 @@ void _aq_programmer(program_type r_type, char *args, struct aqualinkdata *aq_dat
type = AQ_SET_IAQTOUCH_DEVICE_ON_OFF; type = AQ_SET_IAQTOUCH_DEVICE_ON_OFF;
} }
break; break;
// This isn;t going to work outside of PDA mode, if the labels are incorrect.
case AQ_SET_LIGHTCOLOR_MODE: case AQ_SET_LIGHTCOLOR_MODE:
if (isPDA_IAQT) {
type = AQ_SET_IAQTOUCH_LIGHTCOLOR_MODE; type = AQ_SET_IAQTOUCH_LIGHTCOLOR_MODE;
}
break; break;
default: default:
type = r_type; type = r_type;
@ -1556,7 +1559,7 @@ void *set_aqualink_light_colormode( void *ptr )
use_current_mode = true; use_current_mode = true;
LOG(PROG_LOG, LOG_INFO, "Light Programming #: %d, on button: %s, color light type: %d, using current mode\n", val, button->label, typ); LOG(PROG_LOG, LOG_INFO, "Light Programming #: %d, on button: %s, color light type: %d, using current mode\n", val, button->label, typ);
} else { } else {
mode_name = light_mode_name(typ, val-1); mode_name = light_mode_name(typ, val-1, ALLBUTTON);
use_current_mode = false; use_current_mode = false;
if (mode_name == NULL) { if (mode_name == NULL) {
LOG(PROG_LOG, LOG_ERR, "Light Programming #: %d, on button: %s, color light type: %d, couldn't find mode name '%s'\n", val, button->label, typ, mode_name); LOG(PROG_LOG, LOG_ERR, "Light Programming #: %d, on button: %s, color light type: %d, couldn't find mode name '%s'\n", val, button->label, typ, mode_name);

View File

@ -205,6 +205,7 @@ struct aqualinkdata
char time[AQ_MSGLEN]; char time[AQ_MSGLEN];
char last_message[AQ_MSGLONGLEN+1]; // Last ascii message from panel - allbutton (or PDA) protocol char last_message[AQ_MSGLONGLEN+1]; // Last ascii message from panel - allbutton (or PDA) protocol
char last_display_message[AQ_MSGLONGLEN+1]; // Last message to display in web UI char last_display_message[AQ_MSGLONGLEN+1]; // Last message to display in web UI
bool is_display_message_programming;
aqled aqualinkleds[TOTAL_LEDS]; aqled aqualinkleds[TOTAL_LEDS];
aqkey aqbuttons[TOTAL_BUTTONS]; aqkey aqbuttons[TOTAL_BUTTONS];
unsigned short total_buttons; unsigned short total_buttons;

View File

@ -1516,6 +1516,7 @@ void main_loop()
int blank_read_reconnect = MAX_ZERO_READ_BEFORE_RECONNECT_BLOCKING; // Will get reset if non blocking int blank_read_reconnect = MAX_ZERO_READ_BEFORE_RECONNECT_BLOCKING; // Will get reset if non blocking
sprintf(_aqualink_data.last_display_message, "%s", "Connecting to Control Panel"); sprintf(_aqualink_data.last_display_message, "%s", "Connecting to Control Panel");
_aqualink_data.is_display_message_programming = false;
//_aqualink_data.simulate_panel = false; //_aqualink_data.simulate_panel = false;
_aqualink_data.active_thread.thread_id = 0; _aqualink_data.active_thread.thread_id = 0;
_aqualink_data.air_temp = TEMP_UNKNOWN; _aqualink_data.air_temp = TEMP_UNKNOWN;

View File

@ -6,6 +6,7 @@
//#define COLOR_LIGHTS_C_ //#define COLOR_LIGHTS_C_
#include "color_lights.h" #include "color_lights.h"
/****** This list MUST be in order of clight_type enum *******/ /****** This list MUST be in order of clight_type enum *******/
const char *_color_light_options[NUMBER_LIGHT_COLOR_TYPES][LIGHT_COLOR_OPTIONS] = const char *_color_light_options[NUMBER_LIGHT_COLOR_TYPES][LIGHT_COLOR_OPTIONS] =
{ {
@ -52,7 +53,7 @@ const char *_color_light_options[NUMBER_LIGHT_COLOR_TYPES][LIGHT_COLOR_OPTIONS]
"Voodoo Lounge", "Voodoo Lounge",
"Deep Blue Sea", "Deep Blue Sea",
//"Royal Blue", //"Royal Blue",
"Afternoon Skies", "Afternoon Skies", // 'Afternoon Sky' on allbutton, Skies on iaqtouch
//"Aqua Green", //"Aqua Green",
"Emerald", "Emerald",
"Sangria", "Sangria",
@ -91,8 +92,15 @@ const char *_color_light_options[NUMBER_LIGHT_COLOR_TYPES][LIGHT_COLOR_OPTIONS]
}; };
const char *light_mode_name(clight_type type, int index) const char *light_mode_name(clight_type type, int index, emulation_type protocol)
{ {
// Rename any modes depending on emulation type
if (protocol == ALLBUTTON) {
if (strcmp(_color_light_options[type][index],"Afternoon Skies") == 0) {
return "Afternoon Sky";
}
}
return _color_light_options[type][index]; return _color_light_options[type][index];
} }

View File

@ -3,6 +3,7 @@
#define COLOR_LIGHTS_H_ #define COLOR_LIGHTS_H_
#include "aqualink.h" #include "aqualink.h"
#include "aq_programmer.h"
#define LIGHT_COLOR_NAME 16 #define LIGHT_COLOR_NAME 16
#define LIGHT_COLOR_OPTIONS 17 #define LIGHT_COLOR_OPTIONS 17
@ -19,7 +20,8 @@ typedef enum clight_type {
LC_INTELLIB LC_INTELLIB
} clight_type; } clight_type;
*/ */
const char *light_mode_name(clight_type type, int index); //const char *light_mode_name(clight_type type, int index);
const char *light_mode_name(clight_type type, int index, emulation_type protocol);
int build_color_lights_js(struct aqualinkdata *aqdata, char* buffer, int size); int build_color_lights_js(struct aqualinkdata *aqdata, char* buffer, int size);

View File

@ -718,6 +718,7 @@ bool process_iaqtouch_packet(unsigned char *packet, int length, struct aqualinkd
// Reset and messages on new page // Reset and messages on new page
aq_data->last_display_message[0] = ' '; aq_data->last_display_message[0] = ' ';
aq_data->last_display_message[1] = '\0'; aq_data->last_display_message[1] = '\0';
aq_data->is_display_message_programming = false;
LOG(IAQT_LOG,LOG_DEBUG, "Turning IAQ SEND off\n"); LOG(IAQT_LOG,LOG_DEBUG, "Turning IAQ SEND off\n");
set_iaq_cansend(false); set_iaq_cansend(false);
_currentPageLoading = packet[PKT_IAQT_PAGTYPE]; _currentPageLoading = packet[PKT_IAQT_PAGTYPE];
@ -789,11 +790,25 @@ bool process_iaqtouch_packet(unsigned char *packet, int length, struct aqualinkd
} }
} }
} else if (isPDA_PANEL && packet[PKT_CMD] == CMD_IAQ_MSG_LONG) { } else if (isPDA_PANEL && packet[PKT_CMD] == CMD_IAQ_MSG_LONG) {
char *sp;
// Set disply message if PDA panel // Set disply message if PDA panel
memset(message, 0, AQ_MSGLONGLEN + 1); memset(message, 0, AQ_MSGLONGLEN + 1);
rsm_strncpy(message, packet + 6, AQ_MSGLONGLEN, length-9); rsm_strncpy(message, packet + 6, AQ_MSGLONGLEN, length-9);
LOG(IAQT_LOG,LOG_NOTICE, "Popup message '%s'\n",message); LOG(IAQT_LOG,LOG_NOTICE, "Popup message '%s'\n",message);
// Change this message, since you can't press OK. 'Light will turn off in 5 seconds. To change colors press Ok now.'
if ((sp = rsm_strncasestr(message, "To change colors press Ok now", strlen(message))) != NULL)
{
*sp = '\0';
}
strcpy(aq_data->last_display_message, message); // Also display the message on web UI strcpy(aq_data->last_display_message, message); // Also display the message on web UI
if (in_programming_mode(aq_data)) {
aq_data->is_display_message_programming = true;
} else {
aq_data->is_display_message_programming = false;
}
/* /*
for(int i=0; i<length; i++) { for(int i=0; i<length; i++) {
printf("0x%02hhx|",packet[i]); printf("0x%02hhx|",packet[i]);

View File

@ -586,7 +586,7 @@ void *set_aqualink_iaqtouch_light_colormode( void *ptr )
turn_off = true; turn_off = true;
LOG(IAQT_LOG, LOG_INFO, "Light Programming #: %d, button: %s, color light type: %d, Turning off\n", val, key->label, typ); LOG(IAQT_LOG, LOG_INFO, "Light Programming #: %d, button: %s, color light type: %d, Turning off\n", val, key->label, typ);
} else { } else {
mode_name = light_mode_name(typ, val-1); mode_name = light_mode_name(typ, val-1, IAQTOUCH);
use_current_mode = false; use_current_mode = false;
if (mode_name == NULL) { if (mode_name == NULL) {
LOG(IAQT_LOG, LOG_ERR, "Light Programming #: %d, button: %s, color light type: %d, couldn't find mode name '%s'\n", val, key->label, typ, mode_name); LOG(IAQT_LOG, LOG_ERR, "Light Programming #: %d, button: %s, color light type: %d, couldn't find mode name '%s'\n", val, key->label, typ, mode_name);
@ -633,6 +633,7 @@ void *set_aqualink_iaqtouch_light_colormode( void *ptr )
if (use_current_mode) { if (use_current_mode) {
// Their is no message for this, so give one. // Their is no message for this, so give one.
sprintf(aq_data->last_display_message, "Light will turn on in 5 seconds"); sprintf(aq_data->last_display_message, "Light will turn on in 5 seconds");
aq_data->is_display_message_programming = true;
aq_data->updated = true; aq_data->updated = true;
} }
// Wait for next page maybe? // Wait for next page maybe?
@ -756,7 +757,9 @@ void *set_aqualink_iaqtouch_pump_rpm( void *ptr )
//send_aqt_cmd(0x80); //send_aqt_cmd(0x80);
// Go to status page on startup to read devices // Go to status page on startup to read devices
goto_iaqt_page(IAQ_PAGE_STATUS, aq_data); // This is too soon
//goto_iaqt_page(IAQ_PAGE_STATUS, aq_data);
//waitfor_iaqt_nextPage(aq_data);
f_end: f_end:
goto_iaqt_page(IAQ_PAGE_HOME, aq_data); goto_iaqt_page(IAQ_PAGE_HOME, aq_data);

View File

@ -98,6 +98,11 @@ const char* _getStatus(struct aqualinkdata *aqdata, const char *blankmsg)
return programtypeDisplayName(aqdata->active_thread.ptype); return programtypeDisplayName(aqdata->active_thread.ptype);
} }
*/ */
if (aqdata->active_thread.thread_id != 0) {
if (!aqdata->is_display_message_programming || rsm_isempy(aqdata->last_display_message,strlen(aqdata->last_display_message))){
return programtypeDisplayName(aqdata->active_thread.ptype);
}
}
//if (aqdata->last_message != NULL && stristr(aqdata->last_message, "SERVICE") != NULL ) { //if (aqdata->last_message != NULL && stristr(aqdata->last_message, "SERVICE") != NULL ) {
if (aqdata->service_mode_state == ON) { if (aqdata->service_mode_state == ON) {

Binary file not shown.

Binary file not shown.

View File

@ -147,6 +147,18 @@ char *rsm_charafterstr(const char *haystack, const char *needle, int length)
return ++sp; return ++sp;
} }
/*
Check if string has printable chars and is not empty
*/
bool rsm_isempy(const char *src, int length)
{
int i;
for(i=0; i < length; i++) {
if (src[i] > 32 && src[i] < 127) // 32 is space
return true;
}
return false;
}
/* /*
Can probably replace this with rsm_strncasestr in all code. Can probably replace this with rsm_strncasestr in all code.
*/ */

View File

@ -8,6 +8,7 @@ int rsm_get_boardcpu(char *dest, int dest_len, const char *src, int src_len);
char *rsm_charafterstr(const char *haystack, const char *needle, int length); char *rsm_charafterstr(const char *haystack, const char *needle, int length);
bool rsm_isempy(const char *src, int length);
char *rsm_strstr(const char *haystack, const char *needle); char *rsm_strstr(const char *haystack, const char *needle);
//char *rsm_strnstr(const char *haystack, const char *needle, int length); //char *rsm_strnstr(const char *haystack, const char *needle, int length);
char *rsm_strnstr(const char *haystack, const char *needle, size_t slen); char *rsm_strnstr(const char *haystack, const char *needle, size_t slen);

0
util.c
View File

View File

@ -35,8 +35,8 @@
"Spa_Water", "Spa_Water",
"Freeze_Protect", "Freeze_Protect",
"CHEM/pH", "CHEM/pH",
"CHEM/ORP" "CHEM/ORP",
//"Solar_Heater", "Solar_Heater",
]; ];
// This get's picked up by dynamic_config.js and used as mode 0 // This get's picked up by dynamic_config.js and used as mode 0