PDA update

pull/42/head
sfeakes 2018-09-04 11:57:21 -05:00
parent b78ea792d3
commit c2ba23121e
8 changed files with 44 additions and 13 deletions

View File

@ -445,6 +445,23 @@ bool select_pda_main_menu(struct aqualinkdata *aq_data)
return true;
}
bool wait_pda_selected_item()
{
int i=0;
i=0;
while (pda_m_hlightindex() == -1){
if (i++ > 10)
break;
delay(100);
}
if (pda_m_hlightindex() == -1)
return false;
else
return true;
}
bool select_pda_main_menu_item(struct aqualinkdata *aq_data, pda_menu_type menu_item)
{
int i=0;
@ -464,6 +481,11 @@ bool select_pda_main_menu_item(struct aqualinkdata *aq_data, pda_menu_type menu_
else
return false;
if (!wait_pda_selected_item()){
logMessage(LOG_ERR, "PDA Device programmer didn't find a selected item\n");
return false;
}
while ( strncmp(pda_m_hlight(), menu, strlen(menu)) != 0 ) {
if (_pgm_command == NUL) {
send_cmd(KEY_PDA_DOWN, aq_data);
@ -514,14 +536,21 @@ void *set_aqualink_PDA_device_on_off( void *ptr )
cleanAndTerminateThread(threadCtrl);
return ptr;
}
/*
i=0;
while (pda_m_hlightindex() == -1){
if (i++ > 10)
break;
delay(100);
}
*/
delay(500);
printf("Wait for select\n");
if (!wait_pda_selected_item()){
logMessage(LOG_ERR, "PDA Device programmer didn't find a selected item\n");
return false;
}
printf("End wait select\n");
i=0;
int len = strlen(aq_data->aqbuttons[device].pda_label);
while ( (found = strncmp(pda_m_hlight(), aq_data->aqbuttons[device].pda_label, len)) != 0 ) {
@ -582,7 +611,7 @@ void *get_aqualink_PDA_device_status( void *ptr )
// Just loop over all the dvices 18 times should do it.
for (i=0; i < 18; i++) {
send_cmd(KEY_PDA_DOWN, aq_data);
while (_pgm_command != NUL) { delay(500); }
while (_pgm_command != NUL) { delay(100); }
}
//printf("*** GET MAIN MENU ***\n");

View File

@ -357,13 +357,13 @@ void processMessage(char *message)
// NSF Will get water temp rather than pool in some cases. not sure if it's REV specific or device (ie no spa) specific yet
else if(strncasecmp(msg, MSG_WATER_TEMP, MSG_WATER_TEMP_LEN) == 0) {
_aqualink_data.pool_temp = atoi(msg+MSG_WATER_TEMP_LEN);
_aqualink_data.spa_temp = atoi(msg+MSG_WATER_TEMP_LEN);
//_aqualink_data.spa_temp = atoi(msg+MSG_WATER_TEMP_LEN);
if (_aqualink_data.temp_units == UNKNOWN)
setUnits(msg);
}
else if(stristr(msg, LNG_MSG_WATER_TEMP_SET) != NULL) {
_aqualink_data.spa_htr_set_point = atoi(message+26);
_aqualink_data.pool_htr_set_point = atoi(message+26);
_aqualink_data.spa_htr_set_point = atoi(message+28);
_aqualink_data.pool_htr_set_point = atoi(message+28);
if (_aqualink_data.temp_units == UNKNOWN)
setUnits(msg);
@ -641,7 +641,7 @@ bool process_pda_packet(unsigned char* packet, int length)
}
//} else if (pda_m_hlightindex() == -1) { // There is a chance this is a message we are interested in.
//} else if (stristr(pda_m_line(1), "AIR") == 0) {
} else if (pda_m_type() == PM_MAIN) {
} else if (pda_m_type() == PM_MAIN || pda_m_type() == PM_BUILDING_MAIN) {
if (stristr(msg, "POOL MODE") != NULL) {
set_pda_led(_aqualink_data.aqbuttons[0].led, msg[AQ_MSGLEN-1]);
}else if (stristr(msg, "POOL HEATER") != NULL) {

View File

@ -49,7 +49,7 @@ pda_menu_type pda_m_type()
else if (strncmp(_menu[0]," MAIN MENU ", 16) == 0)
return PM_SETTINGS;
else if ((_menu[0] == '\0' && _hlightindex == -1) || strncmp(_menu[4], "POOL MODE", 9) == 0 )// IF we are building the main menu this may be valid
return PM_MAIN;
return PM_BUILDING_MAIN;
return PM_UNKNOWN;
}
@ -95,4 +95,4 @@ bool process_pda_menu_packet(unsigned char* packet, int length)
}
return rtn;
}
}

View File

@ -10,7 +10,8 @@ typedef enum pda_menu_type {
PM_MAIN,
PM_SETTINGS,
PM_EQUIPTMENT_CONTROL,
PM_EQUIPTMENT_STATUS
PM_EQUIPTMENT_STATUS,
PM_BUILDING_MAIN
} pda_menu_type;
bool pda_mode();
@ -21,4 +22,4 @@ char *pda_m_hlight();
char *pda_m_line(int index);
pda_menu_type pda_m_type();
#endif
#endif

Binary file not shown.

View File

@ -8,6 +8,7 @@ web_directory=/nas/data/Development/Raspberry/AqualinkD/web
# Log to file, comment out if you do not want to log to file
#log_file=/var/log/aqualinkd.log
#log_file=/nas/data/Development/Raspberry/AqualinkD/scratch/pda.log
# The log level. [DEBUG, INFO, NOTICE, WARNING, ERROR]
# Pick the highest level, and all levels below will be sent to syslog.
@ -132,4 +133,4 @@ button_09_PDA_label=SPA HEAT
button_12_label=Solar Heater
#button_12_dzidx=NONE
button_09_PDA_label=EXTRA AUX
button_09_PDA_label=EXTRA AUX

Binary file not shown.

View File

@ -1,4 +1,4 @@
#define AQUALINKD_NAME "Aqualink Daemon"
#define AQUALINKD_VERSION "1.2"
#define AQUALINKD_VERSION "1.2a"