pull/42/head
sfeakes 2018-08-02 12:18:33 -05:00
parent cde3585176
commit 9f1bcb0640
5 changed files with 47 additions and 101 deletions

View File

@ -38,7 +38,7 @@
/* ACK RETURN COMMANDS */
#define ACK_NORMAL 0x00
#define ACK_SCREEN_BUSY 0x01 // Seems to be busy but can cache a message,
#define ACK_SCREEN_BUSY_DISPLAY 0x03 // Seems to be don't send me shit.
#define ACK_SCREEN_BUSY_BLOCK 0x03 // Seems to be don't send me shit.
/* AquaRite commands */
#define CMD_GETID 0x14 // May be remote control control

View File

@ -800,7 +800,40 @@ void main_loop() {
// **** NSF (Taken out while playing with Panel Simulator, put back in. ************)
// send_ack(rs_fd, pop_aq_cmd(&_aqualink_data));
#define MAX_BLOCK_ACK 12
#define MAX_BUSY_ACK (50 + MAX_BLOCK_ACK)
// Wrap the mess just for sanity, the pre-process will clean it up.
if (! _aqualink_data.simulate_panel ||
_aqualink_data.active_thread.thread_id != 0)
{
send_ack(rs_fd, pop_aq_cmd(&_aqualink_data));
} else { // We are in simlator mode, ack get's complicated now.
// If have a command to send, send a normal ack.
// If we last message is waiting for an input "SELECT xxxxx", then sent a pause ack
// pause ack strarts with around 12 ACK_SCREEN_BUSY_DISPLAY acks, then 50 ACK_SCREEN_BUSY acks
// if we send a command (ie keypress), the whole count needs to end and go back to sending normal ack.
// In code below, it jumps to sending ACK_SCREEN_BUSY, which still seems to work ok.
if ( strncasecmp(_aqualink_data.last_display_message, "SELECT", 6) != 0)
{ // Nothing to wait for, send normal ack.
send_ack(rs_fd, pop_aq_cmd(&_aqualink_data));
delayAckCnt = 0;
} else if ( get_aq_cmd_length() > 0 ) {
// Send command and jump directly "busy but can receive message"
send_ack(rs_fd, pop_aq_cmd(&_aqualink_data));
delayAckCnt = MAX_BUSY_ACK; // need to test jumping to MAX_BUSY_ACK here
} else {
logMessage(LOG_NOTICE, "Sending display busy due to Simulator mode \n");
if (delayAckCnt < MAX_BLOCK_ACK) // block all incomming messages
send_extended_ack(rs_fd, ACK_SCREEN_BUSY_BLOCK, pop_aq_cmd(&_aqualink_data));
else if (delayAckCnt < MAX_BUSY_ACK) // say we are pausing
send_extended_ack(rs_fd, ACK_SCREEN_BUSY, pop_aq_cmd(&_aqualink_data));
else // We timed out pause, send normal ack (This should also reset the display message on next message received)
send_ack(rs_fd, pop_aq_cmd(&_aqualink_data));
delayAckCnt++;
}
}
/*
// Wrap the mess just for sanity, the pre-process will clean it up.
if (! _aqualink_data.simulate_panel ) {
send_ack(rs_fd, pop_aq_cmd(&_aqualink_data));
@ -836,7 +869,7 @@ void main_loop() {
delayAckCnt++;
}
}
*/
// Process the packet. This includes deriving general status, and identifying
// warnings and errors. If something changed, notify any listeners
if (process_packet(packet_buffer, packet_length) != false) {

View File

@ -781,7 +781,7 @@ void action_mqtt_message(struct mg_connection *nc, struct mg_mqtt_message *msg)
//aqualinkd/SWG/Percent_f/set
if (pt3 != NULL && (strncmp(pt2, "setpoint", 8) == 0) && (strncmp(pt3, "set", 3) == 0)) {
int val = _aqualink_data->unactioned.value = (_aqualink_data->temp_units == FAHRENHEIT) ? round(degCtoF(value)) : round(value);
int val = _aqualink_data->unactioned.value = (_aqualink_data->temp_units == FAHRENHEIT && _aqualink_config->convert_mqtt_temp) ? round(degCtoF(value)) : round(value);
if (strncmp(pt1, BTN_POOL_HTR, strlen(BTN_POOL_HTR)) == 0) {
if (val <= HEATER_MAX && val >= MEATER_MIN) {
logMessage(LOG_INFO, "MQTT: request to set pool heater setpoint to %.2fc\n", value);

Binary file not shown.

View File

@ -26,6 +26,8 @@
--slide-range-height: 16px;
--slide-range-bordercolor: #dddddd;
--options-background: #f1f1f1;
--error_background: rgb(143, 43, 43);
--error_text: rgb(255, 255, 255);
}
@ -72,98 +74,6 @@
.input-text {
font-size: 16px;
}
/*
.btn-toggle {
position: absolute;
margin-left: -9999px;
visibility: hidden;
}
.btn-toggle+label {
display: block;
position: relative;
cursor: pointer;
outline: none;
user-select: none;
}
input.btn-toggle-round+label {
padding: 2px;
width: calc(2 * var(--diameter));
height: var(--diameter);
background-color: #dddddd;
border-radius: var(--diameter);
}
input.btn-toggle-round+label:before,
input.btn-toggle-round+label:after {
display: block;
position: absolute;
top: 1px;
left: 1px;
bottom: 1px;
content: '';
}
input.btn-toggle-round+label:before {
right: 1px;
background-color: #f1f1f1;
border-radius: var(--diameter);
transition: background 0.4s;
}
input.btn-toggle-round+label:after {
width: var(--diameter);
background-color: #ffffff;
border-radius: 100%;
box-shadow: 0 2px 5px rgba(0, 0, 0, 0.3);
transition: margin 0.4s;
}
input.btn-toggle-round:checked+label:before {
background-color: var(--highlight);
}
input.btn-toggle-round:checked+label:after {
margin-left: var(--diameter);
}
.slidecontainer {
width: 100%;
}
.slider {
-webkit-appearance: none;
height: 15px;
background: #f1f1f1;
transition: background 0.4s;
-webkit-transition: .2s;
transition: opacity .2s;
border-radius: var(--diameter);
}
.slider::-webkit-slider-thumb {
-webkit-appearance: none;
appearance: none;
width: var(--diameter);
height: var(--diameter);
background: var(--highlight);
box-shadow: 0 2px 5px rgba(0, 0, 0, 0.3);
cursor: pointer;
border-radius: var(--diameter);
border: 0px;
}
.slider::-moz-range-thumb {
width: var(--diameter);
height: var(--diameter);
background: var(--highlight);
box-shadow: 0 2px 5px rgba(0, 0, 0, 0.3);
cursor: pointer;
border-radius: var(--diameter);
border: 0px;
}
*/
.switch {
position: absolute;
@ -308,15 +218,18 @@
font-family: 'HelveticaNeue-Light', 'Helvetica Neue Light', 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif;
font-size: 16px;
/*background: var(--highlight);*/
background: var(--lowlight);
background: var(--options-background);
border: 0;
padding:5px;
/*
-webkit-appearance: none;
-moz-appearance: none;
background-image: url("data:image/svg+xml;utf8,<svg fill='blue' height='40' viewBox='0 0 40 40' width='40' xmlns='http://www.w3.org/2000/svg'><path d='M7 10l5 5 5-5z'/><path d='M0 0h40v20H0z' fill='none'/></svg>");
background-repeat: no-repeat;
background-position-x: 100%;
-webkit-appearance: none;
border-radius: 20px;
text-align:center;
text-align-last:center;
outline: none;
/*
padding-left: 20px;
padding-right: 20px;
*/
}
</style>