mirror of
https://github.com/esphome/esphome.git
synced 2026-06-01 01:19:45 +08:00
[nextion] Collapse nested namespace to esphome::nextion (#15367)
This commit is contained in:
@@ -2,8 +2,7 @@
|
|||||||
#include "esphome/core/automation.h"
|
#include "esphome/core/automation.h"
|
||||||
#include "nextion.h"
|
#include "nextion.h"
|
||||||
|
|
||||||
namespace esphome {
|
namespace esphome::nextion {
|
||||||
namespace nextion {
|
|
||||||
|
|
||||||
template<typename... Ts> class NextionSetBrightnessAction : public Action<Ts...> {
|
template<typename... Ts> class NextionSetBrightnessAction : public Action<Ts...> {
|
||||||
public:
|
public:
|
||||||
@@ -91,5 +90,4 @@ template<typename... Ts> class NextionPublishBoolAction : public Action<Ts...> {
|
|||||||
NextionComponent *component_;
|
NextionComponent *component_;
|
||||||
};
|
};
|
||||||
|
|
||||||
} // namespace nextion
|
} // namespace esphome::nextion
|
||||||
} // namespace esphome
|
|
||||||
|
|||||||
@@ -2,8 +2,7 @@
|
|||||||
#include "esphome/core/util.h"
|
#include "esphome/core/util.h"
|
||||||
#include "esphome/core/log.h"
|
#include "esphome/core/log.h"
|
||||||
|
|
||||||
namespace esphome {
|
namespace esphome::nextion {
|
||||||
namespace nextion {
|
|
||||||
|
|
||||||
static const char *const TAG = "nextion_binarysensor";
|
static const char *const TAG = "nextion_binarysensor";
|
||||||
|
|
||||||
@@ -64,5 +63,4 @@ void NextionBinarySensor::set_state(bool state, bool publish, bool send_to_nexti
|
|||||||
ESP_LOGN(TAG, "Write: %s=%s", this->variable_name_.c_str(), ONOFF(this->state));
|
ESP_LOGN(TAG, "Write: %s=%s", this->variable_name_.c_str(), ONOFF(this->state));
|
||||||
}
|
}
|
||||||
|
|
||||||
} // namespace nextion
|
} // namespace esphome::nextion
|
||||||
} // namespace esphome
|
|
||||||
|
|||||||
@@ -4,8 +4,8 @@
|
|||||||
#include "../nextion_component.h"
|
#include "../nextion_component.h"
|
||||||
#include "../nextion_base.h"
|
#include "../nextion_base.h"
|
||||||
|
|
||||||
namespace esphome {
|
namespace esphome::nextion {
|
||||||
namespace nextion {
|
|
||||||
class NextionBinarySensor;
|
class NextionBinarySensor;
|
||||||
|
|
||||||
class NextionBinarySensor : public NextionComponent,
|
class NextionBinarySensor : public NextionComponent,
|
||||||
@@ -38,5 +38,4 @@ class NextionBinarySensor : public NextionComponent,
|
|||||||
protected:
|
protected:
|
||||||
uint8_t page_id_;
|
uint8_t page_id_;
|
||||||
};
|
};
|
||||||
} // namespace nextion
|
} // namespace esphome::nextion
|
||||||
} // namespace esphome
|
|
||||||
|
|||||||
@@ -5,8 +5,7 @@
|
|||||||
#include "esphome/core/log.h"
|
#include "esphome/core/log.h"
|
||||||
#include "esphome/core/util.h"
|
#include "esphome/core/util.h"
|
||||||
|
|
||||||
namespace esphome {
|
namespace esphome::nextion {
|
||||||
namespace nextion {
|
|
||||||
|
|
||||||
static const char *const TAG = "nextion";
|
static const char *const TAG = "nextion";
|
||||||
|
|
||||||
@@ -1290,5 +1289,4 @@ void Nextion::set_writer(const nextion_writer_t &writer) { this->writer_ = write
|
|||||||
|
|
||||||
bool Nextion::is_updating() { return this->connection_state_.is_updating_; }
|
bool Nextion::is_updating() { return this->connection_state_.is_updating_; }
|
||||||
|
|
||||||
} // namespace nextion
|
} // namespace esphome::nextion
|
||||||
} // namespace esphome
|
|
||||||
|
|||||||
@@ -21,8 +21,7 @@
|
|||||||
#endif // USE_ESP32 vs USE_ESP8266
|
#endif // USE_ESP32 vs USE_ESP8266
|
||||||
#endif // USE_NEXTION_TFT_UPLOAD
|
#endif // USE_NEXTION_TFT_UPLOAD
|
||||||
|
|
||||||
namespace esphome {
|
namespace esphome::nextion {
|
||||||
namespace nextion {
|
|
||||||
|
|
||||||
class Nextion;
|
class Nextion;
|
||||||
class NextionComponentBase;
|
class NextionComponentBase;
|
||||||
@@ -1547,5 +1546,4 @@ class Nextion : public NextionBase, public PollingComponent, public uart::UARTDe
|
|||||||
uint16_t max_q_age_ms_ = 8000; ///< Maximum age for queue items in ms
|
uint16_t max_q_age_ms_ = 8000; ///< Maximum age for queue items in ms
|
||||||
};
|
};
|
||||||
|
|
||||||
} // namespace nextion
|
} // namespace esphome::nextion
|
||||||
} // namespace esphome
|
|
||||||
|
|||||||
@@ -2,8 +2,8 @@
|
|||||||
#include "esphome/core/defines.h"
|
#include "esphome/core/defines.h"
|
||||||
#include "esphome/core/color.h"
|
#include "esphome/core/color.h"
|
||||||
#include "nextion_component_base.h"
|
#include "nextion_component_base.h"
|
||||||
namespace esphome {
|
|
||||||
namespace nextion {
|
namespace esphome::nextion {
|
||||||
|
|
||||||
#ifdef ESPHOME_LOG_HAS_VERY_VERBOSE
|
#ifdef ESPHOME_LOG_HAS_VERY_VERBOSE
|
||||||
#define NEXTION_PROTOCOL_LOG
|
#define NEXTION_PROTOCOL_LOG
|
||||||
@@ -61,5 +61,4 @@ class NextionBase {
|
|||||||
bool is_detected_ = false;
|
bool is_detected_ = false;
|
||||||
};
|
};
|
||||||
|
|
||||||
} // namespace nextion
|
} // namespace esphome::nextion
|
||||||
} // namespace esphome
|
|
||||||
|
|||||||
@@ -3,8 +3,8 @@
|
|||||||
#include "esphome/core/log.h"
|
#include "esphome/core/log.h"
|
||||||
#include <cinttypes>
|
#include <cinttypes>
|
||||||
|
|
||||||
namespace esphome {
|
namespace esphome::nextion {
|
||||||
namespace nextion {
|
|
||||||
static const char *const TAG = "nextion";
|
static const char *const TAG = "nextion";
|
||||||
|
|
||||||
// Sleep safe commands
|
// Sleep safe commands
|
||||||
@@ -340,5 +340,4 @@ void Nextion::set_nextion_rtc_time(ESPTime time) {
|
|||||||
this->add_no_result_to_queue_with_printf_("rtc5", "rtc5=%u", time.second);
|
this->add_no_result_to_queue_with_printf_("rtc5", "rtc5=%u", time.second);
|
||||||
}
|
}
|
||||||
|
|
||||||
} // namespace nextion
|
} // namespace esphome::nextion
|
||||||
} // namespace esphome
|
|
||||||
|
|||||||
@@ -1,7 +1,6 @@
|
|||||||
#include "nextion_component.h"
|
#include "nextion_component.h"
|
||||||
|
|
||||||
namespace esphome {
|
namespace esphome::nextion {
|
||||||
namespace nextion {
|
|
||||||
|
|
||||||
void NextionComponent::set_background_color(Color bco) {
|
void NextionComponent::set_background_color(Color bco) {
|
||||||
if (this->variable_name_ == this->variable_name_to_send_) {
|
if (this->variable_name_ == this->variable_name_to_send_) {
|
||||||
@@ -110,5 +109,4 @@ void NextionComponent::update_component_settings(bool force_update) {
|
|||||||
this->component_flags_.font_id_needs_update = false;
|
this->component_flags_.font_id_needs_update = false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} // namespace nextion
|
} // namespace esphome::nextion
|
||||||
} // namespace esphome
|
|
||||||
|
|||||||
@@ -3,8 +3,8 @@
|
|||||||
#include "esphome/core/color.h"
|
#include "esphome/core/color.h"
|
||||||
#include "nextion_base.h"
|
#include "nextion_base.h"
|
||||||
|
|
||||||
namespace esphome {
|
namespace esphome::nextion {
|
||||||
namespace nextion {
|
|
||||||
class NextionComponent;
|
class NextionComponent;
|
||||||
|
|
||||||
class NextionComponent : public NextionComponentBase {
|
class NextionComponent : public NextionComponentBase {
|
||||||
@@ -80,5 +80,4 @@ class NextionComponent : public NextionComponentBase {
|
|||||||
uint16_t reserved : 3;
|
uint16_t reserved : 3;
|
||||||
} component_flags_;
|
} component_flags_;
|
||||||
};
|
};
|
||||||
} // namespace nextion
|
} // namespace esphome::nextion
|
||||||
} // namespace esphome
|
|
||||||
|
|||||||
@@ -5,8 +5,7 @@
|
|||||||
#include <vector>
|
#include <vector>
|
||||||
#include "esphome/core/defines.h"
|
#include "esphome/core/defines.h"
|
||||||
|
|
||||||
namespace esphome {
|
namespace esphome::nextion {
|
||||||
namespace nextion {
|
|
||||||
|
|
||||||
enum NextionQueueType {
|
enum NextionQueueType {
|
||||||
NO_RESULT = 0,
|
NO_RESULT = 0,
|
||||||
@@ -102,5 +101,4 @@ class NextionComponentBase {
|
|||||||
|
|
||||||
bool needs_to_send_update_;
|
bool needs_to_send_update_;
|
||||||
};
|
};
|
||||||
} // namespace nextion
|
} // namespace esphome::nextion
|
||||||
} // namespace esphome
|
|
||||||
|
|||||||
@@ -4,8 +4,8 @@
|
|||||||
|
|
||||||
#include "esphome/core/application.h"
|
#include "esphome/core/application.h"
|
||||||
|
|
||||||
namespace esphome {
|
namespace esphome::nextion {
|
||||||
namespace nextion {
|
|
||||||
static const char *const TAG = "nextion.upload";
|
static const char *const TAG = "nextion.upload";
|
||||||
|
|
||||||
bool Nextion::upload_end_(bool successful) {
|
bool Nextion::upload_end_(bool successful) {
|
||||||
@@ -33,7 +33,6 @@ bool Nextion::upload_end_(bool successful) {
|
|||||||
return successful;
|
return successful;
|
||||||
}
|
}
|
||||||
|
|
||||||
} // namespace nextion
|
} // namespace esphome::nextion
|
||||||
} // namespace esphome
|
|
||||||
|
|
||||||
#endif // USE_NEXTION_TFT_UPLOAD
|
#endif // USE_NEXTION_TFT_UPLOAD
|
||||||
|
|||||||
@@ -11,8 +11,8 @@
|
|||||||
#include "esphome/core/log.h"
|
#include "esphome/core/log.h"
|
||||||
#include "esphome/core/util.h"
|
#include "esphome/core/util.h"
|
||||||
|
|
||||||
namespace esphome {
|
namespace esphome::nextion {
|
||||||
namespace nextion {
|
|
||||||
static const char *const TAG = "nextion.upload.arduino";
|
static const char *const TAG = "nextion.upload.arduino";
|
||||||
static constexpr size_t NEXTION_MAX_RESPONSE_LOG_BYTES = 16;
|
static constexpr size_t NEXTION_MAX_RESPONSE_LOG_BYTES = 16;
|
||||||
|
|
||||||
@@ -342,8 +342,7 @@ WiFiClient *Nextion::get_wifi_client_() {
|
|||||||
}
|
}
|
||||||
#endif // USE_ESP8266
|
#endif // USE_ESP8266
|
||||||
|
|
||||||
} // namespace nextion
|
} // namespace esphome::nextion
|
||||||
} // namespace esphome
|
|
||||||
|
|
||||||
#endif // NOT USE_ESP32
|
#endif // NOT USE_ESP32
|
||||||
#endif // USE_NEXTION_TFT_UPLOAD
|
#endif // USE_NEXTION_TFT_UPLOAD
|
||||||
|
|||||||
@@ -14,8 +14,8 @@
|
|||||||
#include "esphome/core/log.h"
|
#include "esphome/core/log.h"
|
||||||
#include "esphome/core/util.h"
|
#include "esphome/core/util.h"
|
||||||
|
|
||||||
namespace esphome {
|
namespace esphome::nextion {
|
||||||
namespace nextion {
|
|
||||||
static const char *const TAG = "nextion.upload.esp32";
|
static const char *const TAG = "nextion.upload.esp32";
|
||||||
static constexpr size_t NEXTION_MAX_RESPONSE_LOG_BYTES = 16;
|
static constexpr size_t NEXTION_MAX_RESPONSE_LOG_BYTES = 16;
|
||||||
|
|
||||||
@@ -344,8 +344,7 @@ bool Nextion::upload_tft(uint32_t baud_rate, bool exit_reparse) {
|
|||||||
return this->upload_end_(true);
|
return this->upload_end_(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
} // namespace nextion
|
} // namespace esphome::nextion
|
||||||
} // namespace esphome
|
|
||||||
|
|
||||||
#endif // USE_ESP32
|
#endif // USE_ESP32
|
||||||
#endif // USE_NEXTION_TFT_UPLOAD
|
#endif // USE_NEXTION_TFT_UPLOAD
|
||||||
|
|||||||
@@ -2,8 +2,7 @@
|
|||||||
#include "esphome/core/util.h"
|
#include "esphome/core/util.h"
|
||||||
#include "esphome/core/log.h"
|
#include "esphome/core/log.h"
|
||||||
|
|
||||||
namespace esphome {
|
namespace esphome::nextion {
|
||||||
namespace nextion {
|
|
||||||
|
|
||||||
static const char *const TAG = "nextion_sensor";
|
static const char *const TAG = "nextion_sensor";
|
||||||
|
|
||||||
@@ -108,5 +107,4 @@ void NextionSensor::wave_update_() {
|
|||||||
this->nextion_->add_addt_command_to_queue(this);
|
this->nextion_->add_addt_command_to_queue(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
} // namespace nextion
|
} // namespace esphome::nextion
|
||||||
} // namespace esphome
|
|
||||||
|
|||||||
@@ -4,8 +4,8 @@
|
|||||||
#include "../nextion_component.h"
|
#include "../nextion_component.h"
|
||||||
#include "../nextion_base.h"
|
#include "../nextion_base.h"
|
||||||
|
|
||||||
namespace esphome {
|
namespace esphome::nextion {
|
||||||
namespace nextion {
|
|
||||||
class NextionSensor;
|
class NextionSensor;
|
||||||
|
|
||||||
class NextionSensor : public NextionComponent, public sensor::Sensor, public PollingComponent {
|
class NextionSensor : public NextionComponent, public sensor::Sensor, public PollingComponent {
|
||||||
@@ -44,5 +44,4 @@ class NextionSensor : public NextionComponent, public sensor::Sensor, public Pol
|
|||||||
bool send_last_value_ = true;
|
bool send_last_value_ = true;
|
||||||
void wave_update_();
|
void wave_update_();
|
||||||
};
|
};
|
||||||
} // namespace nextion
|
} // namespace esphome::nextion
|
||||||
} // namespace esphome
|
|
||||||
|
|||||||
@@ -2,8 +2,7 @@
|
|||||||
#include "esphome/core/util.h"
|
#include "esphome/core/util.h"
|
||||||
#include "esphome/core/log.h"
|
#include "esphome/core/log.h"
|
||||||
|
|
||||||
namespace esphome {
|
namespace esphome::nextion {
|
||||||
namespace nextion {
|
|
||||||
|
|
||||||
static const char *const TAG = "nextion_switch";
|
static const char *const TAG = "nextion_switch";
|
||||||
|
|
||||||
@@ -48,5 +47,4 @@ void NextionSwitch::set_state(bool state, bool publish, bool send_to_nextion) {
|
|||||||
|
|
||||||
void NextionSwitch::write_state(bool state) { this->set_state(state); }
|
void NextionSwitch::write_state(bool state) { this->set_state(state); }
|
||||||
|
|
||||||
} // namespace nextion
|
} // namespace esphome::nextion
|
||||||
} // namespace esphome
|
|
||||||
|
|||||||
@@ -4,8 +4,8 @@
|
|||||||
#include "../nextion_component.h"
|
#include "../nextion_component.h"
|
||||||
#include "../nextion_base.h"
|
#include "../nextion_base.h"
|
||||||
|
|
||||||
namespace esphome {
|
namespace esphome::nextion {
|
||||||
namespace nextion {
|
|
||||||
class NextionSwitch;
|
class NextionSwitch;
|
||||||
|
|
||||||
class NextionSwitch : public NextionComponent, public switch_::Switch, public PollingComponent {
|
class NextionSwitch : public NextionComponent, public switch_::Switch, public PollingComponent {
|
||||||
@@ -30,5 +30,4 @@ class NextionSwitch : public NextionComponent, public switch_::Switch, public Po
|
|||||||
protected:
|
protected:
|
||||||
void write_state(bool state) override;
|
void write_state(bool state) override;
|
||||||
};
|
};
|
||||||
} // namespace nextion
|
} // namespace esphome::nextion
|
||||||
} // namespace esphome
|
|
||||||
|
|||||||
@@ -2,8 +2,8 @@
|
|||||||
#include "esphome/core/util.h"
|
#include "esphome/core/util.h"
|
||||||
#include "esphome/core/log.h"
|
#include "esphome/core/log.h"
|
||||||
|
|
||||||
namespace esphome {
|
namespace esphome::nextion {
|
||||||
namespace nextion {
|
|
||||||
static const char *const TAG = "nextion_textsensor";
|
static const char *const TAG = "nextion_textsensor";
|
||||||
|
|
||||||
void NextionTextSensor::process_text(const std::string &variable_name, const std::string &text_value) {
|
void NextionTextSensor::process_text(const std::string &variable_name, const std::string &text_value) {
|
||||||
@@ -45,5 +45,4 @@ void NextionTextSensor::set_state(const std::string &state, bool publish, bool s
|
|||||||
ESP_LOGN(TAG, "Write: %s='%s'", this->variable_name_.c_str(), state.c_str());
|
ESP_LOGN(TAG, "Write: %s='%s'", this->variable_name_.c_str(), state.c_str());
|
||||||
}
|
}
|
||||||
|
|
||||||
} // namespace nextion
|
} // namespace esphome::nextion
|
||||||
} // namespace esphome
|
|
||||||
|
|||||||
@@ -4,8 +4,8 @@
|
|||||||
#include "../nextion_component.h"
|
#include "../nextion_component.h"
|
||||||
#include "../nextion_base.h"
|
#include "../nextion_base.h"
|
||||||
|
|
||||||
namespace esphome {
|
namespace esphome::nextion {
|
||||||
namespace nextion {
|
|
||||||
class NextionTextSensor;
|
class NextionTextSensor;
|
||||||
|
|
||||||
class NextionTextSensor : public NextionComponent, public text_sensor::TextSensor, public PollingComponent {
|
class NextionTextSensor : public NextionComponent, public text_sensor::TextSensor, public PollingComponent {
|
||||||
@@ -28,5 +28,4 @@ class NextionTextSensor : public NextionComponent, public text_sensor::TextSenso
|
|||||||
this->set_state(state_value, publish, send_to_nextion);
|
this->set_state(state_value, publish, send_to_nextion);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
} // namespace nextion
|
} // namespace esphome::nextion
|
||||||
} // namespace esphome
|
|
||||||
|
|||||||
Reference in New Issue
Block a user