diff --git a/components/cn105/climateControls.cpp b/components/cn105/climateControls.cpp index 00bf221..e18d011 100644 --- a/components/cn105/climateControls.cpp +++ b/components/cn105/climateControls.cpp @@ -14,7 +14,7 @@ void CN105Climate::checkPendingWantedSettings() { this->sendWantedSettings(); } -void logCheckWantedSettingsMutex(wantedHeatpumpSettings settings) { +void logCheckWantedSettingsMutex(wantedHeatpumpSettings& settings) { if (settings.hasBeenSent) { ESP_LOGE("control", "Mutex lock faillure: wantedSettings should be locked while sending."); diff --git a/components/cn105/cn105.h b/components/cn105/cn105.h index 948c95d..2d35200 100644 --- a/components/cn105/cn105.h +++ b/components/cn105/cn105.h @@ -237,10 +237,10 @@ class CN105Climate : public climate::Climate, public Component, public uart::UAR void prepareInfoPacket(uint8_t* packet, int length); void prepareSetPacket(uint8_t* packet, int length); - void publishStateToHA(heatpumpSettings settings); + void publishStateToHA(heatpumpSettings& settings); void publishWantedSettingsStateToHA(); - void heatpumpUpdate(heatpumpSettings settings); + void heatpumpUpdate(heatpumpSettings& settings); void statusChanged(heatpumpStatus status); @@ -257,8 +257,8 @@ class CN105Climate : public climate::Climate, public Component, public uart::UAR void setActionIfOperatingAndCompressorIsActiveTo(climate::ClimateAction action); void hpPacketDebug(uint8_t* packet, unsigned int length, const char* packetDirection); - void debugSettings(const char* settingName, heatpumpSettings settings); - void debugSettings(const char* settingName, wantedHeatpumpSettings settings); + void debugSettings(const char* settingName, heatpumpSettings& settings); + void debugSettings(const char* settingName, wantedHeatpumpSettings& settings); void debugStatus(const char* statusName, heatpumpStatus status); void debugSettingsAndStatus(const char* settingName, heatpumpSettings settings, heatpumpStatus status); void debugClimate(const char* settingName); diff --git a/components/cn105/hp_readings.cpp b/components/cn105/hp_readings.cpp index 873aa98..8d72b60 100644 --- a/components/cn105/hp_readings.cpp +++ b/components/cn105/hp_readings.cpp @@ -473,7 +473,7 @@ void CN105Climate::statusChanged(heatpumpStatus status) { } -void CN105Climate::publishStateToHA(heatpumpSettings settings) { +void CN105Climate::publishStateToHA(heatpumpSettings& settings) { if ((this->wantedSettings.mode == nullptr) && (this->wantedSettings.power == nullptr)) { // to prevent overwriting a user demand checkPowerAndModeSettings(settings); @@ -508,7 +508,7 @@ void CN105Climate::publishStateToHA(heatpumpSettings settings) { } -void CN105Climate::heatpumpUpdate(heatpumpSettings settings) { +void CN105Climate::heatpumpUpdate(heatpumpSettings& settings) { // settings correponds to current settings ESP_LOGV(LOG_SETTINGS_TAG, "Settings received"); diff --git a/components/cn105/utils.cpp b/components/cn105/utils.cpp index e611305..79494f3 100644 --- a/components/cn105/utils.cpp +++ b/components/cn105/utils.cpp @@ -55,7 +55,7 @@ const char* CN105Climate::getIfNotNull(const char* what, const char* defaultValu return what; } -void CN105Climate::debugSettings(const char* settingName, wantedHeatpumpSettings settings) { +void CN105Climate::debugSettings(const char* settingName, wantedHeatpumpSettings& settings) { #ifdef USE_ESP32 ESP_LOGD(LOG_ACTION_EVT_TAG, "[%s]-> [power: %s, target °C: %.1f, mode: %s, fan: %s, vane: %s, wvane: %s, hasChanged ? -> %s, hasBeenSent ? -> %s]", getIfNotNull(settingName, "unnamed"), @@ -98,7 +98,7 @@ void CN105Climate::debugClimate(const char* settingName) { -void CN105Climate::debugSettings(const char* settingName, heatpumpSettings settings) { +void CN105Climate::debugSettings(const char* settingName, heatpumpSettings& settings) { #ifdef USE_ESP32 ESP_LOGD(LOG_SETTINGS_TAG, "[%s]-> [power: %s, target °C: %.1f, mode: %s, fan: %s, vane: %s, wvane: %s]", getIfNotNull(settingName, "unnamed"),