mirror of https://github.com/sfeakes/AqualinkD.git
commit
28a50be715
|
@ -75,4 +75,9 @@ int PANEL_SIZE();
|
|||
void initButtons_RS16(struct aqualinkdata *aqdata);
|
||||
#endif
|
||||
|
||||
// Used in equiptment_update_cycle() for additional items on EQUIPMENT STATUS
|
||||
// TOTAL_BUTTONS is at most 20 so bits 21-31 should be available
|
||||
#define BOOST_INDEX 21
|
||||
#define FREEZE_PROTECT_INDEX 22
|
||||
|
||||
#endif
|
||||
|
|
|
@ -1027,6 +1027,7 @@ void _aq_programmer(program_type r_type, char *args, struct aqualinkdata *aq_dat
|
|||
LOG(PROG_LOG, LOG_ERR, "could not create thread\n");
|
||||
return;
|
||||
}
|
||||
break;
|
||||
#endif
|
||||
#ifdef AQ_PDA
|
||||
case AQ_PDA_INIT:
|
||||
|
@ -1381,10 +1382,9 @@ void *set_aqualink_SWG( void *ptr )
|
|||
|
||||
#ifdef AQ_PDA
|
||||
if (isPDA_PANEL) {
|
||||
if (set_PDA_aqualink_SWG_setpoint(aq_data, val))
|
||||
setSWGpercent(aq_data, val); // Don't use chageSWGpercent as we are in programming mode.
|
||||
cleanAndTerminateThread(threadCtrl);
|
||||
return ptr;
|
||||
set_PDA_aqualink_SWG_setpoint(aq_data, val);
|
||||
cleanAndTerminateThread(threadCtrl);
|
||||
return ptr;
|
||||
}
|
||||
#endif
|
||||
|
||||
|
|
|
@ -998,7 +998,7 @@ void action_delayed_request()
|
|||
{
|
||||
//LOG(AQUA_LOG,LOG_NOTICE, "SWG BOST to %d\n", _aqualink_data.unactioned.value);
|
||||
//if (_aqualink_data.ar_swg_status == SWG_STATUS_OFF) {
|
||||
if (_aqualink_data.swg_led_state == OFF) {
|
||||
if ((_aqualink_data.swg_led_state == OFF) && (_aqualink_data.boost == false)) {
|
||||
LOG(AQUA_LOG,LOG_ERR, "SWG is off, can't Boost pool\n");
|
||||
} else if (_aqualink_data.unactioned.value == _aqualink_data.boost ) {
|
||||
LOG(AQUA_LOG,LOG_ERR, "Request to turn Boost %s ignored, Boost is already %s\n",_aqualink_data.unactioned.value?"On":"Off", _aqualink_data.boost?"On":"Off");
|
||||
|
|
|
@ -109,6 +109,13 @@ bool processPacketToSWG(unsigned char *packet, int packet_length, struct aqualin
|
|||
static int swg_zero_cnt = 0;
|
||||
bool changedAnything = false;
|
||||
|
||||
if (getLogLevel(DJAN_LOG) == LOG_DEBUG) {
|
||||
char buff[1024];
|
||||
beautifyPacket(buff, packet, packet_length, false);
|
||||
LOG(DJAN_LOG,LOG_DEBUG, "%s", buff);
|
||||
}
|
||||
|
||||
|
||||
// Only read message from controller to SWG to set SWG Percent if we are not programming, as we might be changing this
|
||||
if (packet[3] == CMD_PERCENT && aqdata->active_thread.thread_id == 0 && packet[4] != 0xFF) {
|
||||
// In service or timeout mode SWG set % message is very strange. AR %% | HEX: 0x10|0x02|0x50|0x11|0xff|0x72|0x10|0x03|
|
||||
|
@ -154,6 +161,12 @@ bool processPacketFromSWG(unsigned char *packet, int packet_length, struct aqual
|
|||
bool changedAnything = false;
|
||||
_swg_noreply_cnt = 0;
|
||||
|
||||
if (getLogLevel(DJAN_LOG) == LOG_DEBUG) {
|
||||
char buff[1024];
|
||||
beautifyPacket(buff, packet, packet_length, true);
|
||||
LOG(DJAN_LOG,LOG_DEBUG, "%s", buff);
|
||||
}
|
||||
|
||||
if (packet[PKT_CMD] == CMD_PPM) {
|
||||
//aqdata->ar_swg_device_status = packet[5];
|
||||
setSWGdeviceStatus(aqdata, JANDY_DEVICE, packet[5]);
|
||||
|
@ -206,10 +219,13 @@ bool isSWGDeviceErrorState(unsigned char status)
|
|||
}
|
||||
|
||||
void setSWGdeviceStatus(struct aqualinkdata *aqdata, emulation_type requester, unsigned char status) {
|
||||
if (aqdata->ar_swg_device_status == status) {
|
||||
static unsigned char last_status = SWG_STATUS_UNKNOWN;
|
||||
|
||||
if ((aqdata->ar_swg_device_status == status) || (last_status == status)) {
|
||||
//LOG(DJAN_LOG, LOG_DEBUG, "Set SWG device state to '0x%02hhx', request from %d\n", aqdata->ar_swg_device_status, requester);
|
||||
return;
|
||||
}
|
||||
last_status = status;
|
||||
|
||||
// If we get (ALLBUTTON, SWG_STATUS_CHECK_PCB), it sends this for many status, like clean cell.
|
||||
// So if we are in one of those states, don't use it.
|
||||
|
@ -278,6 +294,7 @@ bool setSWGboost(struct aqualinkdata *aqdata, bool on) {
|
|||
} else {
|
||||
aqdata->boost = true;
|
||||
aqdata->swg_percent = 101;
|
||||
aqdata->swg_led_state = ON;
|
||||
}
|
||||
|
||||
return true;
|
||||
|
|
117
pda.c
117
pda.c
|
@ -133,27 +133,57 @@ void set_pda_led(struct aqualinkled *led, char state)
|
|||
}
|
||||
}
|
||||
|
||||
// :TODO: Test what happens if there are more devices on than can fit on the status page
|
||||
// :TODO: If web page is up PDA will not sleep therefore there is no wake and seeing
|
||||
// the equipment page. Need to add support for determining filter pump on/off based on home
|
||||
void equiptment_update_cycle(int eqID) {
|
||||
// If you have a -1, it's a reset to clear / update information.
|
||||
// TOTAL_BUTTONS is 20 so bits 21-31 available for BOOST, FREEZE PROTECT, etc.
|
||||
int i;
|
||||
static uint32_t update_equiptment_bitmask = 0;
|
||||
|
||||
if (eqID == -1) {
|
||||
LOG(PDA_LOG,LOG_DEBUG, "Start new equiptment cycle\n");
|
||||
LOG(PDA_LOG,LOG_DEBUG, "Start new equipment cycle bitmask 0x%04x\n",
|
||||
update_equiptment_bitmask);
|
||||
|
||||
for (i=0; i < _aqualink_data->total_buttons - 2 ; i++) { // total_buttons - 2 because we don't get heaters in this cycle
|
||||
if ((update_equiptment_bitmask & (1 << (i+1))) != (1 << (i+1))) {
|
||||
if ((update_equiptment_bitmask & (1 << (i))) != (1 << (i))) {
|
||||
if (_aqualink_data->aqbuttons[i].led->state != OFF) {
|
||||
_aqualink_data->aqbuttons[i].led->state = OFF;
|
||||
_aqualink_data->updated = true;
|
||||
LOG(PDA_LOG,LOG_DEBUG, "Turn off equiptment id %d %s not seen in last cycle\n", i, _aqualink_data->aqbuttons[i].name);
|
||||
LOG(PDA_LOG,LOG_DEBUG, "Turn off equipment id %d %s not seen in last cycle\n", i, _aqualink_data->aqbuttons[i].name);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if ((_aqualink_data->frz_protect_state == ON) &&
|
||||
(! (update_equiptment_bitmask & (1 << FREEZE_PROTECT_INDEX)))) {
|
||||
LOG(PDA_LOG,LOG_DEBUG, "Turn off freeze protect not seen in last cycle\n");
|
||||
_aqualink_data->frz_protect_state = ENABLE;
|
||||
}
|
||||
|
||||
if ((_aqualink_data->boost) &&
|
||||
(! (update_equiptment_bitmask & (1 << BOOST_INDEX)))) {
|
||||
LOG(PDA_LOG,LOG_DEBUG, "Turn off BOOST not seen in last cycle\n");
|
||||
setSWGboost(_aqualink_data, false);
|
||||
}
|
||||
update_equiptment_bitmask = 0;
|
||||
} else if ((eqID >= 0) && (eqID < 32)) {
|
||||
update_equiptment_bitmask |= (1 << (eqID));
|
||||
char *eqName = NULL;
|
||||
if (eqID < TOTAL_BUTTONS) {
|
||||
eqName = _aqualink_data->aqbuttons[eqID].name;
|
||||
} else if (eqID == FREEZE_PROTECT_INDEX) {
|
||||
eqName = "FREEZE PROTECT";
|
||||
} else if (eqID == BOOST_INDEX) {
|
||||
eqName = "BOOST";
|
||||
} else {
|
||||
eqName = "UNKNOWN";
|
||||
}
|
||||
LOG(PDA_LOG,LOG_DEBUG, "Added equipment id %d %s to updated cycle bitmask 0x%04x\n",
|
||||
eqID, eqName, update_equiptment_bitmask);
|
||||
} else {
|
||||
update_equiptment_bitmask |= (1 << (eqID+1));
|
||||
LOG(PDA_LOG,LOG_DEBUG, "Added equiptment id %d %s to updated cycle\n", eqID, _aqualink_data->aqbuttons[eqID].name);
|
||||
LOG(PDA_LOG,LOG_ERR, "equiptment_update_cycle(%d) - Invalid eqID\n", eqID);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -237,14 +267,13 @@ void process_pda_packet_msg_long_equipment_control(const char *msg)
|
|||
{
|
||||
LOG(PDA_LOG,LOG_DEBUG, "*** Found EQ CTL Status for %s = '%.*s'\n", _aqualink_data->aqbuttons[i].label, AQ_MSGLEN, msg);
|
||||
set_pda_led(_aqualink_data->aqbuttons[i].led, msg[AQ_MSGLEN - 1]);
|
||||
// Force SWG off if pump is off.
|
||||
if ((i==0) && (_aqualink_data->aqbuttons[0].led->state == OFF )) {
|
||||
setSWGoff(_aqualink_data);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Force SWG off if pump is off.
|
||||
if (_aqualink_data->aqbuttons[0].led->state == OFF )
|
||||
setSWGoff(_aqualink_data);
|
||||
//_aqualink_data->ar_swg_status = SWG_STATUS_OFF;
|
||||
|
||||
// NSF I think we need to check TEMP1 and TEMP2 and set Pool HEater and Spa heater directly, to support single device.
|
||||
if (isSINGLE_DEV_PANEL){
|
||||
if (strcasecmp(stripwhitespace(labelBuff), "TEMP1") == 0)
|
||||
|
@ -389,29 +418,43 @@ void process_pda_packet_msg_long_freeze_protect(const char *msg)
|
|||
}
|
||||
}
|
||||
|
||||
void process_pda_packet_msg_long_SWG(const char *msg)
|
||||
void process_pda_packet_msg_long_SWG(int index, const char *msg)
|
||||
{
|
||||
//PDA Line 0 = SET AquaPure
|
||||
//PDA Line 1 =
|
||||
//PDA Line 2 =
|
||||
//PDA Line 3 = SET POOL TO: 45%
|
||||
//PDA Line 4 = SET SPA TO: 0%
|
||||
char *ptr = NULL;
|
||||
// Single Setpoint
|
||||
// PDA Line 0 = SET AquaPure
|
||||
// PDA Line 1 =
|
||||
// PDA Line 2 =
|
||||
// PDA Line 3 = SET TO 100%
|
||||
|
||||
// If spa is on, read SWG for spa, if not set SWG for pool
|
||||
if (_aqualink_data->aqbuttons[SPA_INDEX].led->state != OFF) {
|
||||
if (strncasecmp(msg, "SET SPA TO:", 11) == 0)
|
||||
{
|
||||
//_aqualink_data->swg_percent = atoi(msg + 13);
|
||||
setSWGpercent(_aqualink_data, atoi(msg + 13));
|
||||
// PDA Line 0 = SET AquaPure
|
||||
// PDA Line 1 =
|
||||
// PDA Line 2 =
|
||||
// PDA Line 3 = SET TO: 20%
|
||||
|
||||
// Dual Setpoint
|
||||
// PDA Line 0 = SET AquaPure
|
||||
// PDA Line 1 =
|
||||
// PDA Line 2 =
|
||||
// PDA Line 3 = SET POOL TO: 45%
|
||||
// PDA Line 4 = SET SPA TO: 0%
|
||||
|
||||
// Note: use pda_m_line(index) instead of msg because it is NULL terminated
|
||||
if ((ptr = strcasestr(pda_m_line(index), "SET TO")) != NULL) {
|
||||
setSWGpercent(_aqualink_data, atoi(ptr+7));
|
||||
LOG(PDA_LOG,LOG_DEBUG, "swg_percent = %d\n", _aqualink_data->swg_percent);
|
||||
} else if ((ptr = strcasestr(pda_m_line(index), "SET SPA TO")) != NULL) {
|
||||
if (_aqualink_data->aqbuttons[SPA_INDEX].led->state != OFF) {
|
||||
setSWGpercent(_aqualink_data, atoi(ptr+11));
|
||||
LOG(PDA_LOG,LOG_DEBUG, "SPA swg_percent = %d\n", _aqualink_data->swg_percent);
|
||||
}
|
||||
} else {
|
||||
if (strncasecmp(msg, "SET POOL TO:", 12) == 0)
|
||||
{
|
||||
//_aqualink_data->swg_percent = atoi(msg + 13);
|
||||
setSWGpercent(_aqualink_data, atoi(msg + 13));
|
||||
} else if ((ptr = strcasestr(pda_m_line(index), "SET POOL TO")) != NULL) {
|
||||
if (_aqualink_data->aqbuttons[SPA_INDEX].led->state == OFF) {
|
||||
setSWGpercent(_aqualink_data, atoi(ptr + 12));
|
||||
LOG(PDA_LOG,LOG_DEBUG, "POOL swg_percent = %d\n", _aqualink_data->swg_percent);
|
||||
}
|
||||
}
|
||||
} else if (index == 3) {
|
||||
LOG(PDA_LOG,LOG_ERR, "process msg SWG POOL idx %d unmatched %s\n", index, pda_m_line(index));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -606,6 +649,12 @@ void process_pda_packet_msg_long_equiptment_status(const char *msg_line, int lin
|
|||
// FILTER PUMP
|
||||
// CLEANER
|
||||
//
|
||||
// EQUIPMENT STATUS
|
||||
//
|
||||
// BOOST
|
||||
// 23:59 REMAIN
|
||||
// SALT 25500 PPM
|
||||
// FILTER PUMP
|
||||
|
||||
// VSP Pumps are not read here, since they are over multiple lines.
|
||||
|
||||
|
@ -619,8 +668,18 @@ void process_pda_packet_msg_long_equiptment_status(const char *msg_line, int lin
|
|||
else if ((index = rsm_strncasestr(msg, "FREEZE PROTECT", AQ_MSGLEN)) != NULL)
|
||||
{
|
||||
_aqualink_data->frz_protect_state = ON;
|
||||
equiptment_update_cycle(FREEZE_PROTECT_INDEX);
|
||||
LOG(PDA_LOG,LOG_DEBUG, "Freeze Protect is on\n");
|
||||
}
|
||||
else if ((index = rsm_strncasestr(msg, "BOOST", AQ_MSGLEN)) != NULL)
|
||||
{
|
||||
setSWGboost(_aqualink_data, true);
|
||||
equiptment_update_cycle(BOOST_INDEX);
|
||||
}
|
||||
else if ((_aqualink_data->boost) && ((index = rsm_strncasestr(msg, "REMAIN", AQ_MSGLEN)) != NULL))
|
||||
{
|
||||
snprintf(_aqualink_data->boost_msg, sizeof(_aqualink_data->boost_msg), "%s", msg+2);
|
||||
}
|
||||
else if ((index = rsm_strncasestr(msg, MSG_SWG_PCT, AQ_MSGLEN)) != NULL)
|
||||
{
|
||||
changeSWGpercent(_aqualink_data, atoi(index + strlen(MSG_SWG_PCT)));
|
||||
|
@ -833,7 +892,7 @@ bool process_pda_packet(unsigned char *packet, int length)
|
|||
process_pda_packet_msg_long_freeze_protect(msg);
|
||||
break;
|
||||
case PM_AQUAPURE:
|
||||
process_pda_packet_msg_long_SWG(msg);
|
||||
process_pda_packet_msg_long_SWG(index, msg);
|
||||
break;
|
||||
case PM_AUX_LABEL_DEVICE:
|
||||
process_pda_packet_msg_long_level_aux_device(msg);
|
||||
|
|
|
@ -163,6 +163,7 @@ bool find_pda_menu_item(struct aqualinkdata *aq_data, char *menuText, int charli
|
|||
int max_index = -1;
|
||||
int index = -1;
|
||||
int cnt = 0;
|
||||
bool bLookingForBoost = false;
|
||||
|
||||
LOG(PDA_LOG,LOG_DEBUG, "PDA Device programmer looking for menu text '%s' (limit=%d)\n",menuText,charlimit);
|
||||
|
||||
|
@ -202,51 +203,83 @@ bool find_pda_menu_item(struct aqualinkdata *aq_data, char *menuText, int charli
|
|||
}
|
||||
|
||||
if (strncasecmp(pda_m_line(9)," ^^ MORE", 10) != 0) {
|
||||
if (pda_m_type() == PM_HOME) {
|
||||
min_index = 4;
|
||||
max_index = 9;
|
||||
} else if (pda_m_type() == PM_EQUIPTMENT_CONTROL) {
|
||||
min_index = 1;
|
||||
max_index = 9;
|
||||
} else if (pda_m_type() == PM_MAIN) {
|
||||
// Line 0 = MAIN MENU
|
||||
// Line 1 =
|
||||
// Line 2 = HELP >
|
||||
// Line 3 = PROGRAM >
|
||||
// Line 4 = SET TEMP >
|
||||
// Line 5 = SET TIME >
|
||||
// Line 6 = PDA OPTIONS >
|
||||
// Line 7 = SYSTEM SETUP >
|
||||
// Line 8 =
|
||||
// Line 9 =
|
||||
if (pda_m_type() == PM_HOME) {
|
||||
min_index = 4;
|
||||
max_index = 9;
|
||||
} else if (pda_m_type() == PM_EQUIPTMENT_CONTROL) {
|
||||
min_index = 1;
|
||||
max_index = 9;
|
||||
} else if (pda_m_type() == PM_MAIN) {
|
||||
// Line 0 = MAIN MENU
|
||||
// Line 1 =
|
||||
// Line 2 = HELP >
|
||||
// Line 3 = PROGRAM >
|
||||
// Line 4 = SET TEMP >
|
||||
// Line 5 = SET TIME >
|
||||
// Line 6 = PDA OPTIONS >
|
||||
// Line 7 = SYSTEM SETUP >
|
||||
// Line 8 =
|
||||
// Line 9 =
|
||||
|
||||
// Line 0 = MAIN MENU
|
||||
// Line 1 = HELP >
|
||||
// Line 2 = PROGRAM >
|
||||
// Line 3 = SET TEMP >
|
||||
// Line 4 = SET TIME >
|
||||
// Line 5 = SET AquaPure >
|
||||
// Line 6 = PDA OPTIONS >
|
||||
// Line 7 = SYSTEM SETUP >
|
||||
// Line 8 =
|
||||
// Line 9 = BOOST
|
||||
// Line 0 = MAIN MENU
|
||||
// Line 1 = HELP >
|
||||
// Line 2 = PROGRAM >
|
||||
// Line 3 = SET TEMP >
|
||||
// Line 4 = SET TIME >
|
||||
// Line 5 = SET AquaPure >
|
||||
// Line 6 = PDA OPTIONS >
|
||||
// Line 7 = SYSTEM SETUP >
|
||||
// Line 8 =
|
||||
// Line 9 = BOOST
|
||||
|
||||
// "SET AquaPure" and "BOOST" are only present when filter pump is running
|
||||
if (strncasecmp(pda_m_line(9)," BOOST ", 16) == 0) {
|
||||
min_index = 1;
|
||||
max_index = 8; // to account for 8 missing
|
||||
if (index == 9) { // looking for boost
|
||||
index = 8;
|
||||
}
|
||||
} else {
|
||||
min_index = 2;
|
||||
max_index = 7;
|
||||
// "SET AquaPure" and "BOOST" are only present when filter pump is running
|
||||
if (strncasecmp(pda_m_line(9)," BOOST ", 16) == 0) {
|
||||
min_index = 1;
|
||||
max_index = 8; // to account for 8 missing
|
||||
if (index == 9) { // looking for boost
|
||||
bLookingForBoost = true;
|
||||
index = 8;
|
||||
}
|
||||
} else {
|
||||
min_index = 2;
|
||||
max_index = 7;
|
||||
}
|
||||
} else if (pda_m_type() == PM_BOOST) {
|
||||
// PDA Line 0 = BOOST
|
||||
// PDA Line 1 =
|
||||
// PDA Line 2 = Operate the
|
||||
// PDA Line 3 = AquaPure
|
||||
// PDA Line 4 = chlorinator
|
||||
// PDA Line 5 = at 100%
|
||||
// PDA Line 6 = for 24 hrs.
|
||||
// PDA Line 7 =
|
||||
// PDA Line 8 = START
|
||||
// PDA Line 9 = GO BACK
|
||||
|
||||
// PDA Line 0 = BOOST
|
||||
// PDA Line 1 =
|
||||
// PDA Line 2 =
|
||||
// PDA Line 3 = TIME REMAINING
|
||||
// PDA Line 4 = 23:59
|
||||
// PDA Line 5 =
|
||||
// PDA Line 6 =
|
||||
// PDA Line 7 = PAUSE
|
||||
// PDA Line 8 = RESTART
|
||||
// PDA Line 9 = STOP
|
||||
|
||||
if (strncasecmp(pda_m_line(9)," STOP", 10) == 0) {
|
||||
min_index = 7;
|
||||
max_index = 9;
|
||||
} else {
|
||||
min_index = 8;
|
||||
max_index = 9;
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
LOG(PDA_LOG,LOG_DEBUG, "find_pda_menu_item i=%d idx=%d min=%d max=%d\n",
|
||||
i, index, min_index, max_index);
|
||||
LOG(PDA_LOG,LOG_DEBUG, "find_pda_menu_item i=%d idx=%d min=%d max=%d boost=%d\n",
|
||||
i, index, min_index, max_index, bLookingForBoost?1:0);
|
||||
|
||||
if (i < index) {
|
||||
if ((min_index != -1) && ((index - i) > (i - min_index + max_index - index + 1))) {
|
||||
|
@ -275,8 +308,7 @@ bool find_pda_menu_item(struct aqualinkdata *aq_data, char *menuText, int charli
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
return waitForPDAMessageHighlight(aq_data, index, 10);
|
||||
return waitForPDAMessageHighlight(aq_data, bLookingForBoost?9:index, 10);
|
||||
}
|
||||
|
||||
bool _select_pda_menu_item(struct aqualinkdata *aq_data, char *menuText, bool waitForNextMenu, bool loose);
|
||||
|
@ -415,7 +447,7 @@ bool goto_pda_menu(struct aqualinkdata *aq_data, pda_menu_type menu) {
|
|||
if (pda_m_type() == PM_HOME) {
|
||||
ret = select_pda_menu_item(aq_data, "MENU", true);
|
||||
} else if (pda_m_type() == PM_MAIN) {
|
||||
ret = select_pda_menu_item_loose(aq_data, "BOOST", true);
|
||||
ret = select_pda_menu_item_loose(aq_data, " BOOST", true);
|
||||
} else {
|
||||
send_cmd(KEY_PDA_BACK);
|
||||
ret = waitForPDAnextMenu(aq_data);
|
||||
|
@ -815,31 +847,17 @@ bool waitForPDAMessageTypes(struct aqualinkdata *aq_data, unsigned char mtype1,
|
|||
}
|
||||
|
||||
/*
|
||||
Use -1 for cur_val if you want this to find the delected value and change it.
|
||||
Use -1 for cur_val if you want this to find the current value and change it.
|
||||
Use number for cur_val to increase / decrease from known start point
|
||||
*/
|
||||
bool set_PDA_numeric_field_value(struct aqualinkdata *aq_data, int val, int cur_val, char *select_label, int step) {
|
||||
int i=0;
|
||||
|
||||
LOG(PDA_LOG,LOG_DEBUG, "set_PDA_numeric_field_value %s from %d to %d step %d\n", select_label, cur_val, val, step);
|
||||
if (select_label != NULL) {
|
||||
// :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
|
||||
//while ( strncasecmp(pda_m_hlight(), select_label, 8) != 0 ) {
|
||||
//while ( strncasecmp(pda_m_hlight(), select_label, strlen(select_label)) != 0 ) {
|
||||
while ( rsm_strncmp(pda_m_hlight(), select_label, strlen(select_label)) != 0 ) {
|
||||
LOG(PDA_LOG,LOG_DEBUG, "Numeric selector selecting '%s' current selection '%s'\n", select_label, pda_m_hlight());
|
||||
send_cmd(KEY_PDA_DOWN);
|
||||
//delay(500); // Last message probably was CMD_PDA_HIGHLIGHT, so wait before checking.
|
||||
waitfor_queue2empty();
|
||||
waitForPDAMessageType(aq_data,CMD_PDA_HIGHLIGHT,5);
|
||||
if (i > 10) {
|
||||
LOG(PDA_LOG,LOG_ERR, "Numeric selector could not find string '%s'\n", select_label);
|
||||
return false;
|
||||
}
|
||||
i++;
|
||||
if ( ! select_pda_menu_item(aq_data, select_label, false) ) {
|
||||
return false;
|
||||
}
|
||||
LOG(PDA_LOG,LOG_DEBUG, "Numeric selector, selecting '%s'\n", pda_m_hlight());
|
||||
send_cmd(KEY_PDA_SELECT);
|
||||
}
|
||||
|
||||
if (cur_val == -1) {
|
||||
|
@ -888,15 +906,21 @@ bool set_PDA_aqualink_SWG_setpoint(struct aqualinkdata *aq_data, int val) {
|
|||
LOG(PDA_LOG,LOG_ERR, "Error finding SWG setpoints menu\n");
|
||||
return false;
|
||||
}
|
||||
// wait for menu to display to capture current value with process_pda_packet_msg_long_SWG
|
||||
waitForPDAMessageTypes(aq_data,CMD_PDA_HIGHLIGHT,CMD_PDA_HIGHLIGHTCHARS, 10);
|
||||
|
||||
if (aq_data->aqbuttons[SPA_INDEX].led->state != OFF) {
|
||||
//int cur_val = atoi
|
||||
if (pda_find_m_index("SET POOL") < 0) {
|
||||
// Single Setpoint Screen
|
||||
return set_PDA_numeric_field_value(aq_data, val, -1, NULL, 5);
|
||||
} else if (aq_data->aqbuttons[SPA_INDEX].led->state != OFF) {
|
||||
// Dual Setpoint Screen with SPA mode enabled
|
||||
// :TODO: aq_data should have 2 swg_precent values and GUI should be updated to
|
||||
// display and modify both values.
|
||||
return set_PDA_numeric_field_value(aq_data, val, -1, "SET SPA", 5);
|
||||
} else {
|
||||
// Dual Setpoint Screen with SPA mode disabled
|
||||
return set_PDA_numeric_field_value(aq_data, val, -1, "SET POOL", 5);
|
||||
}
|
||||
|
||||
//return true;
|
||||
}
|
||||
|
||||
bool set_PDA_aqualink_boost(struct aqualinkdata *aq_data, bool val)
|
||||
|
@ -905,38 +929,22 @@ bool set_PDA_aqualink_boost(struct aqualinkdata *aq_data, bool val)
|
|||
LOG(PDA_LOG,LOG_ERR, "Error finding BOOST menu\n");
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
|
||||
// Should be on the START menu item
|
||||
if (val == true) { // Turn on should just be enter
|
||||
if (strstr(pda_m_hlight(), "START") != NULL)
|
||||
send_cmd(KEY_PDA_SELECT);
|
||||
else {
|
||||
LOG(PDA_LOG,LOG_ERR, "Error finding BOOST START menu\n");
|
||||
return false;
|
||||
}
|
||||
select_pda_menu_item_loose(aq_data, "START", false);
|
||||
} else {
|
||||
/*
|
||||
// Should be select options PAUSE | RESTART | STOP
|
||||
int i=0;
|
||||
for (i=0; i < 6; i++) {
|
||||
send_cmd(KEY_PDA_DOWN);
|
||||
waitForPDAMessageTypes(aq_data,CMD_PDA_HIGHLIGHT,CMD_PDA_HIGHLIGHTCHARS,10);
|
||||
if (strstr(pda_m_hlight(), "STOP") != NULL) {
|
||||
send_cmd(KEY_PDA_SELECT);
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (i >= 6)
|
||||
LOG(PDA_LOG,LOG_ERR, "Error finding BOOST STOP menu\n");
|
||||
// Should be select options PAUSE | RESTART | STOP
|
||||
// so press down twice then select
|
||||
*/
|
||||
// NSF This is really crap, but can't get above to work, need to come back and check menu items against selections.
|
||||
send_cmd(KEY_PDA_DOWN);
|
||||
send_cmd(KEY_PDA_DOWN);
|
||||
send_cmd(KEY_PDA_SELECT);
|
||||
// PDA Line 0 = BOOST
|
||||
// PDA Line 1 =
|
||||
// PDA Line 2 =
|
||||
// PDA Line 3 = TIME REMAINING
|
||||
// PDA Line 4 = 23:59
|
||||
// PDA Line 5 =
|
||||
// PDA Line 6 =
|
||||
// PDA Line 7 = PAUSE
|
||||
// PDA Line 8 = RESTART
|
||||
// PDA Line 9 = STOP
|
||||
|
||||
select_pda_menu_item_loose(aq_data, "STOP", false);
|
||||
}
|
||||
|
||||
return true;
|
||||
|
@ -1206,16 +1214,31 @@ PDA Line 7 = BOOST POOL
|
|||
PDA Line 8 =
|
||||
PDA Line 9 =
|
||||
**************** OPTION 2 FOR THIS MENU ********************
|
||||
PDA Line 0 = MAIN MENU
|
||||
PDA Line 1 =
|
||||
PDA Line 2 = HELP >
|
||||
PDA Line 3 = PROGRAM >
|
||||
PDA Line 4 = SET TEMP >
|
||||
PDA Line 5 = SET TIME >
|
||||
PDA Line 6 = PDA OPTIONS >
|
||||
PDA Line 7 = SYSTEM SETUP >
|
||||
|
||||
PDA Line 0 = MAIN MENU
|
||||
PDA Line 1 = HELP >
|
||||
PDA Line 2 = PROGRAM >
|
||||
PDA Line 3 = SET TEMP >
|
||||
PDA Line 4 = SET TIME >
|
||||
PDA Line 5 = SET AquaPure >
|
||||
PDA Line 6 = PDA OPTIONS >
|
||||
PDA Line 7 = SYSTEM SETUP >
|
||||
PDA Line 8 =
|
||||
PDA Line 9 = BOOST
|
||||
PDA Line 9 = BOOST
|
||||
|
||||
|
||||
PDA Line 0 = BOOST
|
||||
PDA Line 1 =
|
||||
PDA Line 2 = Operate the
|
||||
PDA Line 3 = AquaPure
|
||||
PDA Line 4 = chlorinator
|
||||
PDA Line 5 = at 100%
|
||||
PDA Line 6 = for 24 hrs.
|
||||
PDA Line 7 =
|
||||
PDA Line 8 = START
|
||||
PDA Line 9 = GO BACK
|
||||
|
||||
|
||||
********** Guess at SYSTEM SETUP Menu (not on Rev MMM or before)************
|
||||
// PDA Line 0 = SYSTEM SETUP
|
||||
// PDA Line 1 = LABEL AUX >
|
||||
|
|
12
pda_menu.c
12
pda_menu.c
|
@ -238,7 +238,12 @@ bool process_pda_menu_packet(unsigned char* packet, int length, bool force_print
|
|||
strncpy(_menu[index], (char*)packet+PKT_DATA+1, AQ_MSGLEN);
|
||||
_menu[index][AQ_MSGLEN] = '\0';
|
||||
}
|
||||
if (getLogLevel(PDA_LOG) >= LOG_DEBUG && force_print_menu ){print_menu();}
|
||||
if ((getLogLevel(PDA_LOG) >= LOG_DEBUG) && force_print_menu ){
|
||||
print_menu();
|
||||
printed_page = true;
|
||||
} else {
|
||||
printed_page = false;
|
||||
}
|
||||
break;
|
||||
case CMD_PDA_HIGHLIGHT:
|
||||
// when switching from hlight to hlightchars index 255 is sent to turn off hlight
|
||||
|
@ -252,7 +257,10 @@ bool process_pda_menu_packet(unsigned char* packet, int length, bool force_print
|
|||
_hlightcharindexstop = -1;
|
||||
}
|
||||
//if (getLogLevel(PDA_LOG) >= LOG_DEBUG){print_menu();}
|
||||
if (getLogLevel(PDA_LOG) >= LOG_DEBUG && force_print_menu ){print_menu();}
|
||||
if (getLogLevel(PDA_LOG) >= LOG_DEBUG && force_print_menu ){
|
||||
print_menu();
|
||||
printed_page = true;
|
||||
}
|
||||
break;
|
||||
case CMD_PDA_HIGHLIGHTCHARS:
|
||||
// pkt[4] = line, pkt[5] = startchar, pkt[6] = endchar, pkt[7] = clr/inv
|
||||
|
|
Loading…
Reference in New Issue