Fixes
This commit is contained in:
parent
fd901fd1e1
commit
68ab694d8a
2
.gitignore
vendored
Normal file
2
.gitignore
vendored
Normal file
@ -0,0 +1,2 @@
|
|||||||
|
s
|
||||||
|
__pycache__/*
|
17
marlin2.cpp
17
marlin2.cpp
@ -218,6 +218,23 @@ namespace esphome {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
size_t first_space = MarlinOutput.find(' ');
|
||||||
|
size_t second_space = MarlinOutput.find(' ', first_space + 1);
|
||||||
|
|
||||||
|
if(second_space == std::string::npos && first_space == std::string::npos) {
|
||||||
|
std::string short_name = MarlinOutput.substr(0, first_space);
|
||||||
|
std::string long_name = MarlinOutput.substr(second_space + 1);
|
||||||
|
|
||||||
|
file_table_[long_name] = short_name;
|
||||||
|
|
||||||
|
ESP_LOGD(TAG, "Uloženo do tabulky: %s => %s", long_name.c_str(), short_name.c_str());
|
||||||
|
|
||||||
|
//reset string for next line
|
||||||
|
MarlinOutput="";
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
ESP_LOGD(TAG, "#%s#",MarlinOutput.c_str());
|
ESP_LOGD(TAG, "#%s#",MarlinOutput.c_str());
|
||||||
MarlinOutput="";
|
MarlinOutput="";
|
||||||
return;
|
return;
|
||||||
|
@ -1,5 +1,7 @@
|
|||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
|
#include <string>
|
||||||
|
#include <unordered_map>
|
||||||
#include "esphome/core/component.h"
|
#include "esphome/core/component.h"
|
||||||
#include "esphome/components/uart/uart.h"
|
#include "esphome/components/uart/uart.h"
|
||||||
#ifdef USE_SENSOR
|
#ifdef USE_SENSOR
|
||||||
@ -15,7 +17,6 @@ class Marlin2 : public PollingComponent, public uart::UARTDevice {
|
|||||||
public:
|
public:
|
||||||
Marlin2() = default;
|
Marlin2() = default;
|
||||||
|
|
||||||
|
|
||||||
#ifdef USE_SENSOR
|
#ifdef USE_SENSOR
|
||||||
void add_sensor(const std::string& sName, sensor::Sensor *sens);
|
void add_sensor(const std::string& sName, sensor::Sensor *sens);
|
||||||
sensor::Sensor* find_sensor(std::string key);
|
sensor::Sensor* find_sensor(std::string key);
|
||||||
@ -55,6 +56,7 @@ class Marlin2 : public PollingComponent, public uart::UARTDevice {
|
|||||||
|
|
||||||
private:
|
private:
|
||||||
unsigned long millisProgress=0;
|
unsigned long millisProgress=0;
|
||||||
|
std::unordered_map<std::string, std::string> file_table_;
|
||||||
};
|
};
|
||||||
|
|
||||||
} // namespace esphome
|
} // namespace esphome
|
Loading…
x
Reference in New Issue
Block a user