Fork of the espurna firmware for `mhsw` switches
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.

64 lines
1.5 KiB

Rework settings (#2282) * wip based on early draft. todo benchmarking * fixup eraser, assume keys are unique * fix cursor copy, test removal at random * small benchmark via permutations. todo lambdas and novirtual * fix empty condition / reset * overwrite optimizations, fix move offsets overflows * ...erase using 0xff instead of 0 * test the theory with code, different length kv were bugged * try to check for out-of-bounds writes / reads * style * trying to fix mover again * clarify length, defend against reading len on edge * fix uncommited rewind change * prove space assumptions * more concise traces, fix move condition (agrh!!!) * slightly more internal knowledge (estimates API?) * make sure cursor is only valid within the range * ensure 0 does not blow things * go back up * cursor comments * comments * rewrite writes through cursor * in del too * estimate kv storage requirements, return available size * move raw erase / move into a method, allow ::set to avoid scanning storage twice * refactor naming, use in code * amend storage slicing test * fix crash handler offsets, cleanup configuration * start -> begin * eeprom readiness * dependencies * unused * SPI_FLASH constants for older Core * vtables -> templates * less include dependencies * gcov help, move estimate outside of the class * writer position can never match, use begin + offset * tweak save_crash to trigger only once in a serious crash * doh, header function should be inline * foreach api, tweak structs for public api * use test helper class * when not using foreach, move cursor reset closer to the loop using read_kv * coverage comments, fix typo in tests decltype * ensure set() does not break with offset * make codacy happy again
3 years ago
  1. /*
  2. ESPurna
  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. This program is free software: you can redistribute it and/or modify
  6. it under the terms of the GNU General Public License as published by
  7. the Free Software Foundation, either version 3 of the License, or
  8. (at your option) any later version.
  9. This program is distributed in the hope that it will be useful,
  10. but WITHOUT ANY WARRANTY; without even the implied warranty of
  11. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  12. GNU General Public License for more details.
  13. You should have received a copy of the GNU General Public License
  14. along with this program. If not, see <http://www.gnu.org/licenses/>.
  15. */
  16. #pragma once
  17. #include "config/all.h"
  18. #include "compat.h"
  19. #include "board.h"
  20. #include "debug.h"
  21. #include "gpio.h"
  22. #include "storage_eeprom.h"
  23. #include "settings.h"
  24. #include "system.h"
  25. #include "terminal.h"
  26. #include "utils.h"
  27. #include "wifi.h"
  28. #include <functional>
  29. #include <algorithm>
  30. #include <limits>
  31. #include <vector>
  32. #include <memory>
  33. #if DEBUG_SUPPORT
  34. #define DEBUG_MSG(...) debugSend(__VA_ARGS__)
  35. #define DEBUG_MSG_P(...) debugSend_P(__VA_ARGS__)
  36. #endif
  37. #ifndef DEBUG_MSG
  38. #define DEBUG_MSG(...)
  39. #define DEBUG_MSG_P(...)
  40. #endif
  41. using LoopCallback = void (*)();
  42. void espurnaRegisterLoop(LoopCallback callback);
  43. void espurnaRegisterReload(LoopCallback callback);
  44. void espurnaReload();
  45. unsigned long espurnaLoopDelay();
  46. void espurnaLoopDelay(unsigned long);
  47. void extraSetup();