diff --git a/lib/uuid-common/src/compare_flash_string.cpp b/lib/uuid-common/src/compare_flash_string.cpp
deleted file mode 100644
index 64700ad67..000000000
--- a/lib/uuid-common/src/compare_flash_string.cpp
+++ /dev/null
@@ -1,71 +0,0 @@
-/*
- * EMS-ESP - https://github.com/emsesp/EMS-ESP
- * Copyright 2020 Paul Derbyshire
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program. If not, see .
- */
-
-#include
-
-// #ifdef ESP8266
-// #include
-// #else
-// #include
-// #endif
-
-#include
-
-namespace uuid {
-
-// On ESP8266, pgm_read_byte() already takes care of 4-byte alignment, and
-// memcpy_P(s, p, 4) makes 4 calls to pgm_read_byte() anyway, so don't bother
-// optimizing for 4-byte alignment here.
-
-// class __FlashStringHelper;
-
-int compare_flash_string(const __FlashStringHelper * a, const __FlashStringHelper * b) {
- const char * aa = reinterpret_cast(a);
- const char * bb = reinterpret_cast(b);
-
- while (true) {
- uint8_t ca = pgm_read_byte(aa);
- uint8_t cb = pgm_read_byte(bb);
- if (ca != cb)
- return (int)ca - (int)cb;
- if (ca == 0)
- return 0;
- aa++;
- bb++;
- }
-}
-
-int compare_flash_string(const __FlashStringHelper * a, const __FlashStringHelper * b, size_t n) {
- const char * aa = reinterpret_cast(a);
- const char * bb = reinterpret_cast(b);
-
- while (n > 0) {
- uint8_t ca = pgm_read_byte(aa);
- uint8_t cb = pgm_read_byte(bb);
- if (ca != cb)
- return (int)ca - (int)cb;
- if (ca == 0)
- return 0;
- aa++;
- bb++;
- n--;
- }
- return 0;
-}
-
-} // namespace uuid
diff --git a/lib/uuid-common/src/get_uptime_ms.cpp b/lib/uuid-common/src/get_uptime_ms.cpp
index 7bc572ce2..48e5fe3c9 100644
--- a/lib/uuid-common/src/get_uptime_ms.cpp
+++ b/lib/uuid-common/src/get_uptime_ms.cpp
@@ -22,7 +22,7 @@
namespace uuid {
-// added by proddy, modified
+// added by proddy for EMS-ESP
static uint64_t now_millis = 0;
// returns system uptime in seconds
diff --git a/lib/uuid-common/src/uuid/common.h b/lib/uuid-common/src/uuid/common.h
index 578c3198a..6184ef971 100644
--- a/lib/uuid-common/src/uuid/common.h
+++ b/lib/uuid-common/src/uuid/common.h
@@ -26,6 +26,20 @@
#include
#include
+#ifndef UUID_COMMON_STD_MUTEX_AVAILABLE
+#if __has_include() && (!defined(_GLIBCXX_MUTEX) || defined(_GLIBCXX_HAS_GTHREADS))
+#define UUID_COMMON_STD_MUTEX_AVAILABLE 1
+#else
+#define UUID_COMMON_STD_MUTEX_AVAILABLE 0
+#endif
+#endif
+
+#if defined(ARDUINO_ARCH_ESP32) || UUID_COMMON_STD_MUTEX_AVAILABLE
+#define UUID_COMMON_THREAD_SAFE 1
+#else
+#define UUID_COMMON_THREAD_SAFE 0
+#endif
+
/**
* Common utilities.
*
@@ -35,31 +49,15 @@
namespace uuid {
/**
- * String compare two flash strings
+ * Thread-safe status of the library.
*
- * The flash string must be stored with appropriate alignment for
- * reading it on the platform.
- *
- * @param[in] a Pointer to string stored in flash.
- * @param[in] b Pointer to string stored in flash.
- * @param[in] n optional max length
- * @return 0 for match, otherwise diff
- * @since 1.0.0
+ * @since 1.1.2
*/
-int compare_flash_string(const __FlashStringHelper * a, const __FlashStringHelper * b);
-int compare_flash_string(const __FlashStringHelper * a, const __FlashStringHelper * b, size_t n);
-
-/**
- * Read a string from flash and convert it to a std::string.
- *
- * The flash string must be stored with appropriate alignment for
- * reading it on the platform.
- *
- * @param[in] flash_str Pointer to string stored in flash.
- * @return A string copy of the flash string.
- * @since 1.0.0
- */
-std::string read_flash_string(const __FlashStringHelper * flash_str);
+#if UUID_COMMON_THREAD_SAFE
+static constexpr bool thread_safe = true;
+#else
+static constexpr bool thread_safe = false;
+#endif
/**
* Append to a std::string by printing a Printable object.
@@ -104,8 +102,8 @@ void loop();
*/
uint64_t get_uptime_ms();
-uint32_t get_uptime(); // added by proddy
-uint32_t get_uptime_sec(); // added by proddy
+uint32_t get_uptime(); // added by proddy for EMS-ESP
+uint32_t get_uptime_sec(); // added by proddy for EMS-ESP
void set_uptime();
diff --git a/lib/uuid-console/src/commands.cpp b/lib/uuid-console/src/commands.cpp
index 4a8c47563..a76eb09d5 100644
--- a/lib/uuid-console/src/commands.cpp
+++ b/lib/uuid-console/src/commands.cpp
@@ -1,6 +1,6 @@
/*
* uuid-console - Microcontroller console shell
- * Copyright 2019 Simon Arlott
+ * Copyright 2019,2022 Simon Arlott
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@ -12,7 +12,7 @@
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
- * You should have received a std::copy of the GNU General Public License
+ * You should have received a copy of the GNU General Public License
* along with this program. If not, see .
*/
@@ -25,6 +25,7 @@
#include