settings: clean-up helper classes & functions

Move inline classes into a separate file.
Make serialize() into a basic function, support numeric conversions with base option
Refactor numeric conversions and add some more helper functions for the
build flags.
This commit is contained in:
Maxim Prokhorov
2021-03-10 11:36:36 +03:00
parent 78b4007f01
commit ec220b7dd1
11 changed files with 486 additions and 300 deletions

View File

@@ -48,8 +48,7 @@ debounce_event::types::Mode convert(const String& value) {
}
}
template<>
String serialize(const debounce_event::types::Mode& value) {
String serialize(debounce_event::types::Mode value) {
String result;
switch (value) {
case debounce_event::types::Mode::Switch:
@@ -76,8 +75,7 @@ debounce_event::types::PinValue convert(const String& value) {
}
}
template<>
String serialize(const debounce_event::types::PinValue& value) {
String serialize(debounce_event::types::PinValue value) {
String result;
switch (value) {
case debounce_event::types::PinValue::Low:
@@ -106,8 +104,7 @@ debounce_event::types::PinMode convert(const String& value) {
}
}
template<>
String serialize(const debounce_event::types::PinMode& mode) {
String serialize(debounce_event::types::PinMode mode) {
String result;
switch (mode) {
case debounce_event::types::PinMode::InputPullup: