162  ESP_LOGV(TAG, 
"Read from serial: %s", this->
buffer_.substr(0, this->buffer_.size() - 2).c_str());
 
  165    ESP_LOGI(TAG, 
"Comment: %s", this->
buffer_.substr(0, this->buffer_.size() - 2).c_str());
 
  168  std::string::size_type newlineposn = this->
buffer_.find(
'\n');
 
  169  if (newlineposn <= 1) {
 
  171    ESP_LOGD(TAG, 
"Received empty line");
 
  174  if (newlineposn <= 2) {
 
  176    ESP_LOGD(TAG, 
"Received ack: %s", this->
buffer_.substr(0, this->buffer_.size() - 2).c_str());
 
  179  if (this->
buffer_.find(
"LensBad") != std::string::npos) {
 
  180    ESP_LOGW(TAG, 
"Received LensBad!");
 
  183  if (this->
buffer_.find(
"EmSat") != std::string::npos) {
 
  184    ESP_LOGW(TAG, 
"Received EmSat!");
 
  187  if (
buffer_.starts_with(
"PwrDays")) {
 
  195    ESP_LOGI(TAG, 
"Boot detected: %s", this->
buffer_.substr(0, this->buffer_.size() - 2).c_str());
 
  216  if (
buffer_.starts_with(
"SW")) {
 
  217    std::string::size_type majend = this->
buffer_.find(
'.');
 
  218    std::string::size_type endversion = this->
buffer_.find(
' ', 3);
 
  219    if (majend == std::string::npos || endversion == std::string::npos || majend > endversion) {
 
  220      ESP_LOGW(TAG, 
"invalid version string: %s", this->
buffer_.substr(0, this->buffer_.size() - 2).c_str());
 
  222    int major = strtol(this->
buffer_.substr(3, majend - 3).c_str(), 
nullptr, 10);
 
  223    int minor = strtol(this->
buffer_.substr(majend + 1, endversion - (majend + 1)).c_str(), 
nullptr, 10);
 
  225    if (major > 10 || minor >= 1000 || minor < 0 || major < 0) {
 
  226      ESP_LOGW(TAG, 
"invalid version: %s", this->
buffer_.substr(0, this->buffer_.size() - 2).c_str());
 
  229    ESP_LOGI(TAG, 
"detected sw version %i", this->
sw_version_);
 
  232  bool is_data_line = 
false;
 
  233  for (
int i = 0; i < NUM_SENSORS; i++) {
 
  234    if (this->
sensors_[i] != 
nullptr && this->
buffer_.find(PROTOCOL_NAMES[i]) != std::string::npos) {
 
  240    std::string::size_type tc = this->
buffer_.find(
"TooCold");
 
  241    this->
too_cold_ |= tc != std::string::npos;
 
  243      ESP_LOGD(TAG, 
"Received TooCold");
 
  245    for (
int i = 0; i < NUM_SENSORS; i++) {
 
  249      std::string::size_type n = this->
buffer_.find(PROTOCOL_NAMES[i]);
 
  250      if (n == std::string::npos) {
 
  254      if (n == this->
buffer_.find(
't', n)) {
 
  258        n = this->
buffer_.find(
'F', n);
 
  259        if (n == std::string::npos) {
 
  264        n += strlen(PROTOCOL_NAMES[i]);  
 
  268      float data = strtof(this->
buffer_.substr(n).c_str(), 
nullptr);
 
  270      ESP_LOGD(TAG, 
"Received %s: %f", PROTOCOL_NAMES[i], this->
sensors_[i]->get_raw_state());
 
  277    for (
const auto *ignore : IGNORE_STRINGS) {
 
  278      if (
buffer_.starts_with(ignore)) {
 
  279        ESP_LOGI(TAG, 
"Ignoring %s", this->
buffer_.substr(0, this->buffer_.size() - 2).c_str());
 
  283    ESP_LOGI(TAG, 
"Got unknown line: %s", this->
buffer_.c_str());