Skip to content

Commit

Permalink
fix serialize warning (todo for the next time)
Browse files Browse the repository at this point in the history
  • Loading branch information
mcspr committed Jan 12, 2021
1 parent f16ab6c commit 2b2fb4f
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 7 deletions.
2 changes: 1 addition & 1 deletion code/espurna/relay.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -799,7 +799,7 @@ void _relayMaskSettings(const String& mask) {
}

inline void _relayMaskSettings(const RelayMaskHelper& mask) {
_relayMaskSettings(mask.toString());
_relayMaskSettings(settings::internal::serialize(mask));
}

} // namespace
Expand Down
16 changes: 10 additions & 6 deletions code/espurna/settings.h
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ Copyright (C) 2016-2019 by Xose Pérez <xose dot perez at gmail dot com>
#include <functional>
#include <utility>
#include <vector>
#include <type_traits>

#include <ArduinoJson.h>

Expand Down Expand Up @@ -114,6 +115,14 @@ using settings_cfg_list_t = std::initializer_list<settings_cfg_t>;
namespace settings {
namespace internal {

template <typename T>
using is_arduino_string = std::is_same<String, typename std::decay<T>::type>;

template <typename T>
using enable_if_arduino_string = std::enable_if<is_arduino_string<T>::value>;

// --------------------------------------------------------------------------

uint32_t u32fromString(const String& string, int base);

template <typename T>
Expand Down Expand Up @@ -157,12 +166,7 @@ unsigned char convert(const String& value);
template<typename T>
String serialize(const T& value);

template<typename T>
String serialize(const T& value) {
return String(value);
}

} // namespace settings::internal
} // namespace internal
} // namespace settings

// --------------------------------------------------------------------------
Expand Down

0 comments on commit 2b2fb4f

Please sign in to comment.