remove references to peak_current
the register is now used for thd Signed-off-by: Matthew Thode <mthode@mthode.org>
This commit is contained in:
@@ -43,9 +43,6 @@ void ATM90E36Component::loop() {
|
||||
if (this->phase_[phase].harmonic_active_power_sensor_ != nullptr)
|
||||
this->phase_[phase].harmonic_active_power_ = this->get_phase_harmonic_active_power_(phase);
|
||||
|
||||
// if (this->phase_[phase].peak_current_sensor_ != nullptr)
|
||||
// this->phase_[phase].peak_current_ = this->get_phase_peak_current_(phase);
|
||||
|
||||
// After the local store is collected we can publish them trusting they are within +-1 hardware sampling
|
||||
if (this->phase_[phase].voltage_sensor_ != nullptr)
|
||||
this->phase_[phase].voltage_sensor_->publish_state(this->get_local_phase_voltage_(phase));
|
||||
@@ -83,8 +80,6 @@ void ATM90E36Component::loop() {
|
||||
this->get_local_phase_harmonic_active_power_(phase));
|
||||
}
|
||||
|
||||
// if (this->phase_[phase].peak_current_sensor_ != nullptr)
|
||||
// this->phase_[phase].peak_current_sensor_->publish_state(this->get_local_phase_peak_current_(phase));
|
||||
}
|
||||
// THD values
|
||||
if (this->thd_voltage_a_sensor_ != nullptr) {
|
||||
@@ -240,7 +235,6 @@ void ATM90E36Component::dump_config() {
|
||||
LOG_SENSOR(" ", "Active Reverse Energy A", this->phase_[PHASEA].reverse_active_energy_sensor_);
|
||||
LOG_SENSOR(" ", "Harmonic Power A", this->phase_[PHASEA].harmonic_active_power_sensor_);
|
||||
LOG_SENSOR(" ", "Phase Angle A", this->phase_[PHASEA].phase_angle_sensor_);
|
||||
// LOG_SENSOR(" ", "Peak Current A", this->phase_[PHASEA].peak_current_sensor_);
|
||||
LOG_SENSOR(" ", "Voltage B", this->phase_[PHASEB].voltage_sensor_);
|
||||
LOG_SENSOR(" ", "Current B", this->phase_[PHASEB].current_sensor_);
|
||||
LOG_SENSOR(" ", "Power B", this->phase_[PHASEB].power_sensor_);
|
||||
@@ -253,7 +247,6 @@ void ATM90E36Component::dump_config() {
|
||||
LOG_SENSOR(" ", "Active Reverse Energy B", this->phase_[PHASEB].reverse_active_energy_sensor_);
|
||||
LOG_SENSOR(" ", "Harmonic Power B", this->phase_[PHASEB].harmonic_active_power_sensor_);
|
||||
LOG_SENSOR(" ", "Phase Angle B", this->phase_[PHASEB].phase_angle_sensor_);
|
||||
// LOG_SENSOR(" ", "Peak Current B", this->phase_[PHASEB].peak_current_sensor_);
|
||||
LOG_SENSOR(" ", "Voltage C", this->phase_[PHASEC].voltage_sensor_);
|
||||
LOG_SENSOR(" ", "Current C", this->phase_[PHASEC].current_sensor_);
|
||||
LOG_SENSOR(" ", "Power C", this->phase_[PHASEC].power_sensor_);
|
||||
@@ -266,7 +259,6 @@ void ATM90E36Component::dump_config() {
|
||||
LOG_SENSOR(" ", "Active Reverse Energy C", this->phase_[PHASEC].reverse_active_energy_sensor_);
|
||||
LOG_SENSOR(" ", "Harmonic Power C", this->phase_[PHASEC].harmonic_active_power_sensor_);
|
||||
LOG_SENSOR(" ", "Phase Angle C", this->phase_[PHASEC].phase_angle_sensor_);
|
||||
// LOG_SENSOR(" ", "Peak Current C", this->phase_[PHASEC].peak_current_sensor_);
|
||||
LOG_SENSOR(" ", "Frequency", this->freq_sensor_);
|
||||
LOG_SENSOR(" ", "Chip Temp", this->chip_temperature_sensor_);
|
||||
}
|
||||
@@ -362,8 +354,6 @@ float ATM90E36Component::get_local_phase_harmonic_active_power_(uint8_t phase) {
|
||||
return this->phase_[phase].harmonic_active_power_;
|
||||
}
|
||||
|
||||
//float ATM90E36Component::get_local_phase_peak_current_(uint8_t phase) { return this->phase_[phase].peak_current_; }
|
||||
|
||||
float ATM90E36Component::get_phase_voltage_(uint8_t phase) {
|
||||
uint16_t voltage = this->read16_(ATM90E36_REGISTER_URMS + phase);
|
||||
this->validate_spi_read_(voltage, "get_phase_voltage()");
|
||||
@@ -467,14 +457,6 @@ float ATM90E36Component::get_phase_angle_(uint8_t phase) {
|
||||
return (val > 180) ? (float) (val - 360.0f) : (float) val;
|
||||
}
|
||||
|
||||
//float ATM90E36Component::get_phase_peak_current_(uint8_t phase) {
|
||||
// int16_t val = (float) this->read16_(ATM90E36_REGISTER_IPEAK + phase);
|
||||
// if (!this->peak_current_signed_)
|
||||
// val = std::abs(val);
|
||||
// // phase register * phase current gain value / 1000 * 2^13
|
||||
// return (val * this->phase_[phase].ct_gain_ / 8192000.0);
|
||||
//}
|
||||
|
||||
float ATM90E36Component::get_frequency_() {
|
||||
const uint16_t freq = this->read16_(ATM90E36_REGISTER_FREQ);
|
||||
return (float) freq / 100;
|
||||
|
||||
Reference in New Issue
Block a user