mirror of
https://github.com/emsesp/EMS-ESP32.git
synced 2025-12-06 07:49:52 +03:00
lint warning changes
This commit is contained in:
@@ -899,17 +899,17 @@ app.get(EMSESP_STATUS_ENDPOINT, (req, res) => {
|
||||
})
|
||||
app.post(EMSESP_DEVICEDATA_ENDPOINT, (req, res) => {
|
||||
const id = req.body.id
|
||||
if (id == 1) {
|
||||
if (id === 1) {
|
||||
const encoded = msgpack.encode(emsesp_devicedata_1)
|
||||
res.write(encoded, 'binary')
|
||||
res.end(null, 'binary')
|
||||
}
|
||||
if (id == 2) {
|
||||
if (id === 2) {
|
||||
const encoded = msgpack.encode(emsesp_devicedata_2)
|
||||
res.write(encoded, 'binary')
|
||||
res.end(null, 'binary')
|
||||
}
|
||||
if (id == 3) {
|
||||
if (id === 3) {
|
||||
const encoded = msgpack.encode(emsesp_devicedata_3)
|
||||
res.write(encoded, 'binary')
|
||||
res.end(null, 'binary')
|
||||
|
||||
@@ -36,14 +36,14 @@ char * Helpers::hextoa(char * result, const uint8_t value) {
|
||||
#ifdef EMSESP_STANDALONE
|
||||
// special function to work outside of ESP's libraries
|
||||
char * Helpers::ultostr(char * ptr, uint32_t value, const uint8_t base) {
|
||||
unsigned long t = 0, res = 0;
|
||||
unsigned long tmp = value;
|
||||
int count = 0;
|
||||
|
||||
if (NULL == ptr) {
|
||||
return NULL;
|
||||
}
|
||||
|
||||
unsigned long t = 0;
|
||||
unsigned long tmp = value;
|
||||
int count = 0;
|
||||
|
||||
if (tmp == 0) {
|
||||
count++;
|
||||
}
|
||||
@@ -57,6 +57,8 @@ char * Helpers::ultostr(char * ptr, uint32_t value, const uint8_t base) {
|
||||
|
||||
*ptr = '\0';
|
||||
|
||||
unsigned long res = 0;
|
||||
|
||||
do {
|
||||
res = value - base * (t = value / base);
|
||||
if (res < 10) {
|
||||
|
||||
@@ -107,8 +107,8 @@ void Mqtt::register_command(const uint8_t device_type, const __FlashStringHelper
|
||||
|
||||
// register the individual commands too (e.g. ems-esp/boiler/wwonetime)
|
||||
// https://github.com/emsesp/EMS-ESP32/issues/31
|
||||
std::string topic(MQTT_TOPIC_MAX_SIZE, '\0');
|
||||
if (subscribe_format_ == Subscribe_Format::INDIVIDUAL_ALL_HC && ((flags & CommandFlag::MQTT_SUB_FLAG_HC) == CommandFlag::MQTT_SUB_FLAG_HC)) {
|
||||
std::string topic(MQTT_TOPIC_MAX_SIZE, '\0');
|
||||
topic = cmd_topic + "/hc1/" + uuid::read_flash_string(cmd);
|
||||
queue_subscribe_message(topic);
|
||||
topic = cmd_topic + "/hc2/" + uuid::read_flash_string(cmd);
|
||||
@@ -118,6 +118,7 @@ void Mqtt::register_command(const uint8_t device_type, const __FlashStringHelper
|
||||
topic = cmd_topic + "/hc4/" + uuid::read_flash_string(cmd);
|
||||
queue_subscribe_message(topic);
|
||||
} else if (subscribe_format_ != Subscribe_Format::GENERAL && ((flags & CommandFlag::MQTT_SUB_FLAG_NOSUB) == CommandFlag::MQTT_SUB_FLAG_NOSUB)) {
|
||||
std::string topic(MQTT_TOPIC_MAX_SIZE, '\0');
|
||||
topic = cmd_topic + "/" + uuid::read_flash_string(cmd);
|
||||
queue_subscribe_message(topic);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user