ESP32 / ESP8266 & BME280 / SHT2x sensor with InfluxDB support
Vous ne pouvez pas sélectionner plus de 25 sujets Les noms de sujets doivent commencer par une lettre ou un nombre, peuvent contenir des tirets ('-') et peuvent comporter jusqu'à 35 caractères.

SimpleUpdater.h 1.3KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455
  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. void run(void);
  29. private:
  30. #if defined(ARDUINO_ARCH_ESP8266)
  31. ESP8266HTTPUpdateServer updateServer;
  32. #elif defined(ARDUINO_ARCH_ESP32)
  33. void get(void);
  34. void postResult(void);
  35. void postUpload(void);
  36. #endif
  37. String uri;
  38. UPDATE_WEB_SERVER *server;
  39. };
  40. #endif
  41. #endif // __ESP_SIMPLE_UPDATER__