ESPHome  2022.11.3
debug_component.h
Go to the documentation of this file.
1 #pragma once
2 
4 #include "esphome/core/defines.h"
5 #include "esphome/core/macros.h"
6 #include "esphome/core/helpers.h"
7 
8 #ifdef USE_SENSOR
10 #endif
11 #ifdef USE_TEXT_SENSOR
13 #endif
14 
15 namespace esphome {
16 namespace debug {
17 
19  public:
20  void loop() override;
21  void update() override;
22  float get_setup_priority() const override;
23  void dump_config() override;
24 
25 #ifdef USE_TEXT_SENSOR
26  void set_device_info_sensor(text_sensor::TextSensor *device_info) { device_info_ = device_info; }
27 #endif // USE_TEXT_SENSOR
28 #ifdef USE_SENSOR
29  void set_free_sensor(sensor::Sensor *free_sensor) { free_sensor_ = free_sensor; }
30  void set_block_sensor(sensor::Sensor *block_sensor) { block_sensor_ = block_sensor; }
31 #if defined(USE_ESP8266) && USE_ARDUINO_VERSION_CODE >= VERSION_CODE(2, 5, 2)
32  void set_fragmentation_sensor(sensor::Sensor *fragmentation_sensor) { fragmentation_sensor_ = fragmentation_sensor; }
33 #endif
34  void set_loop_time_sensor(sensor::Sensor *loop_time_sensor) { loop_time_sensor_ = loop_time_sensor; }
35 #endif // USE_SENSOR
36  protected:
37  uint32_t free_heap_{};
38 
39 #ifdef USE_SENSOR
40  uint32_t last_loop_timetag_{0};
41  uint32_t max_loop_time_{0};
42 
45 #if defined(USE_ESP8266) && USE_ARDUINO_VERSION_CODE >= VERSION_CODE(2, 5, 2)
47 #endif
49 #endif // USE_SENSOR
50 
51 #ifdef USE_TEXT_SENSOR
53 #endif // USE_TEXT_SENSOR
54 };
55 
56 } // namespace debug
57 } // namespace esphome
void set_device_info_sensor(text_sensor::TextSensor *device_info)
void set_loop_time_sensor(sensor::Sensor *loop_time_sensor)
text_sensor::TextSensor * device_info_
This class simplifies creating components that periodically check a state.
Definition: component.h:267
void set_fragmentation_sensor(sensor::Sensor *fragmentation_sensor)
void set_block_sensor(sensor::Sensor *block_sensor)
sensor::Sensor * loop_time_sensor_
float get_setup_priority() const override
sensor::Sensor * fragmentation_sensor_
Definition: a4988.cpp:4
Base-class for all sensors.
Definition: sensor.h:48
void set_free_sensor(sensor::Sensor *free_sensor)