mirror of
https://github.com/esphome/esphome.git
synced 2024-11-21 22:48:10 +01:00
parent
ec3164f800
commit
bff24e2977
18 changed files with 55 additions and 40 deletions
|
@ -10,6 +10,7 @@
|
|||
#include "ade7880.h"
|
||||
#include "ade7880_registers.h"
|
||||
#include "esphome/core/log.h"
|
||||
|
||||
#include <cinttypes>
|
||||
|
||||
namespace esphome {
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
#include "ade7953_base.h"
|
||||
#include "esphome/core/log.h"
|
||||
|
||||
#include <cinttypes>
|
||||
|
||||
namespace esphome {
|
||||
|
|
|
@ -1,5 +1,7 @@
|
|||
#include "ags10.h"
|
||||
|
||||
#include <cinttypes>
|
||||
|
||||
namespace esphome {
|
||||
namespace ags10 {
|
||||
static const char *const TAG = "ags10";
|
||||
|
@ -35,7 +37,7 @@ void AGS10Component::setup() {
|
|||
|
||||
auto resistance = this->read_resistance_();
|
||||
if (resistance) {
|
||||
ESP_LOGD(TAG, "AGS10 Sensor Resistance: 0x%08X", *resistance);
|
||||
ESP_LOGD(TAG, "AGS10 Sensor Resistance: 0x%08" PRIX32, *resistance);
|
||||
if (this->resistance_ != nullptr) {
|
||||
this->resistance_->publish_state(*resistance);
|
||||
}
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
#include "ct_clamp_sensor.h"
|
||||
|
||||
#include "esphome/core/log.h"
|
||||
#include <cinttypes>
|
||||
#include <cmath>
|
||||
|
||||
namespace esphome {
|
||||
|
@ -37,8 +38,8 @@ void CTClampSensor::update() {
|
|||
float rms_ac = 0;
|
||||
if (rms_ac_squared > 0)
|
||||
rms_ac = std::sqrt(rms_ac_squared);
|
||||
ESP_LOGD(TAG, "'%s' - Raw AC Value: %.3fA after %d different samples (%d SPS)", this->name_.c_str(), rms_ac,
|
||||
this->num_samples_, 1000 * this->num_samples_ / this->sample_duration_);
|
||||
ESP_LOGD(TAG, "'%s' - Raw AC Value: %.3fA after %" PRIu32 " different samples (%" PRIu32 " SPS)",
|
||||
this->name_.c_str(), rms_ac, this->num_samples_, 1000 * this->num_samples_ / this->sample_duration_);
|
||||
this->publish_state(rms_ac);
|
||||
});
|
||||
|
||||
|
|
|
@ -377,7 +377,7 @@ uint8_t FingerprintGrowComponent::transfer_(std::vector<uint8_t> *p_data_buffer)
|
|||
this->write((uint8_t) (wire_length >> 8));
|
||||
this->write((uint8_t) (wire_length & 0xFF));
|
||||
|
||||
uint16_t sum = ((wire_length) >> 8) + ((wire_length) &0xFF) + COMMAND;
|
||||
uint16_t sum = (wire_length >> 8) + (wire_length & 0xFF) + COMMAND;
|
||||
for (auto data : *p_data_buffer) {
|
||||
this->write(data);
|
||||
sum += data;
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
#include "he60r.h"
|
||||
#include "esphome/core/hal.h"
|
||||
#include "esphome/core/log.h"
|
||||
|
||||
#include <cinttypes>
|
||||
|
||||
namespace esphome {
|
||||
|
@ -125,10 +126,10 @@ void HE60rCover::process_rx_(uint8_t data) {
|
|||
}
|
||||
|
||||
void HE60rCover::update_() {
|
||||
if (toggles_needed_ != 0) {
|
||||
if (this->toggles_needed_ != 0) {
|
||||
if ((this->counter_++ & 0x3) == 0) {
|
||||
toggles_needed_--;
|
||||
ESP_LOGD(TAG, "Writing byte 0x30, still needed=%" PRIu32, toggles_needed_);
|
||||
this->toggles_needed_--;
|
||||
ESP_LOGD(TAG, "Writing byte 0x30, still needed=%" PRIu32, this->toggles_needed_);
|
||||
this->write_byte(TOGGLE_BYTE);
|
||||
} else {
|
||||
this->write_byte(QUERY_BYTE);
|
||||
|
|
|
@ -12,6 +12,8 @@
|
|||
#include "esphome/core/helpers.h"
|
||||
#include "esphome/core/log.h"
|
||||
|
||||
#include <cinttypes>
|
||||
|
||||
namespace esphome {
|
||||
namespace htu31d {
|
||||
|
||||
|
@ -204,7 +206,7 @@ uint32_t HTU31DComponent::read_serial_num_() {
|
|||
return 0;
|
||||
}
|
||||
|
||||
ESP_LOGD(TAG, "Found serial: 0x%X", serial);
|
||||
ESP_LOGD(TAG, "Found serial: 0x%" PRIX32, serial);
|
||||
|
||||
return serial;
|
||||
}
|
||||
|
|
|
@ -483,7 +483,7 @@ bool INA2XX::read_power_w_(float &power_out) {
|
|||
uint64_t power_reading{0};
|
||||
auto ret = this->read_unsigned_((uint8_t) RegisterMap::REG_POWER, 3, power_reading);
|
||||
|
||||
ESP_LOGV(TAG, "read_power_w_ ret=%s, reading_lsb=%d", OKFAILED(ret), (uint32_t) power_reading);
|
||||
ESP_LOGV(TAG, "read_power_w_ ret=%s, reading_lsb=%" PRIu32, OKFAILED(ret), (uint32_t) power_reading);
|
||||
if (ret) {
|
||||
power_out = this->cfg_.power_coeff * this->current_lsb_ * (float) power_reading;
|
||||
}
|
||||
|
@ -503,8 +503,8 @@ bool INA2XX::read_energy_(double &joules_out, double &watt_hours_out) {
|
|||
uint64_t previous_energy = this->energy_overflows_count_ * (((uint64_t) 1) << 40);
|
||||
auto ret = this->read_unsigned_((uint8_t) RegisterMap::REG_ENERGY, 5, joules_reading);
|
||||
|
||||
ESP_LOGV(TAG, "read_energy_j_ ret=%s, reading_lsb=0x%" PRIX64 ", current_lsb=%f, overflow_cnt=%d", OKFAILED(ret),
|
||||
joules_reading, this->current_lsb_, this->energy_overflows_count_);
|
||||
ESP_LOGV(TAG, "read_energy_j_ ret=%s, reading_lsb=0x%" PRIX64 ", current_lsb=%f, overflow_cnt=%" PRIu32,
|
||||
OKFAILED(ret), joules_reading, this->current_lsb_, this->energy_overflows_count_);
|
||||
if (ret) {
|
||||
joules_out = this->cfg_.energy_coeff * this->current_lsb_ * (double) joules_reading + (double) previous_energy;
|
||||
watt_hours_out = joules_out / 3600.0;
|
||||
|
@ -528,7 +528,7 @@ bool INA2XX::read_charge_(double &coulombs_out, double &_hours_out) {
|
|||
auto ret = this->read_unsigned_((uint8_t) RegisterMap::REG_CHARGE, 5, raw);
|
||||
coulombs_reading = this->two_complement_(raw, 40);
|
||||
|
||||
ESP_LOGV(TAG, "read_charge_c_ ret=%d, curr_charge=%f + 39-bit overflow_cnt=%d", ret, coulombs_reading,
|
||||
ESP_LOGV(TAG, "read_charge_c_ ret=%d, curr_charge=%f + 39-bit overflow_cnt=%" PRIu32, ret, coulombs_reading,
|
||||
this->charge_overflows_count_);
|
||||
if (ret) {
|
||||
coulombs_out = this->current_lsb_ * (double) coulombs_reading + (double) previous_charge;
|
||||
|
|
|
@ -2,8 +2,6 @@
|
|||
#include "esphome/core/helpers.h"
|
||||
#include "esphome/core/log.h"
|
||||
|
||||
#include <cinttypes>
|
||||
|
||||
// Very basic support for JSN_SR04T V3.0 distance sensor in mode 2
|
||||
|
||||
namespace esphome {
|
||||
|
@ -38,7 +36,7 @@ void Jsnsr04tComponent::check_buffer_() {
|
|||
uint16_t distance = encode_uint16(this->buffer_[1], this->buffer_[2]);
|
||||
if (distance > 250) {
|
||||
float meters = distance / 1000.0f;
|
||||
ESP_LOGV(TAG, "Distance from sensor: %" PRIu32 "mm, %.3fm", distance, meters);
|
||||
ESP_LOGV(TAG, "Distance from sensor: %umm, %.3fm", distance, meters);
|
||||
this->publish_state(meters);
|
||||
} else {
|
||||
ESP_LOGW(TAG, "Invalid data read from sensor: %s", format_hex_pretty(this->buffer_).c_str());
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
#include "mhz19.h"
|
||||
#include "esphome/core/log.h"
|
||||
|
||||
#include <cinttypes>
|
||||
|
||||
namespace esphome {
|
||||
|
|
|
@ -20,6 +20,7 @@
|
|||
#include <tensorflow/lite/micro/micro_interpreter.h>
|
||||
#include <tensorflow/lite/micro/micro_mutable_op_resolver.h>
|
||||
|
||||
#include <cinttypes>
|
||||
#include <cmath>
|
||||
|
||||
namespace esphome {
|
||||
|
@ -316,7 +317,7 @@ float MicroWakeWord::perform_streaming_inference_() {
|
|||
return false;
|
||||
}
|
||||
|
||||
ESP_LOGV(TAG, "Streaming Inference Latency=%u ms", (millis() - prior_invoke));
|
||||
ESP_LOGV(TAG, "Streaming Inference Latency=%" PRIu32 " ms", (millis() - prior_invoke));
|
||||
|
||||
TfLiteTensor *output = this->streaming_interpreter_->output(0);
|
||||
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
#include "byronsx_protocol.h"
|
||||
#include "esphome/core/log.h"
|
||||
|
||||
#include <cinttypes>
|
||||
|
||||
namespace esphome {
|
||||
|
|
|
@ -1,6 +1,8 @@
|
|||
#include "drayton_protocol.h"
|
||||
#include "esphome/core/log.h"
|
||||
|
||||
#include <cinttypes>
|
||||
|
||||
namespace esphome {
|
||||
namespace remote_base {
|
||||
|
||||
|
|
|
@ -128,7 +128,8 @@ bool SonoffD1Output::read_ack_(const uint8_t *cmd, const size_t len) {
|
|||
// Expected acknowledgement from rf chip
|
||||
uint8_t ref_buffer[7] = {0xAA, 0x55, cmd[2], cmd[3], 0x00, 0x00, 0x00};
|
||||
uint8_t buffer[sizeof(ref_buffer)] = {0};
|
||||
uint32_t pos = 0, buf_len = sizeof(ref_buffer);
|
||||
uint32_t pos = 0;
|
||||
size_t buf_len = sizeof(ref_buffer);
|
||||
|
||||
// Update the reference checksum
|
||||
this->populate_checksum_(ref_buffer, sizeof(ref_buffer));
|
||||
|
|
|
@ -375,8 +375,8 @@ void WeikaiChannel::set_baudrate_() {
|
|||
this->parent_->page1_ = false; // switch back to page 0
|
||||
this->reg(WKREG_SPAGE) = 0;
|
||||
|
||||
ESP_LOGV(TAG, " Crystal=%d baudrate=%d => registers [%d %d %d]", this->parent_->crystal_, this->baud_rate_,
|
||||
baud_high, baud_low, baud_dec);
|
||||
ESP_LOGV(TAG, " Crystal=%" PRId32 " baudrate=%" PRId32 " => registers [%d %d %d]", this->parent_->crystal_,
|
||||
this->baud_rate_, baud_high, baud_low, baud_dec);
|
||||
}
|
||||
|
||||
inline bool WeikaiChannel::tx_fifo_is_not_empty_() { return this->reg(WKREG_FSR) & FSR_TFDAT; }
|
||||
|
|
|
@ -1,6 +1,8 @@
|
|||
#include "wl_134.h"
|
||||
#include "esphome/core/log.h"
|
||||
|
||||
#include <cinttypes>
|
||||
|
||||
namespace esphome {
|
||||
namespace wl_134 {
|
||||
|
||||
|
@ -71,7 +73,7 @@ Wl134Component::Rfid134Error Wl134Component::read_packet_() {
|
|||
ESP_LOGV(TAG, "isData: %s", reading.isData ? "true" : "false");
|
||||
ESP_LOGV(TAG, "isAnimal: %s", reading.isAnimal ? "true" : "false");
|
||||
ESP_LOGV(TAG, "Reserved0: %d", reading.reserved0);
|
||||
ESP_LOGV(TAG, "Reserved1: %d", reading.reserved1);
|
||||
ESP_LOGV(TAG, "Reserved1: %" PRId32, reading.reserved1);
|
||||
|
||||
char buf[20];
|
||||
sprintf(buf, "%03d%012lld", reading.country, reading.id);
|
||||
|
|
|
@ -3,6 +3,7 @@
|
|||
#include "esphome/core/hal.h"
|
||||
#include "esphome/core/helpers.h"
|
||||
#include "esphome/components/i2c/i2c.h"
|
||||
|
||||
#include <cinttypes>
|
||||
|
||||
namespace esphome {
|
||||
|
|
|
@ -32,8 +32,8 @@ remote_receiver:
|
|||
on_coolix:
|
||||
then:
|
||||
- logger.log:
|
||||
format: "on_coolix: %u %u"
|
||||
args: ["x.first", "x.second"]
|
||||
format: "on_coolix: %lu %lu"
|
||||
args: ["long(x.first)", "long(x.second)"]
|
||||
on_dish:
|
||||
then:
|
||||
- logger.log:
|
||||
|
@ -52,13 +52,13 @@ remote_receiver:
|
|||
on_jvc:
|
||||
then:
|
||||
- logger.log:
|
||||
format: "on_jvc: %u"
|
||||
args: ["x.data"]
|
||||
format: "on_jvc: %lu"
|
||||
args: ["long(x.data)"]
|
||||
on_keeloq:
|
||||
then:
|
||||
- logger.log:
|
||||
format: "on_keeloq: %u %u %u"
|
||||
args: ["x.encrypted", "x.address", "x.command"]
|
||||
format: "on_keeloq: %lu %lu %u"
|
||||
args: ["long(x.encrypted)", "long(x.address)", "x.command"]
|
||||
on_haier:
|
||||
then:
|
||||
- logger.log:
|
||||
|
@ -67,13 +67,13 @@ remote_receiver:
|
|||
on_lg:
|
||||
then:
|
||||
- logger.log:
|
||||
format: "on_lg: %u %u"
|
||||
args: ["x.data", "x.nbits"]
|
||||
format: "on_lg: %lu %u"
|
||||
args: ["long(x.data)", "x.nbits"]
|
||||
on_magiquest:
|
||||
then:
|
||||
- logger.log:
|
||||
format: "on_magiquest: %u %u"
|
||||
args: ["x.magnitude", "x.wand_id"]
|
||||
format: "on_magiquest: %u %lu"
|
||||
args: ["x.magnitude", "long(x.wand_id)"]
|
||||
on_midea:
|
||||
then:
|
||||
- logger.log:
|
||||
|
@ -87,13 +87,13 @@ remote_receiver:
|
|||
on_nexa:
|
||||
then:
|
||||
- logger.log:
|
||||
format: "on_nexa: %u %u %u %u %u"
|
||||
args: ["x.device", "x.group", "x.state", "x.channel", "x.level"]
|
||||
format: "on_nexa: %lu %u %u %u %u"
|
||||
args: ["long(x.device)", "x.group", "x.state", "x.channel", "x.level"]
|
||||
on_panasonic:
|
||||
then:
|
||||
- logger.log:
|
||||
format: "on_panasonic: %u %u"
|
||||
args: ["x.address", "x.command"]
|
||||
format: "on_panasonic: %u %lu"
|
||||
args: ["x.address", "long(x.command)"]
|
||||
on_pioneer:
|
||||
then:
|
||||
- logger.log:
|
||||
|
@ -107,8 +107,8 @@ remote_receiver:
|
|||
on_raw:
|
||||
then:
|
||||
- logger.log:
|
||||
format: "on_raw: %u"
|
||||
args: ["x.front()"]
|
||||
format: "on_raw: %lu"
|
||||
args: ["long(x.front())"]
|
||||
on_rc5:
|
||||
then:
|
||||
- logger.log:
|
||||
|
@ -132,13 +132,13 @@ remote_receiver:
|
|||
on_samsung36:
|
||||
then:
|
||||
- logger.log:
|
||||
format: "on_samsung36: %u %u"
|
||||
args: ["x.address", "x.command"]
|
||||
format: "on_samsung36: %u %lu"
|
||||
args: ["x.address", "long(x.command)"]
|
||||
on_sony:
|
||||
then:
|
||||
- logger.log:
|
||||
format: "on_sony: %u %u"
|
||||
args: ["x.data", "x.nbits"]
|
||||
format: "on_sony: %lu %u"
|
||||
args: ["long(x.data)", "x.nbits"]
|
||||
on_toshiba_ac:
|
||||
then:
|
||||
- logger.log:
|
||||
|
|
Loading…
Reference in a new issue