Commit 8efb0a30 authored by Eric Duminil's avatar Eric Duminil
Browse files

Merge branch 'experimental/iotwebconfig' into develop

Current state seems to be stable enough for develop
parents 34496cfe 6ea33a0e
Pipeline #5893 passed with stage
in 2 minutes and 22 seconds
This diff is collapsed.
/**
* IotWebConfUsing.h -- IotWebConf is an ESP8266/ESP32
* non blocking WiFi/AP web configuration library for Arduino.
* https://github.com/prampec/IotWebConf
*
* Copyright (C) 2020 Balazs Kelemen <prampec+arduino@gmail.com>
*
* This software may be modified and distributed under the terms
* of the MIT license. See the LICENSE file for details.
*/
#ifndef IotWebConfUsing_h
#define IotWebConfUsing_h
// This "using" lines are just aliases, and should avoided.
using IotWebConfParameterGroup = iotwebconf::ParameterGroup;
using IotWebConfTextParameter = iotwebconf::TextParameter;
using IotWebConfPasswordParameter = iotwebconf::PasswordParameter;
using IotWebConfNumberParameter = iotwebconf::NumberParameter;
using IotWebConfCheckboxParameter = iotwebconf::CheckboxParameter;
using IotWebConfSelectParameter = iotwebconf::SelectParameter;
#endif
\ No newline at end of file
/**
* IotWebConfWebServerWrapper.h -- IotWebConf is an ESP8266/ESP32
* non blocking WiFi/AP web configuration library for Arduino.
* https://github.com/prampec/IotWebConf
*
* Copyright (C) 2020 Balazs Kelemen <prampec+arduino@gmail.com>
*
* This software may be modified and distributed under the terms
* of the MIT license. See the LICENSE file for details.
*/
#ifndef WebServerWrapper_h
#define WebServerWrapper_h
#include <Arduino.h>
#include <IPAddress.h>
namespace iotwebconf
{
class WebRequestWrapper
{
public:
virtual const String hostHeader() const;
virtual IPAddress localIP();
virtual uint16_t localPort();
virtual const String uri() const;
virtual bool authenticate(const char * username, const char * password);
virtual void requestAuthentication();
virtual bool hasArg(const String& name);
virtual String arg(const String name);
virtual void sendHeader(const String& name, const String& value, bool first = false);
virtual void setContentLength(const size_t contentLength);
virtual void send(int code, const char* content_type = nullptr, const String& content = String(""));
virtual void sendContent(const String& content);
virtual void stop();
};
class WebServerWrapper
{
public:
virtual void handleClient();
virtual void begin();
};
} // end namespace
#endif
\ No newline at end of file
#ifndef CustomAmpelIotWebConfSettings_h
#define CustomAmpelIotWebConfSettings_h
/***************************************/
/**** CUSTOM AMPEL CODE ****************/
// Disable DEBUG, in order to save some space, at least on ESP8266
#if defined(ESP8266)
#define IOTWEBCONF_DEBUG_DISABLED
#endif
#endif
\ No newline at end of file
......@@ -149,20 +149,6 @@ int NTPClient::getSeconds() const {
return (this->getEpochTime() % 60);
}
String NTPClient::getFormattedTime() const {
unsigned long rawTime = this->getEpochTime();
unsigned long hours = (rawTime % 86400L) / 3600;
String hoursStr = hours < 10 ? "0" + String(hours) : String(hours);
unsigned long minutes = (rawTime % 3600) / 60;
String minuteStr = minutes < 10 ? "0" + String(minutes) : String(minutes);
unsigned long seconds = rawTime % 60;
String secondStr = seconds < 10 ? "0" + String(seconds) : String(seconds);
return hoursStr + ":" + minuteStr + ":" + secondStr;
}
void NTPClient::end() {
this->_udp->stop();
......
......@@ -20,7 +20,7 @@ class NTPClient {
unsigned long _updateInterval = 60000; // In ms
unsigned long _currentEpoc = 0; // In s
unsigned long _currentEpoc = 0; // In ms
unsigned long _lastUpdate = 0; // In ms
byte _packetBuffer[NTP_PACKET_SIZE];
......@@ -97,11 +97,6 @@ class NTPClient {
*/
void setUpdateInterval(unsigned long updateInterval);
/**
* @return time formatted like `hh:mm:ss`
*/
String getFormattedTime() const;
/**
* @return time in seconds since Jan. 1, 1970
*/
......
......@@ -8,7 +8,7 @@
# define esp_get_heap_fragmentation() ESP.getHeapFragmentation()
#elif defined(ESP32)
# define esp_get_max_free_block_size() ESP.getMaxAllocHeap() //largest block of heap that can be allocated.
# define esp_get_heap_fragmentation() "?" // apparently not available for ESP32
# define esp_get_heap_fragmentation() -1 // apparently not available for ESP32
#endif
namespace util {
......@@ -26,7 +26,7 @@ class Ampel {
private:
static void showFreeSpace();
public:
const char *version = "v0.2.3-DEV"; // Update manually after significant changes.
const char *version = "webconf-DEV"; // Update manually after significant changes.
const char *board;
const char *sensorId;
const char *macAddress;
......
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
......@@ -2,7 +2,6 @@
#define WEB_SERVER_H_
namespace web_server {
void initialize();
void update();
void definePages();
}
#endif
This diff is collapsed.
......@@ -2,9 +2,11 @@
#define WIFI_UTIL_H_INCLUDED
namespace wifi {
extern char local_ip[];
void connect(const char *hostname);
extern char local_ip[16];
void defineCommands();
bool connected();
bool isAccessPoint();
void tryConnection();
}
#endif
This diff is collapsed.
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment