mirror of
https://github.com/esphome/esphome.git
synced 2024-11-23 23:48:11 +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 "esphome/core/log.h"
|
||||
#include <cinttypes>
|
||||
#include <iomanip>
|
||||
#include <sstream>
|
||||
|
||||
namespace esphome {
|
||||
|
@ -72,12 +71,13 @@ bool CSE7766Component::check_byte_() {
|
|||
void CSE7766Component::parse_data_() {
|
||||
#if ESPHOME_LOG_LEVEL >= ESPHOME_LOG_LEVEL_VERY_VERBOSE
|
||||
{
|
||||
std::stringstream ss;
|
||||
ss << "Raw data:" << std::hex << std::uppercase << std::setfill('0');
|
||||
for (uint8_t i = 0; i < 23; i++) {
|
||||
ss << ' ' << std::setw(2) << static_cast<unsigned>(this->raw_data_[i]);
|
||||
std::string s = "Raw data:";
|
||||
char buff[4] = {0};
|
||||
for (uint8_t i = 0; i <= 23; 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
|
||||
|
||||
|
|
Loading…
Reference in a new issue