IDF 5 fixes for various components from test2.yaml (#5621)

This commit is contained in:
Keith Burzinski 2023-10-29 00:50:26 -05:00 committed by GitHub
parent f7f63c9da1
commit 7cf056e828
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
8 changed files with 19 additions and 14 deletions

View file

@ -95,7 +95,7 @@ void DutyTimeSensor::publish_and_save_(const uint32_t sec, const uint32_t ms) {
void DutyTimeSensor::dump_config() { void DutyTimeSensor::dump_config() {
ESP_LOGCONFIG(TAG, "Duty Time:"); ESP_LOGCONFIG(TAG, "Duty Time:");
ESP_LOGCONFIG(TAG, " Update Interval: %dms", this->get_update_interval()); ESP_LOGCONFIG(TAG, " Update Interval: %" PRId32 "ms", this->get_update_interval());
ESP_LOGCONFIG(TAG, " Restore: %s", ONOFF(this->restore_)); ESP_LOGCONFIG(TAG, " Restore: %s", ONOFF(this->restore_));
LOG_SENSOR(" ", "Duty Time Sensor:", this); LOG_SENSOR(" ", "Duty Time Sensor:", this);
LOG_SENSOR(" ", "Last Duty Time Sensor:", this->last_duty_time_sensor_); LOG_SENSOR(" ", "Last Duty Time Sensor:", this->last_duty_time_sensor_);

View file

@ -1,5 +1,7 @@
#pragma once #pragma once
#include <cinttypes>
#include "esphome/core/automation.h" #include "esphome/core/automation.h"
#include "esphome/core/component.h" #include "esphome/core/component.h"
#include "esphome/core/preferences.h" #include "esphome/core/preferences.h"

View file

@ -69,7 +69,7 @@ bool MopekaProCheck::parse_device(const esp32_ble_tracker::ESPBTDevice &device)
if ((this->distance_ != nullptr) || (this->level_ != nullptr)) { if ((this->distance_ != nullptr) || (this->level_ != nullptr)) {
uint32_t distance_value = this->parse_distance_(manu_data.data); uint32_t distance_value = this->parse_distance_(manu_data.data);
SensorReadQuality quality_value = this->parse_read_quality_(manu_data.data); SensorReadQuality quality_value = this->parse_read_quality_(manu_data.data);
ESP_LOGD(TAG, "Distance Sensor: Quality (0x%X) Distance (%dmm)", quality_value, distance_value); ESP_LOGD(TAG, "Distance Sensor: Quality (0x%X) Distance (%" PRId32 "mm)", quality_value, distance_value);
if (quality_value < QUALITY_HIGH) { if (quality_value < QUALITY_HIGH) {
ESP_LOGW(TAG, "Poor read quality."); ESP_LOGW(TAG, "Poor read quality.");
} }

View file

@ -1,11 +1,12 @@
#pragma once #pragma once
#include <cinttypes>
#include <vector>
#include "esphome/core/component.h" #include "esphome/core/component.h"
#include "esphome/components/sensor/sensor.h" #include "esphome/components/sensor/sensor.h"
#include "esphome/components/esp32_ble_tracker/esp32_ble_tracker.h" #include "esphome/components/esp32_ble_tracker/esp32_ble_tracker.h"
#include <vector>
#ifdef USE_ESP32 #ifdef USE_ESP32
namespace esphome { namespace esphome {

View file

@ -16,8 +16,8 @@ static const uint16_t MANUFACTURER_ID = 0x000D;
void MopekaStdCheck::dump_config() { void MopekaStdCheck::dump_config() {
ESP_LOGCONFIG(TAG, "Mopeka Std Check"); ESP_LOGCONFIG(TAG, "Mopeka Std Check");
ESP_LOGCONFIG(TAG, " Propane Butane mix: %.0f%%", this->propane_butane_mix_ * 100); ESP_LOGCONFIG(TAG, " Propane Butane mix: %.0f%%", this->propane_butane_mix_ * 100);
ESP_LOGCONFIG(TAG, " Tank distance empty: %imm", this->empty_mm_); ESP_LOGCONFIG(TAG, " Tank distance empty: %" PRIi32 "mm", this->empty_mm_);
ESP_LOGCONFIG(TAG, " Tank distance full: %imm", this->full_mm_); ESP_LOGCONFIG(TAG, " Tank distance full: %" PRIi32 "mm", this->full_mm_);
LOG_SENSOR(" ", "Level", this->level_); LOG_SENSOR(" ", "Level", this->level_);
LOG_SENSOR(" ", "Temperature", this->temperature_); LOG_SENSOR(" ", "Temperature", this->temperature_);
LOG_SENSOR(" ", "Battery Level", this->battery_level_); LOG_SENSOR(" ", "Battery Level", this->battery_level_);

View file

@ -1,5 +1,6 @@
#pragma once #pragma once
#include <cinttypes>
#include <vector> #include <vector>
#include "esphome/components/esp32_ble_tracker/esp32_ble_tracker.h" #include "esphome/components/esp32_ble_tracker/esp32_ble_tracker.h"

View file

@ -70,15 +70,15 @@ void SGP4xComponent::setup() {
if (this->pref_.load(&this->voc_baselines_storage_)) { if (this->pref_.load(&this->voc_baselines_storage_)) {
this->voc_state0_ = this->voc_baselines_storage_.state0; this->voc_state0_ = this->voc_baselines_storage_.state0;
this->voc_state1_ = this->voc_baselines_storage_.state1; this->voc_state1_ = this->voc_baselines_storage_.state1;
ESP_LOGI(TAG, "Loaded VOC baseline state0: 0x%04X, state1: 0x%04X", this->voc_baselines_storage_.state0, ESP_LOGI(TAG, "Loaded VOC baseline state0: 0x%04" PRIX32 ", state1: 0x%04" PRIX32,
voc_baselines_storage_.state1); this->voc_baselines_storage_.state0, voc_baselines_storage_.state1);
} }
// Initialize storage timestamp // Initialize storage timestamp
this->seconds_since_last_store_ = 0; this->seconds_since_last_store_ = 0;
if (this->voc_baselines_storage_.state0 > 0 && this->voc_baselines_storage_.state1 > 0) { if (this->voc_baselines_storage_.state0 > 0 && this->voc_baselines_storage_.state1 > 0) {
ESP_LOGI(TAG, "Setting VOC baseline from save state0: 0x%04X, state1: 0x%04X", ESP_LOGI(TAG, "Setting VOC baseline from save state0: 0x%04" PRIX32 ", state1: 0x%04" PRIX32,
this->voc_baselines_storage_.state0, voc_baselines_storage_.state1); this->voc_baselines_storage_.state0, voc_baselines_storage_.state1);
voc_algorithm_.set_states(this->voc_baselines_storage_.state0, this->voc_baselines_storage_.state1); voc_algorithm_.set_states(this->voc_baselines_storage_.state0, this->voc_baselines_storage_.state1);
} }
@ -178,8 +178,8 @@ bool SGP4xComponent::measure_gas_indices_(int32_t &voc, int32_t &nox) {
this->voc_baselines_storage_.state1 = this->voc_state1_; this->voc_baselines_storage_.state1 = this->voc_state1_;
if (this->pref_.save(&this->voc_baselines_storage_)) { if (this->pref_.save(&this->voc_baselines_storage_)) {
ESP_LOGI(TAG, "Stored VOC baseline state0: 0x%04X ,state1: 0x%04X", this->voc_baselines_storage_.state0, ESP_LOGI(TAG, "Stored VOC baseline state0: 0x%04" PRIX32 " ,state1: 0x%04" PRIX32,
voc_baselines_storage_.state1); this->voc_baselines_storage_.state0, voc_baselines_storage_.state1);
} else { } else {
ESP_LOGW(TAG, "Could not store VOC baselines"); ESP_LOGW(TAG, "Could not store VOC baselines");
} }
@ -273,7 +273,7 @@ void SGP4xComponent::update_gas_indices() {
} }
if (this->samples_read_ < this->samples_to_stabilize_) { if (this->samples_read_ < this->samples_to_stabilize_) {
this->samples_read_++; this->samples_read_++;
ESP_LOGD(TAG, "Sensor has not collected enough samples yet. (%d/%d) VOC index is: %u", this->samples_read_, ESP_LOGD(TAG, "Sensor has not collected enough samples yet. (%d/%d) VOC index is: %" PRIu32, this->samples_read_,
this->samples_to_stabilize_, this->voc_index_); this->samples_to_stabilize_, this->voc_index_);
return; return;
} }

View file

@ -1,5 +1,8 @@
#pragma once #pragma once
#include <cinttypes>
#include <cmath>
#include "esphome/core/component.h" #include "esphome/core/component.h"
#include "esphome/components/sensor/sensor.h" #include "esphome/components/sensor/sensor.h"
#include "esphome/components/sensirion_common/i2c_sensirion.h" #include "esphome/components/sensirion_common/i2c_sensirion.h"
@ -8,8 +11,6 @@
#include <VOCGasIndexAlgorithm.h> #include <VOCGasIndexAlgorithm.h>
#include <NOxGasIndexAlgorithm.h> #include <NOxGasIndexAlgorithm.h>
#include <cmath>
namespace esphome { namespace esphome {
namespace sgp4x { namespace sgp4x {