mirror of
https://github.com/esphome/esphome.git
synced 2026-02-08 00:31:58 +00:00
_strtod_l
This commit is contained in:
@@ -1,6 +1,7 @@
|
||||
#pragma once
|
||||
|
||||
#include "esphome/core/component.h"
|
||||
#include "esphome/core/helpers.h"
|
||||
#include "binary_output.h"
|
||||
|
||||
namespace esphome {
|
||||
@@ -9,12 +10,10 @@ namespace output {
|
||||
#define LOG_FLOAT_OUTPUT(this) \
|
||||
LOG_BINARY_OUTPUT(this) \
|
||||
if (this->max_power_ != 1.0f) { \
|
||||
int _mp = static_cast<int>(this->max_power_ * 1000.0f); \
|
||||
ESP_LOGCONFIG(TAG, " Max Power: %s%d.%d%%", _mp < 0 ? "-" : "", std::abs(_mp / 10), std::abs(_mp % 10)); \
|
||||
ESP_LOGCONFIG(TAG, " Max Power: %s%d.%d%%", DECIMAL_1(this->max_power_ * 100.0f)); \
|
||||
} \
|
||||
if (this->min_power_ != 0.0f) { \
|
||||
int _mp = static_cast<int>(this->min_power_ * 1000.0f); \
|
||||
ESP_LOGCONFIG(TAG, " Min Power: %s%d.%d%%", _mp < 0 ? "-" : "", std::abs(_mp / 10), std::abs(_mp % 10)); \
|
||||
ESP_LOGCONFIG(TAG, " Min Power: %s%d.%d%%", DECIMAL_1(this->min_power_ * 100.0f)); \
|
||||
}
|
||||
|
||||
/** Base class for all output components that can output a variable level, like PWM.
|
||||
|
||||
@@ -450,9 +450,12 @@ void log_update_interval(const char *tag, PollingComponent *component) {
|
||||
if (update_interval == SCHEDULER_DONT_RUN) {
|
||||
ESP_LOGCONFIG(tag, " Update Interval: never");
|
||||
} else if (update_interval < 100) {
|
||||
ESP_LOGCONFIG(tag, " Update Interval: %.3fs", update_interval / 1000.0f);
|
||||
// Use integer math to avoid pulling in _dtoa_r (~3.4KB)
|
||||
// update_interval is in ms, display as X.YYYs
|
||||
ESP_LOGCONFIG(tag, " Update Interval: %d.%03ds", update_interval / 1000, update_interval % 1000);
|
||||
} else {
|
||||
ESP_LOGCONFIG(tag, " Update Interval: %.1fs", update_interval / 1000.0f);
|
||||
// Display as X.Ys (1 decimal place)
|
||||
ESP_LOGCONFIG(tag, " Update Interval: %d.%ds", update_interval / 1000, (update_interval % 1000) / 100);
|
||||
}
|
||||
}
|
||||
float Component::get_actual_setup_priority() const {
|
||||
|
||||
Reference in New Issue
Block a user