mirror of
https://github.com/esphome/esphome.git
synced 2024-11-27 17:27:59 +01:00
cse7766: Shave off 200k from the firmware when you log the raw measurement data, #include <iomanip> includes everything not just the kitchen sink. I tried debugging my smart plug (somehow only reports voltage), and with a barebone config, debug level none, the firmware is over half the flash size with this.
This commit is contained in:
parent
01497c891d
commit
433c6866cb
1 changed files with 7 additions and 7 deletions
|
@ -1,7 +1,6 @@
|
||||||
#include "cse7766.h"
|
#include "cse7766.h"
|
||||||
#include "esphome/core/log.h"
|
#include "esphome/core/log.h"
|
||||||
#include <cinttypes>
|
#include <cinttypes>
|
||||||
#include <iomanip>
|
|
||||||
#include <sstream>
|
#include <sstream>
|
||||||
|
|
||||||
namespace esphome {
|
namespace esphome {
|
||||||
|
@ -72,12 +71,13 @@ bool CSE7766Component::check_byte_() {
|
||||||
void CSE7766Component::parse_data_() {
|
void CSE7766Component::parse_data_() {
|
||||||
#if ESPHOME_LOG_LEVEL >= ESPHOME_LOG_LEVEL_VERY_VERBOSE
|
#if ESPHOME_LOG_LEVEL >= ESPHOME_LOG_LEVEL_VERY_VERBOSE
|
||||||
{
|
{
|
||||||
std::stringstream ss;
|
std::string s = "Raw data:";
|
||||||
ss << "Raw data:" << std::hex << std::uppercase << std::setfill('0');
|
char buff[4] = {0};
|
||||||
for (uint8_t i = 0; i < 23; i++) {
|
for (uint8_t i = 0; i <= 23; i++) {
|
||||||
ss << ' ' << std::setw(2) << static_cast<unsigned>(this->raw_data_[i]);
|
snprintf(buff, sizeof(buff), " %02X", this->raw_data_[i]);
|
||||||
}
|
s += buff;
|
||||||
ESP_LOGVV(TAG, "%s", ss.str().c_str());
|
}
|
||||||
|
ESP_LOGVV(TAG, "%s", s.c_str());
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue