DIY fertilizer mixer and plant watering machine https://www.xythobuz.de/giessomat.html
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.

SimpleUpdater.h 1.3KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354
  1. /*
  2. * SimpleUpdater.h
  3. *
  4. * ESP8266 / ESP32 Environmental Sensor
  5. *
  6. * ----------------------------------------------------------------------------
  7. * "THE BEER-WARE LICENSE" (Revision 42):
  8. * <xythobuz@xythobuz.de> wrote this file. As long as you retain this notice
  9. * you can do whatever you want with this stuff. If we meet some day, and you
  10. * think this stuff is worth it, you can buy me a beer in return. Thomas Buck
  11. * ----------------------------------------------------------------------------
  12. */
  13. #ifndef __ESP_SIMPLE_UPDATER__
  14. #define __ESP_SIMPLE_UPDATER__
  15. #if defined(ARDUINO_ARCH_ESP8266)
  16. #include <ESP8266WebServer.h>
  17. #include <ESP8266HTTPUpdateServer.h>
  18. #define UPDATE_WEB_SERVER ESP8266WebServer
  19. #elif defined(ARDUINO_ARCH_ESP32)
  20. #include <WebServer.h>
  21. #define UPDATE_WEB_SERVER WebServer
  22. #endif
  23. #if defined(ARDUINO_ARCH_ESP8266) || defined(ARDUINO_ARCH_ESP32)
  24. class SimpleUpdater {
  25. public:
  26. SimpleUpdater(String _uri = String("/update"));
  27. void setup(UPDATE_WEB_SERVER *_server);
  28. private:
  29. #if defined(ARDUINO_ARCH_ESP8266)
  30. ESP8266HTTPUpdateServer updateServer;
  31. #elif defined(ARDUINO_ARCH_ESP32)
  32. void get(void);
  33. void postResult(void);
  34. void postUpload(void);
  35. #endif
  36. String uri;
  37. UPDATE_WEB_SERVER *server;
  38. };
  39. #endif
  40. #endif // __ESP_SIMPLE_UPDATER__