Skip to content

Commit feb50d6

Browse files
committed
Bugfix
1 parent 494c24d commit feb50d6

File tree

3 files changed

+8
-12
lines changed

3 files changed

+8
-12
lines changed

arduino-altherma-controller/02-UDP.ino

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ void recvUdp() {
2525
/**************************************************************************/
2626
/*!
2727
@brief Checks P1P2 command, checks availability of queue, stores commands
28-
into queue or an error.
28+
into queue or records an error.
2929
@param command Command received via UDP or web UI.
3030
@param cmdLen Command length.
3131
*/

arduino-altherma-controller/03-P1P2.ino

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@ void recvBus() {
3131
// act as auxiliary controller:
3232
if (P1P2Serial.writeready() && (controllerAddr > CONNECTING) && (RB[0] == 0x00) && (RB[1] == controllerAddr)) {
3333

34+
connectionTimer.sleep(data.config.connectTimeout * 1000UL);
3435
//if 1) the main controller sends request to our auxiliary controller 2) we are write ready => always respond
3536
processWrite(nread);
3637
}
@@ -210,8 +211,8 @@ void processWrite(uint16_t n) {
210211
} else {
211212
// TODO error
212213
}
213-
updateEeprom();
214-
deleteCmd(); // delete cmd in Queue
214+
updateEeprom(); // TODO is it really needed? Writes data to Arduino EEPROM whenever a command is written to the P1/P2 bus (& to the Daikin EEPROM)
215+
deleteCmd(); // delete cmd in Queue
215216
} else {
216217
switch (RB[2]) {
217218
case PACKET_TYPE_HANDSHAKE: // 0x30
@@ -265,7 +266,6 @@ void processWrite(uint16_t n) {
265266
}
266267
break;
267268
case 0x31: // in: 15 byte; out: 15 byte; out pattern is copy of in pattern except for 2 bytes RB[7] RB[8]; function partly date/time, partly unknown
268-
connectionTimer.sleep(data.config.connectTimeout * 1000UL);
269269
// RB[7] RB[8] seem to identify the auxiliary controller type;
270270
// Do pretend to be a LAN adapter (even though this may trigger "data not in sync" upon restart?)
271271
// If we don't set address, installer mode in main thermostat may become inaccessible

arduino-altherma-controller/advanced_settings.h

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -55,13 +55,10 @@ const byte PACKET_TYPE_CONTROL[2] = { 0x30, 0x3E }; // First and last control p
5555
const byte PACKET_TYPE_INDOOR_NAME = 0xB1; // Heat pump indoorname packet type
5656
const byte PACKET_TYPE_OUTDOOR_NAME = 0xA1; // Heat pump outdoor name packet type
5757
const byte PACKET_TYPE_COUNTER = 0xB8; // Counters packet type
58-
const byte PACKET_TYPE_RESTART = 0x12;
59-
const byte RESTART_PACKET_PAYLOAD_BYTE = 12;
60-
const byte RESTART_PACKET_BYTE = 0x20;
61-
const byte F030DELAY = 100; // Time delay for in ms auxiliary controller simulation, should be larger than any response of other auxiliary controllers (which is typically 25-80 ms)
62-
const byte F03XDELAY = 50; // Time delay for in ms auxiliary controller simulation, should preferably be a bit larger than any regular response from auxiliary controllers (which is typically 25 ms)
63-
const byte F0THRESHOLD = 5; // Number of 00Fx30 messages to remain unanswered before we feel safe to act as auxiliary controller
64-
// Each message takes ~770ms so we can use F0THRESHOLD to set minimum and default connectTimeout
58+
const byte F030DELAY = 100; // Time delay for in ms auxiliary controller simulation, should be larger than any response of other auxiliary controllers (which is typically 25-80 ms)
59+
const byte F03XDELAY = 50; // Time delay for in ms auxiliary controller simulation, should preferably be a bit larger than any regular response from auxiliary controllers (which is typically 25 ms)
60+
const byte F0THRESHOLD = 5; // Number of 00Fx30 messages to remain unanswered before we feel safe to act as auxiliary controller
61+
// Each message takes ~770ms so we can use F0THRESHOLD to set minimum and default connectTimeout
6562

6663
const byte DATA_PACKETS_CNT = PACKET_TYPE_DATA[LAST] - PACKET_TYPE_DATA[FIRST] + 1;
6764
const byte CTRL_PACKETS_CNT = PACKET_TYPE_CONTROL[LAST] - PACKET_TYPE_CONTROL[FIRST] + 1;
@@ -82,7 +79,6 @@ const byte WB_SIZE = 32; // P1/P2 write buffer size for writing to P1P2
8279
const byte RB_SIZE = 33; // P1/P2 read buffer size to store raw data and error codes read from P1P2bus; 1 extra for reading back CRC byte; 24 might be enough
8380
const uint16_t INIT_SDTO = 2500; // P1/P2 write time-out delay (ms)
8481

85-
// set CTRL adapter ID; if not used, installer mode becomes unavailable on main controller
8682
const byte CTRL_ID[] = { 0xB4, 0x10 }; // LAN adapter ID in 0x31 payload bytes 7 and 8
8783

8884
const byte MAC_START[3] = { 0x90, 0xA2, 0xDA }; // MAC range for Gheo SA

0 commit comments

Comments
 (0)