mirror of
https://github.com/IoTManagerProject/IoTManager.git
synced 2026-03-26 22:22:16 +03:00
Merge pull request #48 from IoTManagerProject/beta
Fixed bug with little fs system in platformio ini
This commit is contained in:
@@ -3,8 +3,8 @@
|
||||
"chipID": "",
|
||||
"apssid": "IoTmanager",
|
||||
"appass": "",
|
||||
"routerssid": "VOLODYA",
|
||||
"routerpass": "BELCHENKO",
|
||||
"routerssid": "rise",
|
||||
"routerpass": "hostel3333",
|
||||
"timezone": 2,
|
||||
"ntp": "pool.ntp.org",
|
||||
"mqttServer": "91.204.228.124",
|
||||
|
||||
@@ -12,34 +12,31 @@
|
||||
default_envs = esp8266
|
||||
|
||||
[common_env_data]
|
||||
lib_deps_external =
|
||||
ModuleInterface@3.5.1
|
||||
lib_deps_external =
|
||||
ArduinoJson@5.*
|
||||
Bounce2
|
||||
PubSubClient
|
||||
DallasTemperature
|
||||
DHT sensor library for ESPx
|
||||
Adafruit BMP280 Library
|
||||
Adafruit BME280 Library
|
||||
lib_deps_internal =
|
||||
lib_deps_internal =
|
||||
ESP Async WebServer
|
||||
TickerScheduler
|
||||
ESP8266-StringCommand
|
||||
GyverFilters
|
||||
OneWire
|
||||
|
||||
[env:esp32]
|
||||
framework = arduino
|
||||
board = esp32dev
|
||||
board_build.filesystem = littlefs
|
||||
platform = https://github.com/platformio/platform-espressif32.git
|
||||
lib_deps =
|
||||
${common_env_data.lib_deps_external}
|
||||
${common_env_data.lib_deps_internal}
|
||||
AsyncTCP
|
||||
ESP32Servo
|
||||
LITTLEFS
|
||||
#board_build.partitions = partitions_custom.csv
|
||||
LITTLEFS
|
||||
monitor_filters = esp32_exception_decoder
|
||||
monitor_speed = 115200
|
||||
extra_scripts = ./tools/littlefsbuilder.py
|
||||
|
||||
[env:esp8266_01_1m]
|
||||
framework = arduino
|
||||
@@ -50,8 +47,11 @@ lib_deps =
|
||||
${common_env_data.lib_deps_external}
|
||||
${common_env_data.lib_deps_internal}
|
||||
ESPAsyncTCP
|
||||
ESPAsyncUDP
|
||||
EspSoftwareSerial
|
||||
monitor_filters = esp8266_exception_decoder
|
||||
monitor_speed = 115200
|
||||
board_build.filesystem = littlefs
|
||||
|
||||
[env:esp8266]
|
||||
framework = arduino
|
||||
@@ -61,7 +61,18 @@ lib_deps =
|
||||
${common_env_data.lib_deps_external}
|
||||
${common_env_data.lib_deps_internal}
|
||||
ESPAsyncTCP
|
||||
ESPAsyncUDP
|
||||
EspSoftwareSerial
|
||||
monitor_filters = esp8266_exception_decoder
|
||||
monitor_speed = 115200
|
||||
board_build.filesystem = littlefs
|
||||
board_build.f_cpu = 160000000L
|
||||
|
||||
|
||||
; build_type = debug
|
||||
; build_flags =
|
||||
; -DDEBUG_ESP_CORE
|
||||
; -DDEBUG_ESP_WIFI
|
||||
; -DDEBUG_ESP_HTTP_UPDATE
|
||||
; -DDEBUG_ESP_UPDATER
|
||||
; -DDEBUG_ESP_OTA
|
||||
; -DDEBUG_ESP_OOM
|
||||
|
||||
@@ -1,52 +0,0 @@
|
||||
#include "Global.h"
|
||||
|
||||
class CaptiveRequestHandler : public AsyncWebHandler {
|
||||
public:
|
||||
CaptiveRequestHandler(const char *host);
|
||||
|
||||
virtual ~CaptiveRequestHandler();
|
||||
|
||||
bool canHandle(AsyncWebServerRequest *request) override;
|
||||
|
||||
void handleRequest(AsyncWebServerRequest *request) override;
|
||||
|
||||
private:
|
||||
bool isLocalIp(String name);
|
||||
bool isLocalName(String name);
|
||||
|
||||
private:
|
||||
char _local_name[32];
|
||||
IPAddress _local_ip;
|
||||
};
|
||||
|
||||
CaptiveRequestHandler::CaptiveRequestHandler(const char *host) {
|
||||
strlcpy(_local_name, host, sizeof(_local_name));
|
||||
strcat(_local_name, ".local");
|
||||
}
|
||||
|
||||
CaptiveRequestHandler::~CaptiveRequestHandler() {
|
||||
}
|
||||
|
||||
bool CaptiveRequestHandler::isLocalIp(String address) {
|
||||
IPAddress ip;
|
||||
return !ip.fromString(address) || (ip != _local_ip);
|
||||
}
|
||||
|
||||
bool CaptiveRequestHandler::isLocalName(String host_name) {
|
||||
return host_name.equalsIgnoreCase(_local_name);
|
||||
}
|
||||
|
||||
bool CaptiveRequestHandler::canHandle(AsyncWebServerRequest *request) {
|
||||
_local_ip = request->client()->localIP();
|
||||
|
||||
return !isLocalIp(request->getHeader("HOST")->value()) && !isLocalName(request->getHeader("HOST")->value());
|
||||
}
|
||||
|
||||
void CaptiveRequestHandler::CaptiveRequestHandler::handleRequest(AsyncWebServerRequest *request) {
|
||||
char buf[64];
|
||||
sprintf(buf, "http://%s%s", _local_name, request->url().c_str());
|
||||
auto response = request->beginResponse(302, "text/html");
|
||||
response->addHeader("Location", buf);
|
||||
response->addHeader("Connection", "close");
|
||||
request->send(response);
|
||||
};
|
||||
Reference in New Issue
Block a user