mirror of
https://github.com/emsesp/EMS-ESP32.git
synced 2025-12-07 08:19:52 +03:00
rename snprintf_P to snprintf
This commit is contained in:
@@ -110,23 +110,23 @@ bool Mixer::publish_ha_config() {
|
||||
|
||||
char uniq_id[20];
|
||||
if (type_ == Type::MP) {
|
||||
snprintf_P(uniq_id, sizeof(uniq_id), "MixerMP");
|
||||
snprintf(uniq_id, sizeof(uniq_id), "MixerMP");
|
||||
} else {
|
||||
snprintf_P(uniq_id, sizeof(uniq_id), "Mixer%02X", device_id() - 0x20 + 1);
|
||||
snprintf(uniq_id, sizeof(uniq_id), "Mixer%02X", device_id() - 0x20 + 1);
|
||||
}
|
||||
doc["uniq_id"] = uniq_id;
|
||||
|
||||
doc["ic"] = F_(icondevice);
|
||||
|
||||
char stat_t[Mqtt::MQTT_TOPIC_MAX_SIZE];
|
||||
snprintf_P(stat_t, sizeof(stat_t), "%s/%s", Mqtt::base().c_str(), Mqtt::tag_to_topic(device_type(), DeviceValueTAG::TAG_NONE).c_str());
|
||||
snprintf(stat_t, sizeof(stat_t), "%s/%s", Mqtt::base().c_str(), Mqtt::tag_to_topic(device_type(), DeviceValueTAG::TAG_NONE).c_str());
|
||||
doc["stat_t"] = stat_t;
|
||||
|
||||
char name[20];
|
||||
if (type_ == Type::MP) {
|
||||
snprintf_P(name, sizeof(name), "Mixer MP");
|
||||
snprintf(name, sizeof(name), "Mixer MP");
|
||||
} else {
|
||||
snprintf_P(name, sizeof(name), "Mixer %02X", device_id() - 0x20 + 1);
|
||||
snprintf(name, sizeof(name), "Mixer %02X", device_id() - 0x20 + 1);
|
||||
}
|
||||
doc["name"] = name;
|
||||
|
||||
@@ -151,11 +151,11 @@ bool Mixer::publish_ha_config() {
|
||||
// determine the topic, if its HC and WWC. This is determined by the incoming telegram types.
|
||||
std::string topic(Mqtt::MQTT_TOPIC_MAX_SIZE, '\0');
|
||||
if (type_ == Type::HC) {
|
||||
snprintf_P(&topic[0], topic.capacity() + 1, "sensor/%s/mixer_hc%d/config", Mqtt::base().c_str(), hc_);
|
||||
snprintf(&topic[0], topic.capacity() + 1, "sensor/%s/mixer_hc%d/config", Mqtt::base().c_str(), hc_);
|
||||
} else if (type_ == Type::WWC) {
|
||||
snprintf_P(&topic[0], topic.capacity() + 1, "sensor/%s/mixer_wwc%d/config", Mqtt::base().c_str(), hc_); // WWC
|
||||
snprintf(&topic[0], topic.capacity() + 1, "sensor/%s/mixer_wwc%d/config", Mqtt::base().c_str(), hc_); // WWC
|
||||
} else if (type_ == Type::MP) {
|
||||
snprintf_P(&topic[0], topic.capacity() + 1, "sensor/%s/mixer_mp/config", Mqtt::base().c_str());
|
||||
snprintf(&topic[0], topic.capacity() + 1, "sensor/%s/mixer_mp/config", Mqtt::base().c_str());
|
||||
}
|
||||
|
||||
Mqtt::publish_ha(topic, doc.as<JsonObject>()); // publish the config payload with retain flag
|
||||
|
||||
Reference in New Issue
Block a user