Skip to content

Commit

Permalink
Merge pull request #210 from dzungpv/master
Browse files Browse the repository at this point in the history
Fix slow sync when using IR or wall remote
  • Loading branch information
SwiCago authored Sep 25, 2024
2 parents 5d1e146 + d0ba747 commit dc898d5
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 2 deletions.
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ hp.setSettings(settings);
// OR individual settings
// hp.setModeSetting("COOL");

// hp.setFastSync(true); // enable fast sync mode, we only request RQST_PKT_SETTINGS, RQST_PKT_ROOM_TEMP and RQST_PKT_STATUS
hp.update();
```

Expand Down
15 changes: 14 additions & 1 deletion src/HeatPump.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -235,6 +235,18 @@ heatpumpSettings HeatPump::getSettings() {
return currentSettings;
}

heatpumpSettings HeatPump::getWantedSettings() {
return wantedSettings;
}

unsigned long HeatPump::getLastWanted() {
return lastWanted;
}

void HeatPump::setFastSync(bool setting) {
fastSync = setting;
}

bool HeatPump::isConnected() {
return connected;
}
Expand Down Expand Up @@ -543,7 +555,8 @@ void HeatPump::createInfoPacket(byte *packet, byte packetType) {
} else {
// request current infoMode, and increment for the next request
packet[5] = INFOMODE[infoMode];
if(infoMode == (INFOMODE_LEN - 1)) {
// if enable fastSync we only request RQST_PKT_SETTINGS, RQST_PKT_ROOM_TEMP and RQST_PKT_STATUS, so the sync will be 2x faster
if (infoMode == (fastSync ? 2 : (INFOMODE_LEN - 1))) {
infoMode = 0;
} else {
infoMode++;
Expand Down
8 changes: 7 additions & 1 deletion src/HeatPump.h
Original file line number Diff line number Diff line change
Expand Up @@ -137,9 +137,9 @@ class HeatPump
const byte INFOMODE[INFOMODE_LEN] = {
0x02, // request a settings packet - RQST_PKT_SETTINGS
0x03, // request the current room temp - RQST_PKT_ROOM_TEMP
0x06, // request status - RQST_PKT_STATUS
0x04, // unknown
0x05, // request the timers - RQST_PKT_TIMERS
0x06, // request status - RQST_PKT_STATUS
0x09 // request standby mode (maybe?) RQST_PKT_STANDBY
};

Expand Down Expand Up @@ -206,6 +206,7 @@ class HeatPump
bool tempMode;
bool externalUpdate;
bool wideVaneAdj;
bool fastSync = false;

const char* lookupByteMapValue(const char* valuesMap[], const byte byteMap[], int len, byte byteValue);
int lookupByteMapValue(const int valuesMap[], const byte byteMap[], int len, byte byteValue);
Expand Down Expand Up @@ -253,6 +254,8 @@ class HeatPump

// settings
heatpumpSettings getSettings();
// wanted settings
heatpumpSettings getWantedSettings();
void setSettings(heatpumpSettings settings);
void setPowerSetting(bool setting);
bool getPowerSettingBool();
Expand All @@ -270,6 +273,9 @@ class HeatPump
const char* getWideVaneSetting();
void setWideVaneSetting(const char* setting);
bool getIseeBool();
void setFastSync(bool setting);
// hacks
unsigned long getLastWanted();

// status
heatpumpStatus getStatus();
Expand Down

0 comments on commit dc898d5

Please sign in to comment.