Mirror of espurna firmware for wireless switches and more
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

45 lines
871 B

2 years ago
  1. /*
  2. Part of the RELAY MODULE
  3. Copyright (C) 2016-2019 by Xose Pérez <xose dot perez at gmail dot com>
  4. Copyright (C) 2019-2021 by Maxim Prokhorov <prokhorov dot max at outlook dot com>
  5. */
  6. #pragma once
  7. #include <cstdint>
  8. namespace espurna {
  9. namespace relay {
  10. namespace pulse {
  11. namespace {
  12. Result parse(StringView value) {
  13. return internal::parse(value.begin(), value.end());
  14. }
  15. #if 0
  16. void test() {
  17. auto report = [](const String& value) {
  18. const auto result = parse(value);
  19. DEBUG_MSG_P(PSTR(":\"%s\" is #%c -> %u (ms)\n"),
  20. value.c_str(),
  21. static_cast<bool>(result) ? 't' : 'f',
  22. result.count());
  23. };
  24. report("5h");
  25. report("7h6h");
  26. report("15m");
  27. report("19m1h");
  28. report("12345");
  29. report("1.5");
  30. }
  31. #endif
  32. } // namespace
  33. } // namespace pulse
  34. } // namespace relay
  35. } // namespace espurna