rename bovl_v_ to bus_voltage_over_limit_v_

This commit is contained in:
assaf 2025-01-18 16:16:24 -08:00
parent 4babb7a285
commit a75bc504aa
2 changed files with 5 additions and 5 deletions

View File

@ -215,7 +215,7 @@ void INA2XX::dump_config() {
ESP_LOGCONFIG(TAG, " ADCRANGE = %d (%s)", (uint8_t) this->adc_range_, this->adc_range_ ? "±40.96 mV" : "±163.84 mV");
ESP_LOGCONFIG(TAG, " CURRENT_LSB = %f", this->current_lsb_);
ESP_LOGCONFIG(TAG, " SHUNT_CAL = %d", this->shunt_cal_);
ESP_LOGCONFIG(TAG, " BOVL = %f V", this->bovl_v_);
ESP_LOGCONFIG(TAG, " BUS_VOLTAGE_OVER_LIMIT = %f V", this->bus_voltage_over_limit_v_);
ESP_LOGCONFIG(TAG, " ADC Samples = %d; ADC times: Bus = %d μs, Shunt = %d μs, Temp = %d μs",
ADC_SAMPLES[0b111 & (uint8_t) this->adc_avg_samples_],
@ -380,8 +380,8 @@ bool INA2XX::configure_shunt_tempco_() {
bool INA2XX::configure_bus_voltage_over_limit_() {
// Only for 228/229
if ((this->ina_model_ == INAModel::INA_228 || this->ina_model_ == INAModel::INA_229) && this->bovl_v_ > 0) {
return this->write_unsigned_16_(RegisterMap::REG_BOVL, (uint16_t) (this->bovl_v_ * 1000 / 3.125));
if ((this->ina_model_ == INAModel::INA_228 || this->ina_model_ == INAModel::INA_229) && this->bus_voltage_over_limit_v_ > 0) {
return this->write_unsigned_16_(RegisterMap::REG_BOVL, (uint16_t) (this->bus_voltage_over_limit_v_ * 1000 / 3.125));
}
return true;
}

View File

@ -127,7 +127,7 @@ class INA2XX : public PollingComponent {
void set_adc_time_die_temperature(AdcTime time) { this->adc_time_die_temperature_ = time; }
void set_adc_avg_samples(AdcAvgSamples samples) { this->adc_avg_samples_ = samples; }
void set_shunt_tempco(uint16_t coeff) { this->shunt_tempco_ppm_c_ = coeff; }
void set_bus_voltage_over_limit_v(float bovl_v) { this->bovl_v_ = bovl_v; }
void set_bus_voltage_over_limit_v(float limit_v) { this->bus_voltage_over_limit_v_ = limit_v; }
void set_shunt_voltage_sensor(sensor::Sensor *sensor) { this->shunt_voltage_sensor_ = sensor; }
void set_bus_voltage_sensor(sensor::Sensor *sensor) { this->bus_voltage_sensor_ = sensor; }
@ -174,7 +174,7 @@ class INA2XX : public PollingComponent {
AdcTime adc_time_die_temperature_{AdcTime::ADC_TIME_4120US};
AdcAvgSamples adc_avg_samples_{AdcAvgSamples::ADC_AVG_SAMPLES_128};
uint16_t shunt_tempco_ppm_c_{0};
float bovl_v_;
float bus_voltage_over_limit_v_;
//
// Calculated coefficients