DIY fertilizer mixer and plant watering machine https://www.xythobuz.de/giessomat.html
Du kan inte välja fler än 25 ämnen Ämnen måste starta med en bokstav eller siffra, kan innehålla bindestreck ('-') och vara max 35 tecken långa.

SimpleUpdater.h 1.5KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960
  1. /*
  2. * Copyright (c) 2021 Thomas Buck <thomas@xythobuz.de>
  3. *
  4. * This file is part of Giess-o-mat.
  5. *
  6. * Giess-o-mat is free software: you can redistribute it and/or modify
  7. * it under the terms of the GNU General Public License as published by
  8. * the Free Software Foundation, either version 3 of the License, or
  9. * (at your option) any later version.
  10. *
  11. * Giess-o-mat is distributed in the hope that it will be useful,
  12. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  13. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  14. * GNU General Public License for more details.
  15. *
  16. * You should have received a copy of the GNU General Public License
  17. * along with Giess-o-mat. If not, see <https://www.gnu.org/licenses/>.
  18. */
  19. #ifndef __ESP_SIMPLE_UPDATER__
  20. #define __ESP_SIMPLE_UPDATER__
  21. #if defined(ARDUINO_ARCH_ESP8266)
  22. #include <ESP8266WebServer.h>
  23. #include <ESP8266HTTPUpdateServer.h>
  24. #define UPDATE_WEB_SERVER ESP8266WebServer
  25. #elif defined(ARDUINO_ARCH_ESP32)
  26. #include <WebServer.h>
  27. #define UPDATE_WEB_SERVER WebServer
  28. #endif
  29. #if defined(ARDUINO_ARCH_ESP8266) || defined(ARDUINO_ARCH_ESP32)
  30. class SimpleUpdater {
  31. public:
  32. SimpleUpdater(String _uri = String("/update"));
  33. void setup(UPDATE_WEB_SERVER *_server);
  34. private:
  35. #if defined(ARDUINO_ARCH_ESP8266)
  36. ESP8266HTTPUpdateServer updateServer;
  37. #elif defined(ARDUINO_ARCH_ESP32)
  38. void get(void);
  39. void postResult(void);
  40. void postUpload(void);
  41. #endif
  42. String uri;
  43. UPDATE_WEB_SERVER *server;
  44. };
  45. #endif
  46. #endif // __ESP_SIMPLE_UPDATER__