mirror of
https://github.com/emsesp/EMS-ESP32.git
synced 2025-12-06 15:59:52 +03:00
check/format solar
This commit is contained in:
@@ -102,8 +102,13 @@ Solar::Solar(uint8_t device_type, uint8_t device_id, uint8_t product_id, const c
|
|||||||
FL_(wwMaxTemp),
|
FL_(wwMaxTemp),
|
||||||
DeviceValueUOM::DEGREES,
|
DeviceValueUOM::DEGREES,
|
||||||
MAKE_CF_CB(set_wwMaxTemp));
|
MAKE_CF_CB(set_wwMaxTemp));
|
||||||
register_device_value(
|
register_device_value(DeviceValueTAG::TAG_DEVICE_DATA_WW,
|
||||||
DeviceValueTAG::TAG_DEVICE_DATA_WW, &wwSelTemp_, DeviceValueType::UINT, nullptr, FL_(wwSelTemp), DeviceValueUOM::DEGREES, MAKE_CF_CB(set_wwSelTemp));
|
&wwSelTemp_,
|
||||||
|
DeviceValueType::UINT,
|
||||||
|
nullptr,
|
||||||
|
FL_(wwSelTemp),
|
||||||
|
DeviceValueUOM::DEGREES,
|
||||||
|
MAKE_CF_CB(set_wwSelTemp));
|
||||||
register_device_value(DeviceValueTAG::TAG_DEVICE_DATA_WW,
|
register_device_value(DeviceValueTAG::TAG_DEVICE_DATA_WW,
|
||||||
&wwRedTemp_,
|
&wwRedTemp_,
|
||||||
DeviceValueType::UINT,
|
DeviceValueType::UINT,
|
||||||
@@ -962,54 +967,54 @@ bool Solar::set_SM10MaxFlow(const char * value, const int8_t id) {
|
|||||||
|
|
||||||
// switch heat transfer system on/off
|
// switch heat transfer system on/off
|
||||||
bool Solar::set_heatTransferSystem(const char * value, const int8_t id) {
|
bool Solar::set_heatTransferSystem(const char * value, const int8_t id) {
|
||||||
bool v = false;
|
bool b;
|
||||||
if (!Helpers::value2bool(value, v)) {
|
if (!Helpers::value2bool(value, b)) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
write_command(0x358, 5, v ? 0x01 : 0x00, 0x358);
|
write_command(0x358, 5, b ? 0x01 : 0x00, 0x358);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
// switch external cylinder on/off
|
// switch external cylinder on/off
|
||||||
bool Solar::set_externalCyl(const char * value, const int8_t id) {
|
bool Solar::set_externalCyl(const char * value, const int8_t id) {
|
||||||
bool v = false;
|
bool b;
|
||||||
if (!Helpers::value2bool(value, v)) {
|
if (!Helpers::value2bool(value, b)) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
write_command(0x358, 9, v ? 0x01 : 0x00, 0x358);
|
write_command(0x358, 9, b ? 0x01 : 0x00, 0x358);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
// switch thermal disinfection on/off
|
// switch thermal disinfection on/off
|
||||||
bool Solar::set_thermalDisinfect(const char * value, const int8_t id) {
|
bool Solar::set_thermalDisinfect(const char * value, const int8_t id) {
|
||||||
bool v = false;
|
bool b;
|
||||||
if (!Helpers::value2bool(value, v)) {
|
if (!Helpers::value2bool(value, b)) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
write_command(0x358, 10, v ? 0x01 : 0x00, 0x358);
|
write_command(0x358, 10, b ? 0x01 : 0x00, 0x358);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
// switch heat metering on/off
|
// switch heat metering on/off
|
||||||
bool Solar::set_heatMetering(const char * value, const int8_t id) {
|
bool Solar::set_heatMetering(const char * value, const int8_t id) {
|
||||||
bool v = false;
|
bool b;
|
||||||
if (!Helpers::value2bool(value, v)) {
|
if (!Helpers::value2bool(value, b)) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
write_command(0x358, 14, v ? 0x01 : 0x00, 0x358);
|
write_command(0x358, 14, b ? 0x01 : 0x00, 0x358);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
// switch solar system on/off
|
// switch solar system on/off
|
||||||
bool Solar::set_solarEnabled(const char * value, const int8_t id) {
|
bool Solar::set_solarEnabled(const char * value, const int8_t id) {
|
||||||
bool v = false;
|
bool b;
|
||||||
if (!Helpers::value2bool(value, v)) {
|
if (!Helpers::value2bool(value, b)) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
if (flags() == EMSdevice::EMS_DEVICE_FLAG_SM10) {
|
if (flags() == EMSdevice::EMS_DEVICE_FLAG_SM10) {
|
||||||
write_command(0x96, 0, v ? 0xFF : 0x00, 0x96);
|
write_command(0x96, 0, b ? 0xFF : 0x00, 0x96);
|
||||||
} else {
|
} else {
|
||||||
write_command(0x358, 19, v ? 0x01 : 0x00, 0x358);
|
write_command(0x358, 19, b ? 0x01 : 0x00, 0x358);
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
@@ -1037,71 +1042,71 @@ bool Solar::set_solarMode2(const char * value, const int8_t id) {
|
|||||||
|
|
||||||
// switch pumpkick on/off
|
// switch pumpkick on/off
|
||||||
bool Solar::set_solarPumpKick(const char * value, const int8_t id) {
|
bool Solar::set_solarPumpKick(const char * value, const int8_t id) {
|
||||||
bool v = false;
|
bool b;
|
||||||
if (!Helpers::value2bool(value, v)) {
|
if (!Helpers::value2bool(value, b)) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
write_command(0x35A, 9, v ? 0x01 : 0x00, 0x35A);
|
write_command(0x35A, 9, b ? 0x01 : 0x00, 0x35A);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
// switch pump2kick on/off
|
// switch pump2kick on/off
|
||||||
bool Solar::set_solarPump2Kick(const char * value, const int8_t id) {
|
bool Solar::set_solarPump2Kick(const char * value, const int8_t id) {
|
||||||
bool v = false;
|
bool b;
|
||||||
if (!Helpers::value2bool(value, v)) {
|
if (!Helpers::value2bool(value, b)) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
write_command(0x35D, 0, v ? 0x01 : 0x00, 0x35D);
|
write_command(0x35D, 0, b ? 0x01 : 0x00, 0x35D);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
// switch plain water mode on/off
|
// switch plain water mode on/off
|
||||||
bool Solar::set_plainWaterMode(const char * value, const int8_t id) {
|
bool Solar::set_plainWaterMode(const char * value, const int8_t id) {
|
||||||
bool v = false;
|
bool b;
|
||||||
if (!Helpers::value2bool(value, v)) {
|
if (!Helpers::value2bool(value, b)) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
write_command(0x35A, 10, v ? 0x01 : 0x00, 0x35A);
|
write_command(0x35A, 10, b ? 0x01 : 0x00, 0x35A);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
// switch double match flow on/off
|
// switch double match flow on/off
|
||||||
bool Solar::set_doubleMatchFlow(const char * value, const int8_t id) {
|
bool Solar::set_doubleMatchFlow(const char * value, const int8_t id) {
|
||||||
bool v = false;
|
bool b;
|
||||||
if (!Helpers::value2bool(value, v)) {
|
if (!Helpers::value2bool(value, b)) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
write_command(0x35A, 11, v ? 0x01 : 0x00, 0x35A);
|
write_command(0x35A, 11, b ? 0x01 : 0x00, 0x35A);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
// set climate zone number
|
// set climate zone number
|
||||||
bool Solar::set_climateZone(const char * value, const int8_t id) {
|
bool Solar::set_climateZone(const char * value, const int8_t id) {
|
||||||
int v = 0;
|
int zone;
|
||||||
if (!Helpers::value2number(value, v)) {
|
if (!Helpers::value2number(value, zone)) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
write_command(0x380, 0, v, 0x380);
|
write_command(0x380, 0, zone, 0x380);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
// collector area in squaremeters
|
// collector area in squaremeters
|
||||||
bool Solar::set_collector1Area(const char * value, const int8_t id) {
|
bool Solar::set_collector1Area(const char * value, const int8_t id) {
|
||||||
float v = 0;
|
float area;
|
||||||
if (!Helpers::value2float(value, v)) {
|
if (!Helpers::value2float(value, area)) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
write_command(0x380, 3, (uint16_t)(v * 10), 0x380);
|
write_command(0x380, 3, (uint16_t)(area * 10), 0x380);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
// collector area in squaremeters
|
// collector area in squaremeters
|
||||||
bool Solar::set_collector2Area(const char * value, const int8_t id) {
|
bool Solar::set_collector2Area(const char * value, const int8_t id) {
|
||||||
float v = 0;
|
float area;
|
||||||
if (!Helpers::value2float(value, v)) {
|
if (!Helpers::value2float(value, area)) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
write_command(0x380, 6, (uint16_t)(v * 10), 0x380);
|
write_command(0x380, 6, (uint16_t)(area * 10), 0x380);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1127,105 +1132,105 @@ bool Solar::set_collector2Type(const char * value, const int8_t id) {
|
|||||||
|
|
||||||
// priority of cylinders if there are 2
|
// priority of cylinders if there are 2
|
||||||
bool Solar::set_cylPriority(const char * value, const int8_t id) {
|
bool Solar::set_cylPriority(const char * value, const int8_t id) {
|
||||||
uint8_t n;
|
uint8_t num;
|
||||||
if (!Helpers::value2enum(value, n, FL_(enum_cylprio))) {
|
if (!Helpers::value2enum(value, num, FL_(enum_cylprio))) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
write_command(0x35F, 3, n, 0x35F);
|
write_command(0x35F, 3, num, 0x35F);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool Solar::set_heatAssist(const char * value, const int8_t id) {
|
bool Solar::set_heatAssist(const char * value, const int8_t id) {
|
||||||
float v = 0;
|
float temperature;
|
||||||
if (!Helpers::value2temperature(value, v)) {
|
if (!Helpers::value2temperature(value, temperature)) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
write_command(0x35C, 0, (uint8_t)(v * 10), 0x35C);
|
write_command(0x35C, 0, (uint8_t)(temperature * 10), 0x35C);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool Solar::set_diffControl(const char * value, const int8_t id) {
|
bool Solar::set_diffControl(const char * value, const int8_t id) {
|
||||||
float v = 0;
|
float temperature;
|
||||||
if (!Helpers::value2temperature(value, v)) {
|
if (!Helpers::value2temperature(value, temperature)) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
write_command(0x361, 4, (uint8_t)(v * 10), 0x361);
|
write_command(0x361, 4, (uint8_t)(temperature * 10), 0x361);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool Solar::set_wwSelTemp(const char * value, const int8_t id) {
|
bool Solar::set_wwSelTemp(const char * value, const int8_t id) {
|
||||||
float v = 0;
|
int temperature;
|
||||||
if (!Helpers::value2temperature(value, v)) {
|
if (!Helpers::value2temperature(value, temperature)) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
if (flags() == EMSdevice::EMS_DEVICE_FLAG_ISM) {
|
if (flags() == EMSdevice::EMS_DEVICE_FLAG_ISM) {
|
||||||
write_command(0x35, 3, (uint8_t)v, 0x34);
|
write_command(0x35, 3, (uint8_t)temperature, 0x34);
|
||||||
} else { // SM100
|
} else { // SM100
|
||||||
write_command(0x7A6, 9, (uint8_t)v, 0x7A6);
|
write_command(0x7A6, 9, (uint8_t)temperature, 0x7A6);
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool Solar::set_wwMaxTemp(const char * value, const int8_t id) {
|
bool Solar::set_wwMaxTemp(const char * value, const int8_t id) {
|
||||||
float v = 0;
|
int temperature;
|
||||||
if (!Helpers::value2temperature(value, v)) {
|
if (!Helpers::value2temperature(value, temperature)) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
write_command(0x7A6, 8, (uint8_t)v, 0x7A6);
|
write_command(0x7A6, 8, (uint8_t)temperature, 0x7A6);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool Solar::set_wwRedTemp(const char * value, const int8_t id) {
|
bool Solar::set_wwRedTemp(const char * value, const int8_t id) {
|
||||||
float v = 0;
|
int temperature;
|
||||||
if (!Helpers::value2temperature(value, v)) {
|
if (!Helpers::value2temperature(value, temperature)) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
write_command(0x7A6, 10, (uint8_t)v, 0x7A6);
|
write_command(0x7A6, 10, (uint8_t)temperature, 0x7A6);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool Solar::set_wwDailyTemp(const char * value, const int8_t id) {
|
bool Solar::set_wwDailyTemp(const char * value, const int8_t id) {
|
||||||
float v = 0;
|
int temperature;
|
||||||
if (!Helpers::value2temperature(value, v)) {
|
if (!Helpers::value2temperature(value, temperature)) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
write_command(0x7A6, 6, (uint8_t)v, 0x7A6);
|
write_command(0x7A6, 6, (uint8_t)temperature, 0x7A6);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool Solar::set_wwDisinfectionTemp(const char * value, const int8_t id) {
|
bool Solar::set_wwDisinfectionTemp(const char * value, const int8_t id) {
|
||||||
float v = 0;
|
int temperature;
|
||||||
if (!Helpers::value2temperature(value, v)) {
|
if (!Helpers::value2temperature(value, temperature)) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
write_command(0x7A6, 12, (uint8_t)v, 0x7A6);
|
write_command(0x7A6, 12, (uint8_t)temperature, 0x7A6);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool Solar::set_wwCirc(const char * value, const int8_t id) {
|
bool Solar::set_wwCirc(const char * value, const int8_t id) {
|
||||||
bool v = false;
|
bool b;
|
||||||
if (!Helpers::value2bool(value, v)) {
|
if (!Helpers::value2bool(value, b)) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
write_command(0x7A5, 0, v ? 0xFF : 0x00, 0x7A5);
|
write_command(0x7A5, 0, b ? 0xFF : 0x00, 0x7A5);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool Solar::set_wwCircMode(const char * value, const int8_t id) {
|
bool Solar::set_wwCircMode(const char * value, const int8_t id) {
|
||||||
uint8_t n;
|
uint8_t num;
|
||||||
if (!Helpers::value2enum(value, n, FL_(enum_wwCircMode))) {
|
if (!Helpers::value2enum(value, num, FL_(enum_wwCircMode))) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
write_command(0x7A5, 3, n, 0x7A5);
|
write_command(0x7A5, 3, num, 0x7A5);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool Solar::set_wwKeepWarm(const char * value, const int8_t id) {
|
bool Solar::set_wwKeepWarm(const char * value, const int8_t id) {
|
||||||
bool v = false;
|
bool b;
|
||||||
if (!Helpers::value2bool(value, v)) {
|
if (!Helpers::value2bool(value, b)) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
write_command(0x7AE, 0, v ? 0xFF : 0x00, 0x7AE);
|
write_command(0x7AE, 0, b ? 0xFF : 0x00, 0x7AE);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user