mirror of https://github.com/sfeakes/AqualinkD.git
RS485 message additions
parent
b47b8215d5
commit
5ca3e9a958
|
@ -687,8 +687,9 @@ bool waitForEitherMessage(struct aqualinkdata *aq_data, char* message1, char* me
|
|||
logMessage(LOG_DEBUG, "Programming mode: loop %d of %d looking for '%s' OR '%s' received message1 '%s'\n",i,numMessageReceived,message1,message2,aq_data->last_message);
|
||||
|
||||
if (message1 != NULL) {
|
||||
ptr = strstr(aq_data->last_message, msgS1);
|
||||
ptr = stristr(aq_data->last_message, msgS1);
|
||||
if (ptr != NULL) { // match
|
||||
logMessage(LOG_DEBUG, "Programming mode: String MATCH '%s'\n", msgS1);
|
||||
if (msgS1 == message1) // match & don't care if first char
|
||||
break;
|
||||
else if (ptr == aq_data->last_message) // match & do care if first char
|
||||
|
@ -696,8 +697,9 @@ bool waitForEitherMessage(struct aqualinkdata *aq_data, char* message1, char* me
|
|||
}
|
||||
}
|
||||
if (message2 != NULL) {
|
||||
ptr = strstr(aq_data->last_message, msgS2);
|
||||
ptr = stristr(aq_data->last_message, msgS2);
|
||||
if (ptr != NULL) { // match
|
||||
logMessage(LOG_DEBUG, "Programming mode: String MATCH '%s'\n", msgS2);
|
||||
if (msgS2 == message2) // match & don't care if first char
|
||||
break;
|
||||
else if (ptr == aq_data->last_message) // match & do care if first char
|
||||
|
@ -747,9 +749,9 @@ bool waitForMessage(struct aqualinkdata *aq_data, char* message, int numMessageR
|
|||
logMessage(LOG_DEBUG, "Programming mode: loop %d of %d looking for '%s' received message '%s'\n",i,numMessageReceived,message,aq_data->last_message);
|
||||
|
||||
if (message != NULL) {
|
||||
logMessage(LOG_DEBUG, "Programming mode: String MATCH\n");
|
||||
ptr = stristr(aq_data->last_message, msgS);
|
||||
if (ptr != NULL) { // match
|
||||
logMessage(LOG_DEBUG, "Programming mode: String MATCH\n");
|
||||
if (msgS == message) // match & don't care if first char
|
||||
break;
|
||||
else if (ptr == aq_data->last_message) // match & do care if first char
|
||||
|
@ -805,14 +807,14 @@ bool select_sub_menu_item(struct aqualinkdata *aq_data, char* item_string)
|
|||
int wait_messages = 25;
|
||||
int i=0;
|
||||
|
||||
while( (strstr(aq_data->last_message, item_string) == NULL) && ( i++ < wait_messages) )
|
||||
while( (stristr(aq_data->last_message, item_string) == NULL) && ( i++ < wait_messages) )
|
||||
{
|
||||
send_cmd(KEY_RIGHT, aq_data);
|
||||
waitForMessage(aq_data, NULL, 1);
|
||||
logMessage(LOG_DEBUG, "Find item in Menu: loop %d of %d looking for '%s' received message '%s'\n",i,wait_messages,item_string,aq_data->last_message);
|
||||
}
|
||||
|
||||
if (strstr(aq_data->last_message, item_string) == NULL) {
|
||||
if (stristr(aq_data->last_message, item_string) == NULL) {
|
||||
//logMessage(LOG_ERR, "Could not select SUB_MENU of Aqualink control panel\n");
|
||||
return false;
|
||||
}
|
||||
|
|
|
@ -90,6 +90,11 @@
|
|||
#define MSG_POOL_TEMP_LEN 9
|
||||
#define MSG_SPA_TEMP_LEN 8
|
||||
|
||||
#define MSG_SWG_PCT "AQUAPURE" // AquaPure 55%
|
||||
#define MSG_SWG_PPM "SALT" // Salt 3000 PPM
|
||||
#define MSG_SWG_PCT_LEN 8
|
||||
#define MSG_SWG_PPM_LEN 4
|
||||
|
||||
|
||||
|
||||
|
||||
|
|
|
@ -83,6 +83,8 @@ struct aqualinkdata
|
|||
unsigned char aq_command;
|
||||
struct programmingthread active_thread;
|
||||
struct action unactioned;
|
||||
int swg_percent;
|
||||
int swg_ppm;
|
||||
};
|
||||
|
||||
|
||||
|
|
|
@ -216,6 +216,12 @@ void processMessage(char *message)
|
|||
else if(msg[2] == '/' && msg[5] == '/' && msg[8] == ' ') {// date in format '08/29/16 MON'
|
||||
strcpy(_aqualink_data.date, msg);
|
||||
}
|
||||
else if(strncasecmp(message, MSG_SWG_PCT, MSG_SWG_PCT_LEN) == 0) {
|
||||
_aqualink_data.swg_percent = atoi(message+MSG_SWG_PCT_LEN);
|
||||
}
|
||||
else if(strncasecmp(message, MSG_SWG_PPM, MSG_SWG_PPM_LEN) == 0) {
|
||||
_aqualink_data.swg_ppm = atoi(message+MSG_SWG_PPM_LEN);
|
||||
}
|
||||
else if( (msg[1] == ':' || msg[2] == ':') && msg[strlen(msg)-1] == 'M') { // time in format '9:45 AM'
|
||||
strcpy(_aqualink_data.time, msg);
|
||||
// Setting time takes a long time, so don't try until we have all other programmed data.
|
||||
|
@ -445,6 +451,8 @@ void main_loop() {
|
|||
_aqualink_data.pool_htr_set_point = TEMP_UNKNOWN;
|
||||
_aqualink_data.spa_htr_set_point = TEMP_UNKNOWN;
|
||||
_aqualink_data.unactioned.type = NO_ACTION;
|
||||
_aqualink_data.swg_percent = TEMP_UNKNOWN;
|
||||
_aqualink_data.swg_ppm = TEMP_UNKNOWN;
|
||||
|
||||
|
||||
if (!start_net_services(&mgr, &_aqualink_data, &_config_parameters)) {
|
||||
|
|
|
@ -43,7 +43,7 @@ const char* getStatus(struct aqualinkdata *aqdata)
|
|||
return JSON_PROGRAMMING;
|
||||
}
|
||||
|
||||
if (aqdata->last_message != NULL && strstr(aqdata->last_message, "SERVICE") != NULL ) {
|
||||
if (aqdata->last_message != NULL && stristr(aqdata->last_message, "SERVICE") != NULL ) {
|
||||
return JSON_SERVICE;
|
||||
}
|
||||
|
||||
|
|
Binary file not shown.
Loading…
Reference in New Issue