Rename index -> channel

This commit is contained in:
Jimmy Wennlund 2024-09-09 00:18:28 +02:00
parent 98e184a339
commit c9bb6e0bc0

View File

@ -16,26 +16,26 @@ class BL0910 : public PollingComponent,
public spi::SPIDevice<spi::BIT_ORDER_MSB_FIRST, spi::CLOCK_POLARITY_LOW, spi::CLOCK_PHASE_TRAILING,
spi::DATA_RATE_1MHZ> {
public:
// Sensor index is 1-based to match the BL0910 documentation
// Sensor channel is 1-based to match the BL0910 documentation
// but the array is 0-based to save memory and simplify code
void set_voltage_sensor(sensor::Sensor *voltage_sensor, int index, float voltage_reference) {
this->voltage_sensor_[index - 1] = voltage_sensor;
this->voltage_reference_[index - 1] = voltage_reference;
void set_voltage_sensor(sensor::Sensor *voltage_sensor, int channel, float voltage_reference) {
this->voltage_sensor_[channel - 1] = voltage_sensor;
this->voltage_reference_[channel - 1] = voltage_reference;
}
void set_current_sensor(sensor::Sensor *current_sensor, int index, float current_reference) {
this->current_sensor_[index - 1] = current_sensor;
this->current_reference_[index - 1] = current_reference;
void set_current_sensor(sensor::Sensor *current_sensor, int channel, float current_reference) {
this->current_sensor_[channel - 1] = current_sensor;
this->current_reference_[channel - 1] = current_reference;
}
void set_power_sensor(sensor::Sensor *power_sensor, int index, float power_reference) {
this->power_sensor_[index - 1] = power_sensor;
this->power_reference_[index - 1] = power_reference;
void set_power_sensor(sensor::Sensor *power_sensor, int channel, float power_reference) {
this->power_sensor_[channel - 1] = power_sensor;
this->power_reference_[channel - 1] = power_reference;
}
void set_energy_sensor(sensor::Sensor *energy_sensor, int index, float energy_reference) {
this->energy_sensor_[index - 1] = energy_sensor;
this->energy_reference_[index - 1] = energy_reference;
void set_energy_sensor(sensor::Sensor *energy_sensor, int channel, float energy_reference) {
this->energy_sensor_[channel - 1] = energy_sensor;
this->energy_reference_[channel - 1] = energy_reference;
}
void set_power_factor_sensor(sensor::Sensor *power_factor_sensor, int index) {
this->power_factor_sensor_[index - 1] = power_factor_sensor;
void set_power_factor_sensor(sensor::Sensor *power_factor_sensor, int channel) {
this->power_factor_sensor_[channel - 1] = power_factor_sensor;
}
void set_frequency_sensor(sensor::Sensor *frequency_sensor) { this->frequency_sensor_ = frequency_sensor; }
void set_temperature_sensor(sensor::Sensor *temperature_sensor) { this->temperature_sensor_ = temperature_sensor; }