jsn_sr04t component: AJ_SR04M compatibility mode in checksum calculation (#7044)

Co-authored-by: Jesse Hills <3060199+jesserockz@users.noreply.github.com>
This commit is contained in:
soeffi
2024-07-11 23:30:45 +02:00
committed by GitHub
parent 99cba0ae7f
commit 7f83bcfdd9
3 changed files with 38 additions and 2 deletions
+7 -1
View File
@@ -9,9 +9,14 @@
namespace esphome {
namespace jsn_sr04t {
enum Model {
JSN_SR04T,
AJ_SR04M,
};
class Jsnsr04tComponent : public sensor::Sensor, public PollingComponent, public uart::UARTDevice {
public:
// Nothing really public.
void set_model(Model model) { this->model_ = model; }
// ========== INTERNAL METHODS ==========
void update() override;
@@ -20,6 +25,7 @@ class Jsnsr04tComponent : public sensor::Sensor, public PollingComponent, public
protected:
void check_buffer_();
Model model_;
std::vector<uint8_t> buffer_;
};