Skip to content

Commit

Permalink
Fix
Browse files Browse the repository at this point in the history
  • Loading branch information
AzonInc committed Sep 22, 2024
1 parent 5d68e3d commit 0574168
Showing 1 changed file with 7 additions and 4 deletions.
11 changes: 7 additions & 4 deletions components/tc_bus/tc_bus.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -315,7 +315,10 @@ namespace esphome
ESP_LOGD(TAG, "Reading EEPROM: Received 4 Blocks starting at: %i", (reading_eeprom_count_ * 4));

// Save Data to EEPROM Store
eeprom_buffer_.insert(eeprom_buffer_.end(), reinterpret_cast<uint8_t*>(&command), reinterpret_cast<uint8_t*>(&command) + sizeof(command));
eeprom_buffer_.push_back((command >> 24) & 0xFF);
eeprom_buffer_.push_back((command >> 16) & 0xFF);
eeprom_buffer_.push_back((command >> 8) & 0xFF);
eeprom_buffer_.push_back(command & 0xFF);

// Next 4 Data Blocks
reading_eeprom_count_++;
Expand All @@ -325,12 +328,12 @@ namespace esphome
// Turn off
reading_eeprom_ = false;

std::string hexString(eeprom_buffer_.size() * 2, ' '); // Reserviere den String mit fester Größe
std::string hexString;
hexString.reserve(eeprom_buffer_.size() * 2);

for (std::size_t i = 0; i < eeprom_buffer_.size(); ++i)
{
uint8_t byte = eeprom_buffer_[i];
hexString += format_hex(byte);
hexString += format_hex(eeprom_buffer_[i]);
}

ESP_LOGD(TAG, "Reading EEPROM: Count: %i, Result: %s", eeprom_buffer_.size(), hexString.c_str());
Expand Down

0 comments on commit 0574168

Please sign in to comment.