mirror of
https://github.com/emsesp/EMS-ESP32.git
synced 2025-12-06 07:49:52 +03:00
some small corrections
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
taken from:s
|
||||
taken from:
|
||||
https://github.com/arendst/Tasmota/blob/development/lib/lib_basic/OneWire-Stickbreaker/OneWire.cpp
|
||||
modified for ems-esp old lib compatibility
|
||||
|
||||
@@ -192,6 +192,7 @@ uint8_t OneWire::reset(void)
|
||||
#endif
|
||||
{
|
||||
IO_REG_TYPE mask IO_REG_MASK_ATTR = bitmask;
|
||||
volatile IO_REG_TYPE * reg IO_REG_BASE_ATTR = baseReg;
|
||||
uint8_t r;
|
||||
uint8_t retries = 125;
|
||||
t_noInterrupts();
|
||||
@@ -227,6 +228,7 @@ void OneWire::write_bit(uint8_t v)
|
||||
#endif
|
||||
{
|
||||
IO_REG_TYPE mask IO_REG_MASK_ATTR = bitmask;
|
||||
volatile IO_REG_TYPE * reg IO_REG_BASE_ATTR = baseReg;
|
||||
|
||||
if (v & 1) {
|
||||
t_noInterrupts();
|
||||
|
||||
@@ -178,6 +178,7 @@ Boiler::Boiler(uint8_t device_type, int8_t device_id, uint8_t product_id, const
|
||||
register_device_value(DeviceValueTAG::TAG_DEVICE_DATA, &curBurnPow_, DeviceValueType::UINT, nullptr, FL_(curBurnPow), DeviceValueUOM::PERCENT);
|
||||
register_device_value(DeviceValueTAG::TAG_DEVICE_DATA, &burnStarts_, DeviceValueType::ULONG, nullptr, FL_(burnStarts), DeviceValueUOM::NONE);
|
||||
register_device_value(DeviceValueTAG::TAG_DEVICE_DATA, &burnWorkMin_, DeviceValueType::TIME, nullptr, FL_(burnWorkMin), DeviceValueUOM::MINUTES);
|
||||
register_device_value(DeviceValueTAG::TAG_DEVICE_DATA, &burn2WorkMin_, DeviceValueType::TIME, nullptr, FL_(burn2WorkMin), DeviceValueUOM::MINUTES);
|
||||
register_device_value(DeviceValueTAG::TAG_DEVICE_DATA, &heatWorkMin_, DeviceValueType::TIME, nullptr, FL_(heatWorkMin), DeviceValueUOM::MINUTES);
|
||||
register_device_value(DeviceValueTAG::TAG_DEVICE_DATA, &UBAuptime_, DeviceValueType::TIME, nullptr, FL_(UBAuptime), DeviceValueUOM::MINUTES);
|
||||
register_device_value(DeviceValueTAG::TAG_DEVICE_DATA, &lastCode_, DeviceValueType::STRING, nullptr, FL_(lastCode), DeviceValueUOM::NONE);
|
||||
@@ -253,7 +254,7 @@ Boiler::Boiler(uint8_t device_type, int8_t device_id, uint8_t product_id, const
|
||||
DeviceValueUOM::NONE,
|
||||
MAKE_CF_CB(set_energyCostRatio),
|
||||
0,
|
||||
19.9);
|
||||
20);
|
||||
register_device_value(DeviceValueTAG::TAG_DEVICE_DATA,
|
||||
&fossileFactor_,
|
||||
DeviceValueType::UINT,
|
||||
@@ -414,7 +415,7 @@ Boiler::Boiler(uint8_t device_type, int8_t device_id, uint8_t product_id, const
|
||||
FL_(enum_comfort1),
|
||||
FL_(wwComfort1),
|
||||
DeviceValueUOM::NONE,
|
||||
MAKE_CF_CB(set_ww_mode1));
|
||||
MAKE_CF_CB(set_ww_mode));
|
||||
register_device_value(DeviceValueTAG::TAG_BOILER_DATA_WW,
|
||||
&wwFlowTempOffset_,
|
||||
DeviceValueType::UINT,
|
||||
@@ -1549,55 +1550,23 @@ bool Boiler::set_pump_delay(const char * value, const int8_t id) {
|
||||
|
||||
// note some boilers do not have this setting, than it's done by thermostat
|
||||
// on a RC35 it's by EMSESP::send_write_request(0x37, 0x10, 2, &set, 1, 0); (set is 1,2,3) 1=hot, 2=eco, 3=intelligent
|
||||
// on a RC310 it's 1=high, 2=eco
|
||||
bool Boiler::set_ww_mode(const char * value, const int8_t id) {
|
||||
uint8_t set;
|
||||
if (!Helpers::value2enum(value, set, FL_(enum_comfort))) {
|
||||
return false;
|
||||
}
|
||||
uint8_t comfort[] = {0x00, 0xD8, 0xEC};
|
||||
|
||||
if (!is_fetch(EMS_TYPE_UBAParameterWW)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (set == 0) {
|
||||
// LOG_INFO(F("Setting boiler dhw to Hot"));
|
||||
} else if (set == 1) {
|
||||
// LOG_INFO(F("Setting boiler dhw to Eco"));
|
||||
set = 0xD8;
|
||||
} else if (set == 2) {
|
||||
// LOG_INFO(F("Setting boiler dhw to Intelligent"));
|
||||
set = 0xEC;
|
||||
if (is_fetch(EMS_TYPE_UBAParameterWWPlus)) {
|
||||
if (Helpers::value2enum(value, set, FL_(enum_comfort1))) {
|
||||
write_command(EMS_TYPE_UBAParameterWWPlus, 13, comfort[set], EMS_TYPE_UBAParameterWWPlus);
|
||||
return true;
|
||||
}
|
||||
} else {
|
||||
return false; // do nothing
|
||||
if (Helpers::value2enum(value, set, FL_(enum_comfort))) {
|
||||
write_command(EMS_TYPE_UBAParameterWW, 9, comfort[set], EMS_TYPE_UBAParameterWW);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
write_command(EMS_TYPE_UBAParameterWW, 9, set, EMS_TYPE_UBAParameterWW);
|
||||
return true;
|
||||
}
|
||||
|
||||
// wwcomfort1 for RC310
|
||||
// on a RC310 it's 1=high, 2=eco
|
||||
bool Boiler::set_ww_mode1(const char * value, const int8_t id) {
|
||||
uint8_t set;
|
||||
if (!Helpers::value2enum(value, set, FL_(enum_comfort1))) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (!is_fetch(EMS_TYPE_UBAParameterWWPlus)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (set == 0) {
|
||||
// LOG_INFO(F("Setting boiler dhw to High"));
|
||||
} else if (set == 1) {
|
||||
// LOG_INFO(F("Setting boiler dhw to Eco"));
|
||||
set = 0xD8;
|
||||
} else {
|
||||
return false; // do nothing
|
||||
}
|
||||
|
||||
write_command(EMS_TYPE_UBAParameterWWPlus, 13, set, EMS_TYPE_UBAParameterWWPlus);
|
||||
return true;
|
||||
return false;
|
||||
}
|
||||
|
||||
// turn on/off dhw
|
||||
|
||||
@@ -131,7 +131,7 @@ class Boiler : public EMSdevice {
|
||||
uint32_t burn2WorkMin_; // burner stage 2 operating time
|
||||
uint32_t heatWorkMin_; // Total heat operating time
|
||||
uint32_t UBAuptime_; // Total UBA working hours
|
||||
char lastCode_[52]; // last error code
|
||||
char lastCode_[55]; // last error code
|
||||
char serviceCode_[4]; // 3 character status/service code
|
||||
uint16_t serviceCodeNumber_; // error/service code
|
||||
uint8_t emergencyOps_;
|
||||
@@ -245,7 +245,6 @@ class Boiler : public EMSdevice {
|
||||
|
||||
// commands - none of these use the additional id parameter
|
||||
bool set_ww_mode(const char * value, const int8_t id);
|
||||
bool set_ww_mode1(const char * value, const int8_t id);
|
||||
bool set_ww_activated(const char * value, const int8_t id);
|
||||
bool set_tapwarmwater_activated(const char * value, const int8_t id);
|
||||
bool set_ww_onetime(const char * value, const int8_t id);
|
||||
|
||||
@@ -27,7 +27,7 @@ Controller::Controller(uint8_t device_type, uint8_t device_id, uint8_t product_i
|
||||
// IVT broadcasts Thermostat time from controller (0x09) if display is off.
|
||||
if ((flags & 0x0F) == EMS_DEVICE_FLAG_IVT) {
|
||||
register_telegram_type(0x06, F("RCTime"), false, MAKE_PF_CB(process_dateTime));
|
||||
register_device_value(DeviceValueTAG::TAG_NONE, &dateTime_, DeviceValueType::STRING, nullptr, FL_(dateTime), DeviceValueUOM::NONE);
|
||||
register_device_value(DeviceValueTAG::TAG_DEVICE_DATA, &dateTime_, DeviceValueType::STRING, nullptr, FL_(dateTime), DeviceValueUOM::NONE);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -2418,9 +2418,10 @@ bool Thermostat::set_reducemode(const char * value, const int8_t id) {
|
||||
}
|
||||
|
||||
uint8_t set = 0xFF;
|
||||
if (model() == EMS_DEVICE_FLAG_RC300) {
|
||||
if (model() == EMS_DEVICE_FLAG_RC300 || model() == EMS_DEVICE_FLAG_RC100) {
|
||||
if (Helpers::value2enum(value, set, FL_(enum_reducemode1))) {
|
||||
write_command(set_typeids[hc->hc()], 5, set + 1, set_typeids[hc->hc()]);
|
||||
return true;
|
||||
}
|
||||
} else {
|
||||
if (Helpers::value2enum(value, set, FL_(enum_reducemode))) {
|
||||
@@ -2428,7 +2429,7 @@ bool Thermostat::set_reducemode(const char * value, const int8_t id) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return true;
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
@@ -2489,8 +2490,8 @@ bool Thermostat::set_heatingtype(const char * value, const int8_t id) {
|
||||
write_command(curve_typeids[hc->hc()], 0, set, curve_typeids[hc->hc()]);
|
||||
} else {
|
||||
write_command(curve_typeids[hc->hc()], 1, set, curve_typeids[hc->hc()]);
|
||||
return true;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
@@ -3760,7 +3761,7 @@ void Thermostat::register_device_values() {
|
||||
DeviceValueUOM::NONE,
|
||||
MAKE_CF_CB(set_energyCostRatio),
|
||||
0,
|
||||
19.9);
|
||||
20);
|
||||
register_device_value(DeviceValueTAG::TAG_DEVICE_DATA,
|
||||
&fossileFactor_,
|
||||
DeviceValueType::UINT,
|
||||
|
||||
@@ -245,7 +245,7 @@ bool EMSdevice::is_fetch(uint16_t telegram_id) const {
|
||||
}
|
||||
|
||||
// check for a tag to create a nest
|
||||
bool EMSdevice::has_tag(const uint8_t tag) {
|
||||
bool EMSdevice::has_tag(const uint8_t tag) const {
|
||||
for (const auto & dv : devicevalues_) {
|
||||
if (dv.tag == tag && tag >= DeviceValueTAG::TAG_HC1) {
|
||||
return true;
|
||||
@@ -573,7 +573,7 @@ void EMSdevice::publish_value(void * value_p) const {
|
||||
}
|
||||
|
||||
int8_t divider = (dv.options_size == 1) ? Helpers::atoint(read_flash_string(dv.options[0]).c_str()) : 0;
|
||||
char payload[50] = {'\0'};
|
||||
char payload[55] = {'\0'};
|
||||
uint8_t fahrenheit = !EMSESP::system_.fahrenheit() ? 0 : (dv.uom == DeviceValueUOM::DEGREES) ? 2 : (dv.uom == DeviceValueUOM::DEGREES_R) ? 1 : 0;
|
||||
|
||||
switch (dv.type) {
|
||||
|
||||
@@ -52,7 +52,7 @@ class EMSdevice {
|
||||
static std::string tag_to_string(uint8_t tag);
|
||||
static std::string tag_to_mqtt(uint8_t tag);
|
||||
|
||||
bool has_tag(const uint8_t tag);
|
||||
bool has_tag(const uint8_t tag) const;
|
||||
|
||||
inline uint8_t device_id() const {
|
||||
return device_id_;
|
||||
|
||||
Reference in New Issue
Block a user