mirror of https://github.com/sfeakes/AqualinkD.git
Version 1.3.4
parent
c2fe658d17
commit
3863b53233
10
README.md
10
README.md
|
@ -63,8 +63,14 @@ Designed to mimic AqualinkRS6 All Button keypad, and just like the keypad you ca
|
|||
* http://aqualink.ip/simple.html <- (Simple opion if you don't like the above)
|
||||
* http://aqualink.ip/simulator.html <- (RS8 All Button Control Panel simulator)
|
||||
#<a name="release"></a>
|
||||
## Update in Release 1.3.3d (a,b,c,e,f)
|
||||
* Some PDA fixes / enhancements.
|
||||
## Update in Release 1.3.4
|
||||
* Logging changes.
|
||||
* Fix issues in programming mode.
|
||||
* Update to simulation mode.
|
||||
* Changed to serial logger.
|
||||
## Update in Release 1.3.3 (a,b,c,e,f)
|
||||
* Incremental PDA fixes / enhancements.
|
||||
* SWG bug fix
|
||||
## Update in Release 1.3.3
|
||||
* AqualinkD will now automaticaly find a usable ID if not specifically configured.
|
||||
* Support for reading (up to 4) Variable Speed Pump info & assigning per device. (Please see wiki for new config options).
|
||||
|
|
|
@ -466,6 +466,8 @@ void _send_ack(int fd, unsigned char ack_type, unsigned char command)
|
|||
|
||||
//logMessage(LOG_DEBUG, "Sent '0x%02hhx' to controller\n", command);
|
||||
log_packet(LOG_DEBUG_SERIAL, "Sent ", ackPacket, length);
|
||||
|
||||
//logMessage(LOG_DEBUG, "Sent '0x%02hhx' to controller \n", command);
|
||||
}
|
||||
|
||||
|
||||
|
|
34
aqualinkd.c
34
aqualinkd.c
|
@ -229,6 +229,7 @@ void processMessage(char *message)
|
|||
//_aqualink_data.display_message = NULL;
|
||||
_aqualink_data.last_display_message[0] = '\0';
|
||||
}
|
||||
|
||||
// If we have more than 10 messages without "Service Mode is active" assume it's off.
|
||||
if (_aqualink_data.service_mode_state == ON && service_msg_count++ > 10)
|
||||
{
|
||||
|
@ -236,12 +237,12 @@ void processMessage(char *message)
|
|||
service_msg_count = 0;
|
||||
}
|
||||
|
||||
// If we have more than 10 messages without "Service Mode is active" assume it's off.
|
||||
// If we have more than 20 messages without "SALT or AQUAPURE" assume SWG is off.
|
||||
if (_aqualink_data.ar_swg_status == SWG_STATUS_ON && swg_msg_count++ > 20) {
|
||||
_aqualink_data.ar_swg_status = SWG_STATUS_OFF;
|
||||
swg_msg_count = 0;
|
||||
}
|
||||
|
||||
|
||||
// If we have more than 10 messages without "FREE PROTECT ACTIVATED" assume it's off.
|
||||
if (_aqualink_data.frz_protect_state == ON && freeze_msg_count++ > 10)
|
||||
{
|
||||
|
@ -880,6 +881,8 @@ void logPacket_new(unsigned char* packet_buffer, int packet_length)
|
|||
for (i=0;i<packet_length;i++)
|
||||
cnt += sprintf(buff + cnt, "0x%02hhx|", packet_buffer[i]);
|
||||
|
||||
cnt += sprintf(buff + cnt, "\n");
|
||||
|
||||
if (_config_parameters.debug_RSProtocol_packets)
|
||||
writePacketLog(buff);
|
||||
else
|
||||
|
@ -902,6 +905,8 @@ void logPacket(unsigned char *packet_buffer, int packet_length)
|
|||
for (i = 0; i < packet_length; i++)
|
||||
cnt += sprintf(buff + cnt, "0x%02hhx|", packet_buffer[i]);
|
||||
|
||||
cnt += sprintf(buff + cnt, "\n");
|
||||
|
||||
if (_config_parameters.debug_RSProtocol_packets)
|
||||
writePacketLog(buff);
|
||||
else
|
||||
|
@ -912,12 +917,13 @@ void logPacket(unsigned char *packet_buffer, int packet_length)
|
|||
#define MAX_BLOCK_ACK 12
|
||||
#define MAX_BUSY_ACK (50 + MAX_BLOCK_ACK)
|
||||
|
||||
|
||||
void caculate_ack_packet(int rs_fd, unsigned char *packet_buffer) {
|
||||
static int delayAckCnt = 0;
|
||||
|
||||
if (!_aqualink_data.simulate_panel || _aqualink_data.active_thread.thread_id != 0) {
|
||||
//if (!_aqualink_data.simulate_panel || _aqualink_data.active_thread.thread_id != 0) {
|
||||
// if PDA mode, should we sleep? if not Can only send command to status message on PDA.
|
||||
if (_config_parameters.pda_mode == true) {
|
||||
if (_config_parameters.pda_mode == true) {
|
||||
//pda_programming_thread_check(&_aqualink_data);
|
||||
if (_config_parameters.pda_sleep_mode && pda_shouldSleep()) {
|
||||
logMessage(LOG_DEBUG, "PDA Aqualink daemon in sleep mode\n");
|
||||
|
@ -926,8 +932,9 @@ void caculate_ack_packet(int rs_fd, unsigned char *packet_buffer) {
|
|||
send_ack(rs_fd, NUL);
|
||||
else
|
||||
send_ack(rs_fd, pop_aq_cmd(&_aqualink_data));
|
||||
}
|
||||
} else { // We are in simlator mode, ack get's complicated now.
|
||||
|
||||
} else if (_aqualink_data.simulate_panel && _aqualink_data.active_thread.thread_id == 0) {
|
||||
// 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
|
||||
|
@ -951,6 +958,9 @@ void caculate_ack_packet(int rs_fd, unsigned char *packet_buffer) {
|
|||
|
||||
delayAckCnt++;
|
||||
}
|
||||
} else {
|
||||
// We are in simulate panel mode, but a thread is active, so ignore simulate panel
|
||||
send_ack(rs_fd, pop_aq_cmd(&_aqualink_data));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1104,20 +1114,28 @@ void main_loop()
|
|||
//logMessage(LOG_DEBUG, "RS received packet of type %s length %d\n", get_packet_type(packet_buffer, packet_length), packet_length);
|
||||
//debugPacketPrint(0x00, packet_buffer, packet_length);
|
||||
//unsigned char ID, unsigned char *packet_buffer, int packet_length)
|
||||
|
||||
/*
|
||||
// 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)
|
||||
{
|
||||
broadcast_aqualinkstate(mgr.active_connections);
|
||||
}
|
||||
|
||||
*/
|
||||
// If we are not in PDA or Simulator mode, just sent ACK & any CMD, else caculate the ACK.
|
||||
if (!_aqualink_data.simulate_panel && !_config_parameters.pda_mode)
|
||||
send_ack(rs_fd, pop_aq_cmd(&_aqualink_data));
|
||||
else
|
||||
caculate_ack_packet(rs_fd, packet_buffer);
|
||||
|
||||
/* MOVE PROCESSING TO AFTER ACK, long programming will fail otherwise (like set time) */
|
||||
// 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)
|
||||
{
|
||||
broadcast_aqualinkstate(mgr.active_connections);
|
||||
}
|
||||
|
||||
}/*
|
||||
else if (_config_parameters.use_PDA_auxiliary && packet_length > 0 && packet_buffer[PKT_DEST] == 0x60 && _aqualink_data.aqbuttons[PUMP_INDEX].led->state != OFF)
|
||||
{
|
||||
|
|
|
@ -843,7 +843,7 @@ void action_websocket_request(struct mg_connection *nc, struct websocket_message
|
|||
ws_send(nc, message);
|
||||
} else if ( strcmp(request.first.value, "simulator") == 0) {
|
||||
_aqualink_data->simulate_panel = true;
|
||||
logMessage(LOG_INFO, "WS: Set Simpulator mode");
|
||||
logMessage(LOG_INFO, "WS: Set Simulator mode");
|
||||
char labels[JSON_LABEL_SIZE];
|
||||
build_aux_labels_JSON(_aqualink_data, labels, JSON_LABEL_SIZE);
|
||||
ws_send(nc, labels);
|
||||
|
|
Binary file not shown.
Binary file not shown.
|
@ -16,6 +16,8 @@
|
|||
#define SLOG_MAX 80
|
||||
#define PACKET_MAX 600
|
||||
|
||||
#define VERSION "serial_logger V1.1"
|
||||
|
||||
/*
|
||||
typedef enum used {
|
||||
yes,
|
||||
|
@ -78,7 +80,7 @@ const char *getDevice(unsigned char ID) {
|
|||
return SPA_R;
|
||||
if (ID >= 0x30 && ID <= 0x33)
|
||||
return AQUA;
|
||||
if (ID >= 0x38 && ID <= 0x3b)
|
||||
if (ID >= 0x38 && ID <= 0x3B)
|
||||
return HEATER;
|
||||
if (ID >= 0x40 && ID <= 0x43)
|
||||
return ONE_T;
|
||||
|
@ -86,7 +88,8 @@ const char *getDevice(unsigned char ID) {
|
|||
return PC_DOCK;
|
||||
if (ID >= 0x60 && ID <= 0x63)
|
||||
return PDA;
|
||||
if (ID >= 0x70 && ID <= 0x73)
|
||||
//if (ID >= 0x70 && ID <= 0x73)
|
||||
if (ID >= 0x78 && ID <= 0x7B)
|
||||
return EPUMP;
|
||||
if (ID >= 0x80 && ID <= 0x83)
|
||||
return CHEM;
|
||||
|
@ -236,6 +239,7 @@ int main(int argc, char *argv[]) {
|
|||
//char buffer[256];
|
||||
//bool idMode = true;
|
||||
|
||||
printf("AqualinkD %s\n",VERSION);
|
||||
|
||||
if (getuid() != 0) {
|
||||
fprintf(stderr, "ERROR %s Can only be run as root\n", argv[0]);
|
||||
|
|
Loading…
Reference in New Issue