mirror of
https://github.com/esphome/esphome.git
synced 2024-11-24 12:06:26 +01:00
Fix ci complaints
This commit is contained in:
parent
4f1fed2899
commit
98e184a339
@ -10,7 +10,7 @@ namespace bl0910 {
|
|||||||
|
|
||||||
static const char *const TAG = "bl0910";
|
static const char *const TAG = "bl0910";
|
||||||
|
|
||||||
static uint8_t checksum_calc(uint8_t *data) {
|
static uint8_t checksum_calc(const uint8_t *data) {
|
||||||
uint8_t checksum = 0;
|
uint8_t checksum = 0;
|
||||||
for (int i = 0; i < 5; i++) {
|
for (int i = 0; i < 5; i++) {
|
||||||
checksum += data[i];
|
checksum += data[i];
|
||||||
@ -74,12 +74,12 @@ float BL0910::get_energy(uint8_t channel) {
|
|||||||
return ((float) this->read_register(BL0910_REG_CF_CNT[channel])) / this->energy_reference_[channel];
|
return ((float) this->read_register(BL0910_REG_CF_CNT[channel])) / this->energy_reference_[channel];
|
||||||
}
|
}
|
||||||
|
|
||||||
float BL0910::get_frequency(void) {
|
float BL0910::get_frequency() {
|
||||||
const float freq = (float) this->read_register(BL0910_REG_PERIOD);
|
const float freq = (float) this->read_register(BL0910_REG_PERIOD);
|
||||||
return 10000000.0 / freq;
|
return 10000000.0 / freq;
|
||||||
}
|
}
|
||||||
|
|
||||||
float BL0910::get_temperature(void) {
|
float BL0910::get_temperature() {
|
||||||
const float temp = (float) this->read_register(BL0910_REG_TPS1);
|
const float temp = (float) this->read_register(BL0910_REG_TPS1);
|
||||||
return (temp - 64.0) * 12.5 / 59.0 - 40.0;
|
return (temp - 64.0) * 12.5 / 59.0 - 40.0;
|
||||||
}
|
}
|
||||||
|
@ -72,11 +72,11 @@ class BL0910 : public PollingComponent,
|
|||||||
void write_register(uint8_t addr, uint8_t data_h, uint8_t data_m, uint8_t data_l);
|
void write_register(uint8_t addr, uint8_t data_h, uint8_t data_m, uint8_t data_l);
|
||||||
int32_t read_register(uint8_t addr);
|
int32_t read_register(uint8_t addr);
|
||||||
float get_voltage(uint8_t channel);
|
float get_voltage(uint8_t channel);
|
||||||
float get_frequency(void);
|
float get_frequency();
|
||||||
float get_current(uint8_t channel);
|
float get_current(uint8_t channel);
|
||||||
float get_power(uint8_t channel);
|
float get_power(uint8_t channel);
|
||||||
float get_energy(uint8_t channel);
|
float get_energy(uint8_t channel);
|
||||||
float get_temperature(void);
|
float get_temperature();
|
||||||
float get_powerfactor(uint8_t channel, float freq);
|
float get_powerfactor(uint8_t channel, float freq);
|
||||||
};
|
};
|
||||||
} // namespace bl0910
|
} // namespace bl0910
|
||||||
|
Loading…
Reference in New Issue
Block a user