Fix some typos found by codespell (#3598)

This commit is contained in:
André Klitzing 2022-06-27 23:02:46 +02:00 committed by GitHub
parent 28d2949ebe
commit 72cce391ab
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
37 changed files with 67 additions and 67 deletions

View file

@ -92,7 +92,7 @@ void Anova::gattc_event_handler(esp_gattc_cb_event_t event, esp_gatt_if_t gattc_
} }
if (this->codec_->has_unit()) { if (this->codec_->has_unit()) {
this->fahrenheit_ = (this->codec_->unit_ == 'f'); this->fahrenheit_ = (this->codec_->unit_ == 'f');
ESP_LOGD(TAG, "Anova units is %s", this->fahrenheit_ ? "fahrenheit" : "celcius"); ESP_LOGD(TAG, "Anova units is %s", this->fahrenheit_ ? "fahrenheit" : "celsius");
this->current_request_++; this->current_request_++;
} }
this->publish_state(); this->publish_state();

View file

@ -270,7 +270,7 @@ APIError APINoiseFrameHelper::try_read_frame_(ParsedFrame *frame) {
* *
* If the handshake is still active when this method returns and a read/write can't take place at * If the handshake is still active when this method returns and a read/write can't take place at
* the moment, returns WOULD_BLOCK. * the moment, returns WOULD_BLOCK.
* If an error occured, returns that error. Only returns OK if the transport is ready for data * If an error occurred, returns that error. Only returns OK if the transport is ready for data
* traffic. * traffic.
*/ */
APIError APINoiseFrameHelper::state_action_() { APIError APINoiseFrameHelper::state_action_() {
@ -586,7 +586,7 @@ APIError APINoiseFrameHelper::write_raw_(const struct iovec *iov, int iovcnt) {
} }
return APIError::OK; return APIError::OK;
} else if (sent == -1) { } else if (sent == -1) {
// an error occured // an error occurred
state_ = State::FAILED; state_ = State::FAILED;
HELPER_LOG("Socket write failed with errno %d", errno); HELPER_LOG("Socket write failed with errno %d", errno);
return APIError::SOCKET_WRITE_FAILED; return APIError::SOCKET_WRITE_FAILED;
@ -980,7 +980,7 @@ APIError APIPlaintextFrameHelper::write_raw_(const struct iovec *iov, int iovcnt
} }
return APIError::OK; return APIError::OK;
} else if (sent == -1) { } else if (sent == -1) {
// an error occured // an error occurred
state_ = State::FAILED; state_ = State::FAILED;
HELPER_LOG("Socket write failed with errno %d", errno); HELPER_LOG("Socket write failed with errno %d", errno);
return APIError::SOCKET_WRITE_FAILED; return APIError::SOCKET_WRITE_FAILED;

View file

@ -7,7 +7,7 @@ namespace bl0939 {
static const char *const TAG = "bl0939"; static const char *const TAG = "bl0939";
// https://www.belling.com.cn/media/file_object/bel_product/BL0939/datasheet/BL0939_V1.2_cn.pdf // https://www.belling.com.cn/media/file_object/bel_product/BL0939/datasheet/BL0939_V1.2_cn.pdf
// (unfortunatelly chinese, but the protocol can be understood with some translation tool) // (unfortunately chinese, but the protocol can be understood with some translation tool)
static const uint8_t BL0939_READ_COMMAND = 0x55; // 0x5{A4,A3,A2,A1} static const uint8_t BL0939_READ_COMMAND = 0x55; // 0x5{A4,A3,A2,A1}
static const uint8_t BL0939_FULL_PACKET = 0xAA; static const uint8_t BL0939_FULL_PACKET = 0xAA;
static const uint8_t BL0939_PACKET_HEADER = 0x55; static const uint8_t BL0939_PACKET_HEADER = 0x55;

View file

@ -8,7 +8,7 @@ namespace esphome {
namespace bl0939 { namespace bl0939 {
// https://datasheet.lcsc.com/lcsc/2108071830_BL-Shanghai-Belling-BL0939_C2841044.pdf // https://datasheet.lcsc.com/lcsc/2108071830_BL-Shanghai-Belling-BL0939_C2841044.pdf
// (unfortunatelly chinese, but the formulas can be easily understood) // (unfortunately chinese, but the formulas can be easily understood)
// Sonoff Dual R3 V2 has the exact same resistor values for the current shunts (RL=1miliOhm) // Sonoff Dual R3 V2 has the exact same resistor values for the current shunts (RL=1miliOhm)
// and for the voltage divider (R1=0.51kOhm, R2=5*390kOhm) // and for the voltage divider (R1=0.51kOhm, R2=5*390kOhm)
// as in the manufacturer's reference circuit, so the same formulas were used here (Vref=1.218V) // as in the manufacturer's reference circuit, so the same formulas were used here (Vref=1.218V)

View file

@ -131,7 +131,7 @@ void CurrentBasedCover::dump_config() {
ESP_LOGCONFIG(TAG, " Close Duration: %.1fs", this->close_duration_ / 1e3f); ESP_LOGCONFIG(TAG, " Close Duration: %.1fs", this->close_duration_ / 1e3f);
ESP_LOGCONFIG(TAG, "Obstacle Rollback: %.1f%%", this->obstacle_rollback_ * 100); ESP_LOGCONFIG(TAG, "Obstacle Rollback: %.1f%%", this->obstacle_rollback_ * 100);
if (this->max_duration_ != UINT32_MAX) { if (this->max_duration_ != UINT32_MAX) {
ESP_LOGCONFIG(TAG, "Maximun duration: %.1fs", this->max_duration_ / 1e3f); ESP_LOGCONFIG(TAG, "Maximum duration: %.1fs", this->max_duration_ / 1e3f);
} }
ESP_LOGCONFIG(TAG, "Start sensing delay: %.1fs", this->start_sensing_delay_ / 1e3f); ESP_LOGCONFIG(TAG, "Start sensing delay: %.1fs", this->start_sensing_delay_ / 1e3f);
ESP_LOGCONFIG(TAG, "Malfunction detection: %s", YESNO(this->malfunction_detection_)); ESP_LOGCONFIG(TAG, "Malfunction detection: %s", YESNO(this->malfunction_detection_));

View file

@ -132,7 +132,7 @@ class ColorUtil {
int16_t plt_r = (int16_t) palette[i * 3 + 0]; int16_t plt_r = (int16_t) palette[i * 3 + 0];
int16_t plt_g = (int16_t) palette[i * 3 + 1]; int16_t plt_g = (int16_t) palette[i * 3 + 1];
int16_t plt_b = (int16_t) palette[i * 3 + 2]; int16_t plt_b = (int16_t) palette[i * 3 + 2];
// Calculate euclidian distance (linear distance in rgb cube). // Calculate euclidean distance (linear distance in rgb cube).
x = (uint32_t) std::abs(tgt_r - plt_r); x = (uint32_t) std::abs(tgt_r - plt_r);
y = (uint32_t) std::abs(tgt_g - plt_g); y = (uint32_t) std::abs(tgt_g - plt_g);
z = (uint32_t) std::abs(tgt_b - plt_b); z = (uint32_t) std::abs(tgt_b - plt_b);

View file

@ -171,7 +171,7 @@ void Dsmr::receive_telegram_() {
this->telegram_[this->bytes_read_] = c; this->telegram_[this->bytes_read_] = c;
this->bytes_read_++; this->bytes_read_++;
// Check for a footer, i.e. exlamation mark, followed by a hex checksum. // Check for a footer, i.e. exclamation mark, followed by a hex checksum.
if (c == '!') { if (c == '!') {
ESP_LOGV(TAG, "Footer of telegram found"); ESP_LOGV(TAG, "Footer of telegram found");
this->footer_found_ = true; this->footer_found_ = true;

View file

@ -199,7 +199,7 @@ void ENS210Component::update() {
}); });
} }
// Extracts measurement 'data' and 'status' from a 'val' obtained from measurment. // Extracts measurement 'data' and 'status' from a 'val' obtained from measurement.
void ENS210Component::extract_measurement_(uint32_t val, int *data, int *status) { void ENS210Component::extract_measurement_(uint32_t val, int *data, int *status) {
*data = (val >> 0) & 0xffff; *data = (val >> 0) & 0xffff;
int valid = (val >> 16) & 0x1; int valid = (val >> 16) & 0x1;

View file

@ -317,7 +317,7 @@ void ESP32Camera::update_camera_parameters() {
s->set_gainceiling(s, (gainceiling_t) this->agc_gain_ceiling_); s->set_gainceiling(s, (gainceiling_t) this->agc_gain_ceiling_);
/* update white balance mode */ /* update white balance mode */
s->set_wb_mode(s, (int) this->wb_mode_); // 0 to 4 s->set_wb_mode(s, (int) this->wb_mode_); // 0 to 4
/* update test patern */ /* update test pattern */
s->set_colorbar(s, this->test_pattern_); s->set_colorbar(s, this->test_pattern_);
} }

View file

@ -118,7 +118,7 @@ def _relocate_fields_to_subfolder(config, subfolder, subschema):
fields = [k.schema for k in subschema.schema.keys()] fields = [k.schema for k in subschema.schema.keys()]
fields.remove(CONF_ID) fields.remove(CONF_ID)
if subfolder in config: if subfolder in config:
# Ensure no ambigious fields in base of config # Ensure no ambiguous fields in base of config
for f in fields: for f in fields:
if f in config: if f in config:
raise cv.Invalid( raise cv.Invalid(

View file

@ -224,7 +224,7 @@ void ArduinoI2CBus::recover_() {
digitalWrite(sda_pin_, LOW); // NOLINT digitalWrite(sda_pin_, LOW); // NOLINT
// By now, any stuck device ought to have sent all remaining bits of its // By now, any stuck device ought to have sent all remaining bits of its
// transation, meaning that it should have freed up the SDA line, resulting // transaction, meaning that it should have freed up the SDA line, resulting
// in SDA being pulled up. // in SDA being pulled up.
if (digitalRead(sda_pin_) == LOW) { // NOLINT if (digitalRead(sda_pin_) == LOW) { // NOLINT
ESP_LOGE(TAG, "Recovery failed: SDA is held LOW after clock pulse cycle"); ESP_LOGE(TAG, "Recovery failed: SDA is held LOW after clock pulse cycle");

View file

@ -285,7 +285,7 @@ void IDFI2CBus::recover_() {
} }
// By now, any stuck device ought to have sent all remaining bits of its // By now, any stuck device ought to have sent all remaining bits of its
// transation, meaning that it should have freed up the SDA line, resulting // transaction, meaning that it should have freed up the SDA line, resulting
// in SDA being pulled up. // in SDA being pulled up.
if (gpio_get_level(sda_pin) == 0) { if (gpio_get_level(sda_pin) == 0) {
ESP_LOGE(TAG, "Recovery failed: SDA is held LOW after clock pulse cycle"); ESP_LOGE(TAG, "Recovery failed: SDA is held LOW after clock pulse cycle");

View file

@ -203,7 +203,7 @@ class LightColorValues {
*color_temperature = *color_temperature =
(this->color_temperature_ - color_temperature_cw) / (color_temperature_ww - color_temperature_cw); (this->color_temperature_ - color_temperature_cw) / (color_temperature_ww - color_temperature_cw);
*white_brightness = gamma_correct(this->state_ * this->brightness_ * white_level, gamma); *white_brightness = gamma_correct(this->state_ * this->brightness_ * white_level, gamma);
} else { // Probably wont get here but put this here anyway. } else { // Probably won't get here but put this here anyway.
*white_brightness = 0; *white_brightness = 0;
} }
} }

View file

@ -121,7 +121,7 @@ void LightJSONSchema::parse_color_json(LightState &state, LightCall &call, JsonO
call.set_cold_white(float(color["c"]) / 255.0f); call.set_cold_white(float(color["c"]) / 255.0f);
} }
if (color.containsKey("w")) { if (color.containsKey("w")) {
// the HA scheme is ambigious here, the same key is used for white channel in RGBW and warm // the HA scheme is ambiguous here, the same key is used for white channel in RGBW and warm
// white channel in RGBWW. // white channel in RGBWW.
if (color.containsKey("c")) { if (color.containsKey("c")) {
call.set_warm_white(float(color["w"]) / 255.0f); call.set_warm_white(float(color["w"]) / 255.0f);

View file

@ -100,7 +100,7 @@ bool Modbus::parse_modbus_byte_(uint8_t byte) {
} }
// Error ( msb indicates error ) // Error ( msb indicates error )
// response format: Byte[0] = device address, Byte[1] function code | 0x80 , Byte[2] excpetion code, Byte[3-4] crc // response format: Byte[0] = device address, Byte[1] function code | 0x80 , Byte[2] exception code, Byte[3-4] crc
if ((function_code & 0x80) == 0x80) { if ((function_code & 0x80) == 0x80) {
data_offset = 2; data_offset = 2;
data_len = 1; data_len = 1;

View file

@ -70,7 +70,7 @@ void ModbusController::on_modbus_error(uint8_t function_code, uint8_t exception_
auto &current_command = this->command_queue_.front(); auto &current_command = this->command_queue_.front();
if (current_command != nullptr) { if (current_command != nullptr) {
ESP_LOGE(TAG, ESP_LOGE(TAG,
"Modbus error - last command: function code=0x%X register adddress = 0x%X " "Modbus error - last command: function code=0x%X register address = 0x%X "
"registers count=%d " "registers count=%d "
"payload size=%zu", "payload size=%zu",
function_code, current_command->register_address, current_command->register_count, function_code, current_command->register_address, current_command->register_count,
@ -105,7 +105,7 @@ void ModbusController::on_register_data(ModbusRegisterType register_type, uint16
} }
void ModbusController::queue_command(const ModbusCommandItem &command) { void ModbusController::queue_command(const ModbusCommandItem &command) {
// check if this commmand is already qeued. // check if this command is already qeued.
// not very effective but the queue is never really large // not very effective but the queue is never really large
for (auto &item : command_queue_) { for (auto &item : command_queue_) {
if (item->register_address == command.register_address && item->register_count == command.register_count && if (item->register_address == command.register_address && item->register_count == command.register_count &&
@ -299,7 +299,7 @@ void ModbusController::loop() {
incoming_queue_.pop(); incoming_queue_.pop();
} else { } else {
// all messages processed send pending commmands // all messages processed send pending commands
send_next_command_(); send_next_command_();
} }
} }

View file

@ -185,8 +185,8 @@ inline bool coil_from_vector(int coil, const std::vector<uint8_t> &data) {
/** Extract bits from value and shift right according to the bitmask /** Extract bits from value and shift right according to the bitmask
* if the bitmask is 0x00F0 we want the values frrom bit 5 - 8. * if the bitmask is 0x00F0 we want the values frrom bit 5 - 8.
* the result is then shifted right by the postion if the first right set bit in the mask * the result is then shifted right by the position if the first right set bit in the mask
* Usefull for modbus data where more than one value is packed in a 16 bit register * Useful for modbus data where more than one value is packed in a 16 bit register
* Example: on Epever the "Length of night" register 0x9065 encodes values of the whole night length of time as * Example: on Epever the "Length of night" register 0x9065 encodes values of the whole night length of time as
* D15 - D8 = hour, D7 - D0 = minute * D15 - D8 = hour, D7 - D0 = minute
* To get the hours use mask 0xFF00 and 0x00FF for the minute * To get the hours use mask 0xFF00 and 0x00FF for the minute
@ -447,7 +447,7 @@ class ModbusController : public PollingComponent, public modbus::ModbusDevice {
void dump_sensors_(); void dump_sensors_();
/// Collection of all sensors for this component /// Collection of all sensors for this component
SensorSet sensorset_; SensorSet sensorset_;
/// Continous range of modbus registers /// Continuous range of modbus registers
std::vector<RegisterRange> register_ranges_; std::vector<RegisterRange> register_ranges_;
/// Hold the pending requests to be sent /// Hold the pending requests to be sent
std::list<std::unique_ptr<ModbusCommandItem>> command_queue_; std::list<std::unique_ptr<ModbusCommandItem>> command_queue_;

View file

@ -68,7 +68,7 @@ CONFIG_SCHEMA = cv.All(
), ),
cv.Optional(CONF_VALUE_TYPE, default="U_WORD"): cv.enum(SENSOR_VALUE_TYPE), cv.Optional(CONF_VALUE_TYPE, default="U_WORD"): cv.enum(SENSOR_VALUE_TYPE),
cv.Optional(CONF_WRITE_LAMBDA): cv.returning_lambda, cv.Optional(CONF_WRITE_LAMBDA): cv.returning_lambda,
# 24 bits are the maximum value for fp32 before precison is lost # 24 bits are the maximum value for fp32 before precision is lost
# 0x00FFFFFF = 16777215 # 0x00FFFFFF = 16777215
cv.Optional(CONF_MAX_VALUE, default=16777215.0): cv.float_, cv.Optional(CONF_MAX_VALUE, default=16777215.0): cv.float_,
cv.Optional(CONF_MIN_VALUE, default=-16777215.0): cv.float_, cv.Optional(CONF_MIN_VALUE, default=-16777215.0): cv.float_,

View file

@ -12,7 +12,7 @@ NdefRecord::NdefRecord(std::vector<uint8_t> payload_data) {
std::vector<uint8_t> NdefRecord::encode(bool first, bool last) { std::vector<uint8_t> NdefRecord::encode(bool first, bool last) {
std::vector<uint8_t> data; std::vector<uint8_t> data;
// Get encoded payload, this is overriden by more specific record classes // Get encoded payload, this is overridden by more specific record classes
std::vector<uint8_t> payload_data = get_encoded_payload(); std::vector<uint8_t> payload_data = get_encoded_payload();
size_t payload_length = payload_data.size(); size_t payload_length = payload_data.size();

View file

@ -106,7 +106,7 @@ optional<NexaData> NexaProtocol::decode(RemoteReceiveData src) {
SHHHH HHHH HHHH HHHH HHHH HHHH HHGO EE BB DDDD 0 P SHHHH HHHH HHHH HHHH HHHH HHHH HHGO EE BB DDDD 0 P
S = Sync bit. S = Sync bit.
H = The first 26 bits are transmitter unique codes, and it is this code that the reciever "learns" to recognize. H = The first 26 bits are transmitter unique codes, and it is this code that the receiver "learns" to recognize.
G = Group code, set to one for the whole group. G = Group code, set to one for the whole group.
O = On/Off bit. Set to 1 for on, 0 for off. O = On/Off bit. Set to 1 for on, 0 for off.
E = Unit to be turned on or off. The code is inverted, i.e. '11' equals 1, '00' equals 4. E = Unit to be turned on or off. The code is inverted, i.e. '11' equals 1, '00' equals 4.

View file

@ -102,7 +102,7 @@ bool RCSwitchBase::expect_sync(RemoteReceiveData &src) const {
if (!src.peek_space(this->sync_low_, 1)) if (!src.peek_space(this->sync_low_, 1))
return false; return false;
} else { } else {
// We cant peek a space at the beginning because signals starts with a low to high transition. // We can't peek a space at the beginning because signals starts with a low to high transition.
// this long space at the beginning is the separation between the transmissions itself, so it is actually // this long space at the beginning is the separation between the transmissions itself, so it is actually
// added at the end kind of artificially (by the value given to "idle:" option by the user in the yaml) // added at the end kind of artificially (by the value given to "idle:" option by the user in the yaml)
if (!src.peek_mark(this->sync_low_)) if (!src.peek_mark(this->sync_low_))

View file

@ -205,7 +205,7 @@ void SCD4XComponent::update() {
bool SCD4XComponent::perform_forced_calibration(uint16_t current_co2_concentration) { bool SCD4XComponent::perform_forced_calibration(uint16_t current_co2_concentration) {
/* /*
Operate the SCD4x in the operation mode later used in normal sensor operation (periodic measurement, low power Operate the SCD4x in the operation mode later used in normal sensor operation (periodic measurement, low power
periodic measurement or single shot) for > 3 minutes in an environment with homogenous and constant CO2 periodic measurement or single shot) for > 3 minutes in an environment with homogeneous and constant CO2
concentration before performing a forced recalibration. concentration before performing a forced recalibration.
*/ */
if (!this->write_command(SCD4X_CMD_STOP_MEASUREMENTS)) { if (!this->write_command(SCD4X_CMD_STOP_MEASUREMENTS)) {
@ -217,7 +217,7 @@ bool SCD4XComponent::perform_forced_calibration(uint16_t current_co2_concentrati
ESP_LOGD(TAG, "setting forced calibration Co2 level %d ppm", current_co2_concentration); ESP_LOGD(TAG, "setting forced calibration Co2 level %d ppm", current_co2_concentration);
// frc takes 400 ms // frc takes 400 ms
// because this method will be used very rarly // because this method will be used very rarly
// the simple aproach with delay is ok // the simple approach with delay is ok
delay(400); // NOLINT' delay(400); // NOLINT'
if (!this->start_measurement_()) { if (!this->start_measurement_()) {
return false; return false;

View file

@ -33,7 +33,7 @@ bool SensirionI2CDevice::read_data(uint16_t *data, uint8_t len) {
} }
/*** /***
* write command with parameters and insert crc * write command with parameters and insert crc
* use stack array for less than 4 paramaters. Most sensirion i2c commands have less parameters * use stack array for less than 4 parameters. Most sensirion i2c commands have less parameters
*/ */
bool SensirionI2CDevice::write_command_(uint16_t command, CommandLen command_len, const uint16_t *data, bool SensirionI2CDevice::write_command_(uint16_t command, CommandLen command_len, const uint16_t *data,
uint8_t data_len) { uint8_t data_len) {
@ -63,7 +63,7 @@ bool SensirionI2CDevice::write_command_(uint16_t command, CommandLen command_len
temp[raw_idx++] = command >> 8; temp[raw_idx++] = command >> 8;
#endif #endif
} }
// add parameters folllowed by crc // add parameters followed by crc
// skipped if len == 0 // skipped if len == 0
for (size_t i = 0; i < data_len; i++) { for (size_t i = 0; i < data_len; i++) {
#if __BYTE_ORDER__ == __ORDER_LITTLE_ENDIAN__ #if __BYTE_ORDER__ == __ORDER_LITTLE_ENDIAN__

View file

@ -20,13 +20,13 @@ class SensirionI2CDevice : public i2c::I2CDevice {
* handles crc check used by Sensirion sensors * handles crc check used by Sensirion sensors
* @param data pointer to raw result * @param data pointer to raw result
* @param len number of words to read * @param len number of words to read
* @return true if reading succeded * @return true if reading succeeded
*/ */
bool read_data(uint16_t *data, uint8_t len); bool read_data(uint16_t *data, uint8_t len);
/** Read 1 data word from i2c device. /** Read 1 data word from i2c device.
* @param data reference to raw result * @param data reference to raw result
* @return true if reading succeded * @return true if reading succeeded
*/ */
bool read_data(uint16_t &data) { return this->read_data(&data, 1); } bool read_data(uint16_t &data) { return this->read_data(&data, 1); }
@ -35,8 +35,8 @@ class SensirionI2CDevice : public i2c::I2CDevice {
* @param i2c register * @param i2c register
* @param data pointer to raw result * @param data pointer to raw result
* @param len number of words to read * @param len number of words to read
* @param delay milliseconds to to wait between sending the i2c commmand and reading the result * @param delay milliseconds to to wait between sending the i2c command and reading the result
* @return true if reading succeded * @return true if reading succeeded
*/ */
bool get_register(uint16_t command, uint16_t *data, uint8_t len, uint8_t delay = 0) { bool get_register(uint16_t command, uint16_t *data, uint8_t len, uint8_t delay = 0) {
return get_register_(command, ADDR_16_BIT, data, len, delay); return get_register_(command, ADDR_16_BIT, data, len, delay);
@ -44,8 +44,8 @@ class SensirionI2CDevice : public i2c::I2CDevice {
/** Read 1 data word from 16 bit i2c register. /** Read 1 data word from 16 bit i2c register.
* @param i2c register * @param i2c register
* @param data reference to raw result * @param data reference to raw result
* @param delay milliseconds to to wait between sending the i2c commmand and reading the result * @param delay milliseconds to to wait between sending the i2c command and reading the result
* @return true if reading succeded * @return true if reading succeeded
*/ */
bool get_register(uint16_t i2c_register, uint16_t &data, uint8_t delay = 0) { bool get_register(uint16_t i2c_register, uint16_t &data, uint8_t delay = 0) {
return this->get_register_(i2c_register, ADDR_16_BIT, &data, 1, delay); return this->get_register_(i2c_register, ADDR_16_BIT, &data, 1, delay);
@ -56,8 +56,8 @@ class SensirionI2CDevice : public i2c::I2CDevice {
* @param i2c register * @param i2c register
* @param data pointer to raw result * @param data pointer to raw result
* @param len number of words to read * @param len number of words to read
* @param delay milliseconds to to wait between sending the i2c commmand and reading the result * @param delay milliseconds to to wait between sending the i2c command and reading the result
* @return true if reading succeded * @return true if reading succeeded
*/ */
bool get_8bit_register(uint8_t i2c_register, uint16_t *data, uint8_t len, uint8_t delay = 0) { bool get_8bit_register(uint8_t i2c_register, uint16_t *data, uint8_t len, uint8_t delay = 0) {
return get_register_(i2c_register, ADDR_8_BIT, data, len, delay); return get_register_(i2c_register, ADDR_8_BIT, data, len, delay);
@ -66,8 +66,8 @@ class SensirionI2CDevice : public i2c::I2CDevice {
/** Read 1 data word from 8 bit i2c register. /** Read 1 data word from 8 bit i2c register.
* @param i2c register * @param i2c register
* @param data reference to raw result * @param data reference to raw result
* @param delay milliseconds to to wait between sending the i2c commmand and reading the result * @param delay milliseconds to to wait between sending the i2c command and reading the result
* @return true if reading succeded * @return true if reading succeeded
*/ */
bool get_8bit_register(uint8_t i2c_register, uint16_t &data, uint8_t delay = 0) { bool get_8bit_register(uint8_t i2c_register, uint16_t &data, uint8_t delay = 0) {
return this->get_register_(i2c_register, ADDR_8_BIT, &data, 1, delay); return this->get_register_(i2c_register, ADDR_8_BIT, &data, 1, delay);
@ -75,21 +75,21 @@ class SensirionI2CDevice : public i2c::I2CDevice {
/** Write a command to the i2c device. /** Write a command to the i2c device.
* @param command i2c command to send * @param command i2c command to send
* @return true if reading succeded * @return true if reading succeeded
*/ */
template<class T> bool write_command(T i2c_register) { return write_command(i2c_register, nullptr, 0); } template<class T> bool write_command(T i2c_register) { return write_command(i2c_register, nullptr, 0); }
/** Write a command and one data word to the i2c device . /** Write a command and one data word to the i2c device .
* @param command i2c command to send * @param command i2c command to send
* @param data argument for the i2c command * @param data argument for the i2c command
* @return true if reading succeded * @return true if reading succeeded
*/ */
template<class T> bool write_command(T i2c_register, uint16_t data) { return write_command(i2c_register, &data, 1); } template<class T> bool write_command(T i2c_register, uint16_t data) { return write_command(i2c_register, &data, 1); }
/** Write a command with arguments as words /** Write a command with arguments as words
* @param i2c_register i2c command to send - an be uint8_t or uint16_t * @param i2c_register i2c command to send - an be uint8_t or uint16_t
* @param data vector<uint16> arguments for the i2c command * @param data vector<uint16> arguments for the i2c command
* @return true if reading succeded * @return true if reading succeeded
*/ */
template<class T> bool write_command(T i2c_register, const std::vector<uint16_t> &data) { template<class T> bool write_command(T i2c_register, const std::vector<uint16_t> &data) {
return write_command_(i2c_register, sizeof(T), data.data(), data.size()); return write_command_(i2c_register, sizeof(T), data.data(), data.size());
@ -99,7 +99,7 @@ class SensirionI2CDevice : public i2c::I2CDevice {
* @param i2c_register i2c command to send - an be uint8_t or uint16_t * @param i2c_register i2c command to send - an be uint8_t or uint16_t
* @param data arguments for the i2c command * @param data arguments for the i2c command
* @param len number of arguments (words) * @param len number of arguments (words)
* @return true if reading succeded * @return true if reading succeeded
*/ */
template<class T> bool write_command(T i2c_register, const uint16_t *data, uint8_t len) { template<class T> bool write_command(T i2c_register, const uint16_t *data, uint8_t len) {
// limit to 8 or 16 bit only // limit to 8 or 16 bit only
@ -115,7 +115,7 @@ class SensirionI2CDevice : public i2c::I2CDevice {
* @param command_len either 1 for short 8 bit command or 2 for 16 bit command codes * @param command_len either 1 for short 8 bit command or 2 for 16 bit command codes
* @param data arguments for the i2c command * @param data arguments for the i2c command
* @param data_len number of arguments (words) * @param data_len number of arguments (words)
* @return true if reading succeded * @return true if reading succeeded
*/ */
bool write_command_(uint16_t command, CommandLen command_len, const uint16_t *data, uint8_t data_len); bool write_command_(uint16_t command, CommandLen command_len, const uint16_t *data, uint8_t data_len);
@ -125,8 +125,8 @@ class SensirionI2CDevice : public i2c::I2CDevice {
* @param command_len either 1 for short 8 bit command or 2 for 16 bit command codes * @param command_len either 1 for short 8 bit command or 2 for 16 bit command codes
* @param data pointer to raw result * @param data pointer to raw result
* @param len number of words to read * @param len number of words to read
* @param delay milliseconds to to wait between sending the i2c commmand and reading the result * @param delay milliseconds to to wait between sending the i2c command and reading the result
* @return true if reading succeded * @return true if reading succeeded
*/ */
bool get_register_(uint16_t reg, CommandLen command_len, uint16_t *data, uint8_t len, uint8_t delay); bool get_register_(uint16_t reg, CommandLen command_len, uint16_t *data, uint8_t len, uint8_t delay);

View file

@ -39,7 +39,7 @@ void SGP4xComponent::setup() {
ESP_LOGE(TAG, "Measuring NOx requires a SGP41 sensor but a SGP40 sensor is detected"); ESP_LOGE(TAG, "Measuring NOx requires a SGP41 sensor but a SGP40 sensor is detected");
// disable the sensor // disable the sensor
this->nox_sensor_->set_disabled_by_default(true); this->nox_sensor_->set_disabled_by_default(true);
// make sure it's not visiable in HA // make sure it's not visible in HA
this->nox_sensor_->set_internal(true); this->nox_sensor_->set_internal(true);
this->nox_sensor_->state = NAN; this->nox_sensor_->state = NAN;
// remove pointer to sensor // remove pointer to sensor
@ -104,8 +104,8 @@ void SGP4xComponent::setup() {
https://github.com/Sensirion/embedded-sgp/issues/136 indicate the algorithm should be a bit resilient to slight https://github.com/Sensirion/embedded-sgp/issues/136 indicate the algorithm should be a bit resilient to slight
timing variations so the software timer should be accurate enough for this. timing variations so the software timer should be accurate enough for this.
This block starts sampling from the sensor at 1Hz, and is done seperately from the call This block starts sampling from the sensor at 1Hz, and is done separately from the call
to the update method. This seperation is to support getting accurate measurements but to the update method. This separation is to support getting accurate measurements but
limit the amount of communication done over wifi for power consumption or to keep the limit the amount of communication done over wifi for power consumption or to keep the
number of records reported from being overwhelming. number of records reported from being overwhelming.
*/ */
@ -236,9 +236,9 @@ bool SGP4xComponent::measure_raw_(uint16_t &voc_raw, uint16_t &nox_raw) {
} }
uint16_t rhticks = llround((uint16_t)((humidity * 65535) / 100)); uint16_t rhticks = llround((uint16_t)((humidity * 65535) / 100));
uint16_t tempticks = (uint16_t)(((temperature + 45) * 65535) / 175); uint16_t tempticks = (uint16_t)(((temperature + 45) * 65535) / 175);
// first paramater are the relative humidity ticks // first parameter are the relative humidity ticks
data[0] = rhticks; data[0] = rhticks;
// secomd paramater are the temperature ticks // secomd parameter are the temperature ticks
data[1] = tempticks; data[1] = tempticks;
if (!this->write_command(command, data, 2)) { if (!this->write_command(command, data, 2)) {

View file

@ -49,7 +49,7 @@ constexpr float POWER_SCALING_FACTOR = 880373;
constexpr float VOLTAGE_SCALING_FACTOR = 347800; constexpr float VOLTAGE_SCALING_FACTOR = 347800;
constexpr float CURRENT_SCALING_FACTOR = 1448; constexpr float CURRENT_SCALING_FACTOR = 1448;
// Esentially std::size() for pre c++17 // Essentially std::size() for pre c++17
template<typename T, size_t N> constexpr size_t size(const T (&/*unused*/)[N]) noexcept { return N; } template<typename T, size_t N> constexpr size_t size(const T (&/*unused*/)[N]) noexcept { return N; }
} // Anonymous namespace } // Anonymous namespace

View file

@ -161,7 +161,7 @@ bool SonoffD1Output::write_command_(uint8_t *cmd, const size_t len, bool needs_a
return false; return false;
} }
if ((cmd[5] + 7 /*mandatory header + suffix length*/) != len) { if ((cmd[5] + 7 /*mandatory header + suffix length*/) != len) {
ESP_LOGW(TAG, "[%04d] Payload length field does not match packet lenght (%d, expected %d)", this->write_count_, ESP_LOGW(TAG, "[%04d] Payload length field does not match packet length (%d, expected %d)", this->write_count_,
cmd[5], len - 7); cmd[5], len - 7);
return false; return false;
} }

View file

@ -163,7 +163,7 @@ class ThermostatClimate : public climate::Climate, public Component {
/// Change to a provided custom preset setting; will reset temperature, mode, fan, and swing modes accordingly /// Change to a provided custom preset setting; will reset temperature, mode, fan, and swing modes accordingly
void change_custom_preset_(const std::string &custom_preset); void change_custom_preset_(const std::string &custom_preset);
/// Applies the temperature, mode, fan, and swing modes of the provded config. /// Applies the temperature, mode, fan, and swing modes of the provided config.
/// This is agnostic of custom vs built in preset /// This is agnostic of custom vs built in preset
void change_preset_internal_(const ThermostatClimateTargetTempConfig &config); void change_preset_internal_(const ThermostatClimateTargetTempConfig &config);

View file

@ -38,7 +38,7 @@ class UARTDebugger : public Component, public Trigger<UARTDirection, std::vector
/// Add a delimiter byte. This can be called multiple times to setup a /// Add a delimiter byte. This can be called multiple times to setup a
/// multi-byte delimiter (a typical example would be '\r\n'). /// multi-byte delimiter (a typical example would be '\r\n').
/// When the constructued byte sequence is found in the data stream, /// When the constructed byte sequence is found in the data stream,
/// logging will be triggered. /// logging will be triggered.
void add_delimiter_byte(uint8_t byte) { this->after_delimiter_.push_back(byte); } void add_delimiter_byte(uint8_t byte) { this->after_delimiter_.push_back(byte); }

View file

@ -195,7 +195,7 @@ bool WiFiComponent::wifi_sta_connect_(const WiFiAP &ap) {
#if ESP_IDF_VERSION_MAJOR >= 4 #if ESP_IDF_VERSION_MAJOR >= 4
// Protected Management Frame // Protected Management Frame
// Device will prefer to connect in PMF mode if other device also advertizes PMF capability. // Device will prefer to connect in PMF mode if other device also advertises PMF capability.
conf.sta.pmf_cfg.capable = true; conf.sta.pmf_cfg.capable = true;
conf.sta.pmf_cfg.required = false; conf.sta.pmf_cfg.required = false;
#endif #endif

View file

@ -303,7 +303,7 @@ bool WiFiComponent::wifi_sta_connect_(const WiFiAP &ap) {
#if ESP_IDF_VERSION_MAJOR >= 4 #if ESP_IDF_VERSION_MAJOR >= 4
// Protected Management Frame // Protected Management Frame
// Device will prefer to connect in PMF mode if other device also advertizes PMF capability. // Device will prefer to connect in PMF mode if other device also advertises PMF capability.
conf.sta.pmf_cfg.capable = true; conf.sta.pmf_cfg.capable = true;
conf.sta.pmf_cfg.required = false; conf.sta.pmf_cfg.required = false;
#endif #endif

View file

@ -38,7 +38,7 @@ bool XiaomiMiscale::parse_device(const esp32_ble_tracker::ESPBTDevice &device) {
if (this->impedance_ != nullptr) { if (this->impedance_ != nullptr) {
if (res->version == 1) { if (res->version == 1) {
ESP_LOGW(TAG, "Impedance is only supported on version 2. Your scale was identified as verison 1."); ESP_LOGW(TAG, "Impedance is only supported on version 2. Your scale was identified as version 1.");
} else { } else {
if (res->impedance.has_value()) { if (res->impedance.has_value()) {
this->impedance_->publish_state(*res->impedance); this->impedance_->publish_state(*res->impedance);

View file

@ -651,7 +651,7 @@ class EsphomeCore:
continue continue
if other.repository is not None: if other.repository is not None:
if library.repository is None or other.repository == library.repository: if library.repository is None or other.repository == library.repository:
# Other is using a/the same repository, takes precendence # Other is using a/the same repository, takes precedence
break break
raise ValueError( raise ValueError(
f"Adding named Library with repository failed! Libraries {library} and {other} " f"Adding named Library with repository failed! Libraries {library} and {other} "

View file

@ -9,7 +9,7 @@ namespace esphome {
ESP_LOGCONFIG(TAG, prefix "%s", (pin)->dump_summary().c_str()); \ ESP_LOGCONFIG(TAG, prefix "%s", (pin)->dump_summary().c_str()); \
} }
// put GPIO flags in a namepsace to not pollute esphome namespace // put GPIO flags in a namespace to not pollute esphome namespace
namespace gpio { namespace gpio {
enum Flags : uint8_t { enum Flags : uint8_t {

View file

@ -258,10 +258,10 @@ inline std::string to_string(const std::string &val) { return val; }
/// Truncate a string to a specific length. /// Truncate a string to a specific length.
std::string str_truncate(const std::string &str, size_t length); std::string str_truncate(const std::string &str, size_t length);
/// Extract the part of the string until either the first occurence of the specified character, or the end (requires str /// Extract the part of the string until either the first occurrence of the specified character, or the end
/// to be null-terminated). /// (requires str to be null-terminated).
std::string str_until(const char *str, char ch); std::string str_until(const char *str, char ch);
/// Extract the part of the string until either the first occurence of the specified character, or the end. /// Extract the part of the string until either the first occurrence of the specified character, or the end.
std::string str_until(const std::string &str, char ch); std::string str_until(const std::string &str, char ch);
/// Convert the string to lower case. /// Convert the string to lower case.

View file

@ -13,7 +13,7 @@ import esphome.schema_extractors as ejs
ejs.EnableSchemaExtraction = True ejs.EnableSchemaExtraction = True
# schema format: # schema format:
# Schemas are splitted in several files in json format, one for core stuff, one for each platform (sensor, binary_sensor, etc) and # Schemas are split in several files in json format, one for core stuff, one for each platform (sensor, binary_sensor, etc) and
# one for each component (dallas, sim800l, etc.) component can have schema for root component/hub and also for platform component, # one for each component (dallas, sim800l, etc.) component can have schema for root component/hub and also for platform component,
# e.g. dallas has hub component which has pin and then has the sensor platform which has sensor name, index, etc. # e.g. dallas has hub component which has pin and then has the sensor platform which has sensor name, index, etc.
# When files are loaded they are merged in a single object. # When files are loaded they are merged in a single object.

View file

@ -452,7 +452,7 @@ def lint_no_removed_in_idf_conversions(fname, match):
replacement = IDF_CONVERSION_FORBIDDEN[match.group(1)] replacement = IDF_CONVERSION_FORBIDDEN[match.group(1)]
return ( return (
f"The macro {highlight(match.group(1))} can no longer be used in ESPHome directly. " f"The macro {highlight(match.group(1))} can no longer be used in ESPHome directly. "
f"Plese use {highlight(replacement)} instead." f"Please use {highlight(replacement)} instead."
) )