mirror of
https://github.com/Threnklyn/esphome-dev.git
synced 2026-06-07 13:24:56 +02:00
@@ -16,8 +16,17 @@ enum HLW8012SensorModels {
|
||||
HLW8012_SENSOR_MODEL_BL0937
|
||||
};
|
||||
|
||||
#ifdef HAS_PCNT
|
||||
#define USE_PCNT true
|
||||
#else
|
||||
#define USE_PCNT false
|
||||
#endif
|
||||
|
||||
class HLW8012Component : public PollingComponent {
|
||||
public:
|
||||
HLW8012Component()
|
||||
: cf_store_(*pulse_counter::get_storage(USE_PCNT)), cf1_store_(*pulse_counter::get_storage(USE_PCNT)) {}
|
||||
|
||||
void setup() override;
|
||||
void dump_config() override;
|
||||
float get_setup_priority() const override;
|
||||
@@ -49,9 +58,9 @@ class HLW8012Component : public PollingComponent {
|
||||
uint64_t cf_total_pulses_{0};
|
||||
GPIOPin *sel_pin_;
|
||||
InternalGPIOPin *cf_pin_;
|
||||
pulse_counter::PulseCounterStorage cf_store_;
|
||||
pulse_counter::PulseCounterStorageBase &cf_store_;
|
||||
InternalGPIOPin *cf1_pin_;
|
||||
pulse_counter::PulseCounterStorage cf1_store_;
|
||||
pulse_counter::PulseCounterStorageBase &cf1_store_;
|
||||
sensor::Sensor *voltage_sensor_{nullptr};
|
||||
sensor::Sensor *current_sensor_{nullptr};
|
||||
sensor::Sensor *power_sensor_{nullptr};
|
||||
|
||||
Reference in New Issue
Block a user