From b064df5fe766bf9a1055b66b3d39ce9354541c49 Mon Sep 17 00:00:00 2001 From: Mentalflow <312902918@qq.com> Date: Sat, 22 Apr 2023 11:23:28 +0800 Subject: [PATCH] V1.1.2 Update --- README.md | 4 ++++ examples/dlln3x_test/dlln3x_test.ino | 2 +- library.properties | 4 ++-- src/DLLN3X.h | 4 ++-- src/zigbeeframe.h | 33 ++++++++++++++-------------- 5 files changed, 26 insertions(+), 21 deletions(-) diff --git a/README.md b/README.md index dcf6f5f..b660e86 100644 --- a/README.md +++ b/README.md @@ -19,6 +19,10 @@ This library is now complete, the remaining work is mainly maintenance and bug f # Change Log +**V1.1.2 2023.4.22** + ++ Modify header files to avoid compilation conflicts, add warnings for certain boards that do not support STL.(If your board are Arduino AVR architecture(like Arduino Uno), you have to comment 'const std::nothrow_t std::nothrow = { };' in 'ArduinoSTL/src/new_handler.cpp') + **V1.1.1 2023.3.18** + Fix the bug of incomplete copy. diff --git a/examples/dlln3x_test/dlln3x_test.ino b/examples/dlln3x_test/dlln3x_test.ino index 2b511b1..ca447a8 100644 --- a/examples/dlln3x_test/dlln3x_test.ino +++ b/examples/dlln3x_test/dlln3x_test.ino @@ -40,7 +40,7 @@ void setup() { Serial.println(temp); dlln33.set_addr(0xFFFF); //test error report //dlln33.get_link_quality(YOUR_ANOTHER_CHIP_ADDR); //test link quility - dlln33.pin_control(DLLN3X::PIN::PIN4, DLLN3X::PIN_CONTROL::HIGH); //test pin, PIN4 is TTx, PIN5 is TRx + dlln33.pin_control(DLLN3X::PIN::DLLN3X_PIN4, DLLN3X::PIN_CONTROL::OUT_HIGH); //test pin, PIN4 is TTx, PIN5 is TRx } uint64_t interval = 5000, pre_milli = 0; diff --git a/library.properties b/library.properties index 84e8f3e..09ed2cf 100644 --- a/library.properties +++ b/library.properties @@ -1,11 +1,11 @@ name= DLLN3X ZigBee Mesh Module Library -version= 1.1.1 +version= 1.1.2 author= Dylan Liu maintainer= Dylan Liu sentence= This library allows you to use DLLN3X ZigBee mesh module very easily. paragraph= This library currently allows basic send and receive operations, config read/modify, link quility test, pin control and more. category= Communication architectures= * -includes= DLLN3X.h zigbeeframe.h +includes= DLLN3X.h,zigbeeframe.h license= MIT url= https://github.com/mentalfl0w/DLLN3X_zigbee_mesh_module_library diff --git a/src/DLLN3X.h b/src/DLLN3X.h index 9099e77..a7aec05 100644 --- a/src/DLLN3X.h +++ b/src/DLLN3X.h @@ -29,8 +29,8 @@ public: PKG_LENGTH_ERROR = 0xF9, PKG_DATA_ERROR = 0xFA }; - enum PIN_CONTROL{ HIGH = 0x11, LOW = 0x10, READ_PIN = 0x12}; - enum PIN{ PIN4 = 0x44, PIN5 = 0x45}; + enum PIN_CONTROL{ OUT_HIGH = 0x11, OUT_LOW = 0x10, READ_PIN = 0x12}; + enum PIN{ DLLN3X_PIN4 = 0x44, DLLN3X_PIN5 = 0x45}; DLLN3X(); ~DLLN3X(); void init(HardwareSerial* DSerial); diff --git a/src/zigbeeframe.h b/src/zigbeeframe.h index 117f9aa..a3f3c38 100644 --- a/src/zigbeeframe.h +++ b/src/zigbeeframe.h @@ -1,6 +1,7 @@ #ifndef _ZIGBEEFRAME_H_ #define _ZIGBEEFRAME_H_ #include +#if __has_include() #include #include #include @@ -70,9 +71,9 @@ public: uint8_t getDesPort() { return _des_port; }; uint8_t getSrcPort() { return _src_port; }; uint16_t getRemoteAddr() { return _remote_addr; }; - uint8_t getLength(){ return _data.size() + 4;}; - uint8_t getDataLength(){ return _data.size();}; - std::vector& getData(){ return _data; }; + uint8_t getLength() { return _data.size() + 4; }; + uint8_t getDataLength() { return _data.size(); }; + std::vector& getData() { return _data; }; void setData(uint8_t* data, uint8_t length) { _data.clear(); @@ -163,23 +164,19 @@ public: make_package(_src_port, _des_port, _remote_addr, _package, _data, _packed_data); return _package; }; - void load_package(std::vector &buf) - { - load_package(buf.data(),buf.size()); - }; - void load_package(uint8_t *buf, uint8_t length) + void load_package(std::vector& buf) { load_package(buf.data(), buf.size()); }; + void load_package(uint8_t* buf, uint8_t length) { _packed_data.clear(); - for (uint8_t i=0;i5 && i 5 && i < length - 1) _packed_data.push_back(buf[i]); } _length = _package[1]; _src_port = _package[2]; _des_port = _package[3]; - _remote_addr = _package[4] | (_package[5]<<8); + _remote_addr = _package[4] | (_package[5] << 8); depack(_data, _packed_data); }; void print() @@ -220,9 +217,9 @@ public: temp.get_package(); return temp; }; - void operator+=(const ZigbeeFrame& zf) + void operator+=(const ZigbeeFrame& zf) { - addData(zf._data); + addData(zf._data); get_package(); }; void operator=(const ZigbeeFrame& zf) @@ -248,9 +245,9 @@ public: get_package(); return _package[i]; }; - void operator+=(char* data) + void operator+=(char* data) { - addData(data, (uint8_t)strlen(data)); + addData(data, (uint8_t)strlen(data)); get_package(); }; friend std::ostream& operator<<(std::ostream& os, const ZigbeeFrame& zf) @@ -266,4 +263,8 @@ public: } }; } +#else +#error Your Board Didn't support STL, Please install "ArduinoSTL" Library. +#error If your board are Arduino AVR architecture(like Arduino Uno), you have to comment 'const std::nothrow_t std::nothrow = { };' in 'ArduinoSTL/src/new_handler.cpp' +#endif #endif \ No newline at end of file