mirror of
https://github.com/IoTManagerProject/IoTManager.git
synced 2026-03-30 11:59:12 +03:00
esp32 compiling version
This commit is contained in:
@@ -46,11 +46,15 @@
|
|||||||
|
|
||||||
#define BME_ENABLED
|
#define BME_ENABLED
|
||||||
|
|
||||||
|
//#define FSEditor
|
||||||
|
|
||||||
|
//#define SSDP
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Gears
|
* Gears
|
||||||
*/
|
*/
|
||||||
#define STEPPER_ENABLED
|
#define STEPPER_ENABLED
|
||||||
#define SERVO_ENABLED
|
//#define SERVO_ENABLED
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Other
|
* Other
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
#pragma once
|
#pragma once
|
||||||
|
#ifdef FSEditor
|
||||||
#include <ESPAsyncWebServer.h>
|
#include <ESPAsyncWebServer.h>
|
||||||
#include <FS.h>
|
#include <FS.h>
|
||||||
|
|
||||||
@@ -26,3 +26,4 @@ class FSEditor : public AsyncWebHandler {
|
|||||||
virtual void handleUpload(AsyncWebServerRequest* request, const String& filename, size_t index, uint8_t* data, size_t len, bool final) override final;
|
virtual void handleUpload(AsyncWebServerRequest* request, const String& filename, size_t index, uint8_t* data, size_t len, bool final) override final;
|
||||||
virtual bool isRequestHandlerTrivial() override final { return false; }
|
virtual bool isRequestHandlerTrivial() override final { return false; }
|
||||||
};
|
};
|
||||||
|
#endif
|
||||||
@@ -1,6 +1,8 @@
|
|||||||
#pragma once
|
#pragma once
|
||||||
|
#ifdef SSDP
|
||||||
#include <Arduino.h>
|
#include <Arduino.h>
|
||||||
|
|
||||||
extern void SsdpInit();
|
extern void SsdpInit();
|
||||||
extern String xmlNode(String tags, String data);
|
extern String xmlNode(String tags, String data);
|
||||||
extern String decToHex(uint32_t decValue, byte desiredStringLength);
|
extern String decToHex(uint32_t decValue, byte desiredStringLength);
|
||||||
|
#endif
|
||||||
@@ -1,6 +1,8 @@
|
|||||||
#pragma once
|
#pragma once
|
||||||
|
#ifdef SERVO_ENABLED
|
||||||
|
|
||||||
#include <Arduino.h>
|
#include <Arduino.h>
|
||||||
|
#include <ESP32Servo.h>
|
||||||
#include <Servo.h>
|
#include <Servo.h>
|
||||||
|
|
||||||
struct Servo_t {
|
struct Servo_t {
|
||||||
@@ -23,3 +25,5 @@ class Servos {
|
|||||||
};
|
};
|
||||||
|
|
||||||
extern Servos myServo;
|
extern Servos myServo;
|
||||||
|
|
||||||
|
#endif
|
||||||
@@ -9,7 +9,7 @@
|
|||||||
; https://docs.platformio.org/page/projectconf.html
|
; https://docs.platformio.org/page/projectconf.html
|
||||||
|
|
||||||
[platformio]
|
[platformio]
|
||||||
default_envs = esp32
|
default_envs = esp8266
|
||||||
|
|
||||||
[common_env_data]
|
[common_env_data]
|
||||||
lib_deps_external =
|
lib_deps_external =
|
||||||
@@ -25,21 +25,6 @@ lib_deps_internal =
|
|||||||
GyverFilters
|
GyverFilters
|
||||||
OneWire
|
OneWire
|
||||||
|
|
||||||
[env:esp32]
|
|
||||||
framework = arduino
|
|
||||||
board = esp32dev
|
|
||||||
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
|
|
||||||
monitor_filters = esp32_exception_decoder
|
|
||||||
upload_speed = 921600
|
|
||||||
monitor_speed = 115200
|
|
||||||
board_build.filesystem = littlefs
|
|
||||||
|
|
||||||
[env:esp8266_01_1m]
|
[env:esp8266_01_1m]
|
||||||
framework = arduino
|
framework = arduino
|
||||||
board = esp01_1m
|
board = esp01_1m
|
||||||
@@ -73,6 +58,23 @@ monitor_speed = 115200
|
|||||||
board_build.filesystem = littlefs
|
board_build.filesystem = littlefs
|
||||||
board_build.f_cpu = 160000000L
|
board_build.f_cpu = 160000000L
|
||||||
|
|
||||||
|
[env:esp32]
|
||||||
|
framework = arduino
|
||||||
|
board = esp32dev
|
||||||
|
platform = https://github.com/platformio/platform-espressif32.git
|
||||||
|
build_flags = ${env.build_flags} -D=${PIOENV}
|
||||||
|
extra_scripts = ./tools/littlefsbuilder.py
|
||||||
|
lib_deps =
|
||||||
|
${common_env_data.lib_deps_external}
|
||||||
|
${common_env_data.lib_deps_internal}
|
||||||
|
AsyncTCP
|
||||||
|
ESP32Servo
|
||||||
|
LITTLEFS
|
||||||
|
monitor_filters = esp32_exception_decoder
|
||||||
|
upload_speed = 921600
|
||||||
|
monitor_speed = 115200
|
||||||
|
board_build.filesystem = littlefs
|
||||||
|
|
||||||
; build_type = debug
|
; build_type = debug
|
||||||
; build_flags =
|
; build_flags =
|
||||||
; -DDEBUG_ESP_CORE
|
; -DDEBUG_ESP_CORE
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
|
#ifdef FSEditor
|
||||||
#include "FSEditor.h"
|
#include "FSEditor.h"
|
||||||
|
|
||||||
#ifdef ESP32
|
#ifdef ESP32
|
||||||
#include "LITTLEFS.h"
|
#include "LITTLEFS.h"
|
||||||
#define LittleFS LITTLEFS
|
#define LittleFS LITTLEFS
|
||||||
@@ -324,3 +324,4 @@ void FSEditor::handleUpload(AsyncWebServerRequest *request, const String &filena
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
@@ -1,3 +1,4 @@
|
|||||||
|
#ifdef SSDP
|
||||||
#ifdef ESP8266
|
#ifdef ESP8266
|
||||||
#include <ESP8266SSDP.h>
|
#include <ESP8266SSDP.h>
|
||||||
#endif
|
#endif
|
||||||
@@ -53,3 +54,4 @@ String decToHex(uint32_t decValue, byte desiredStringLength) {
|
|||||||
while (hexString.length() < desiredStringLength) hexString = "0" + hexString;
|
while (hexString.length() < desiredStringLength) hexString = "0" + hexString;
|
||||||
return hexString;
|
return hexString;
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
@@ -1,5 +1,5 @@
|
|||||||
|
#ifdef SERVO_ENABLED
|
||||||
#include "Servo/Servos.h"
|
#include "Servo/Servos.h"
|
||||||
|
|
||||||
Servos myServo;
|
Servos myServo;
|
||||||
|
|
||||||
Servos::Servos(){};
|
Servos::Servos(){};
|
||||||
@@ -38,3 +38,4 @@ Servo *Servos::get(uint8_t num) {
|
|||||||
size_t Servos::count() {
|
size_t Servos::count() {
|
||||||
return _items.size();
|
return _items.size();
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|||||||
@@ -59,7 +59,7 @@ void upgrade_firmware() {
|
|||||||
t_httpUpdate_return ret = ESPhttpUpdate.updateSpiffs(wifiClient, "http://91.204.228.124:1100/update/esp8266/esp32-esp8266_iot-manager_modules_firmware.spiffs.bin");
|
t_httpUpdate_return ret = ESPhttpUpdate.updateSpiffs(wifiClient, "http://91.204.228.124:1100/update/esp8266/esp32-esp8266_iot-manager_modules_firmware.spiffs.bin");
|
||||||
#else
|
#else
|
||||||
httpUpdate.rebootOnUpdate(false);
|
httpUpdate.rebootOnUpdate(false);
|
||||||
t_httpUpdate_return ret = httpUpdate.updateSpiffs(client_for_upgrade, "http://91.204.228.124:1100/update/esp32/esp32-esp8266_iot-manager_modules_firmware.spiffs.bin");
|
t_httpUpdate_return ret = httpUpdate.updateSpiffs(wifiClient, "http://91.204.228.124:1100/update/esp32/esp32-esp8266_iot-manager_modules_firmware.spiffs.bin");
|
||||||
#endif
|
#endif
|
||||||
if (ret == HTTP_UPDATE_OK) {
|
if (ret == HTTP_UPDATE_OK) {
|
||||||
writeFile(String(DEVICE_SCENARIO_FILE), scanerioBackup);
|
writeFile(String(DEVICE_SCENARIO_FILE), scanerioBackup);
|
||||||
@@ -78,7 +78,7 @@ void upgrade_firmware() {
|
|||||||
#ifdef ESP8266
|
#ifdef ESP8266
|
||||||
ret = ESPhttpUpdate.update(wifiClient, "http://91.204.228.124:1100/update/esp8266/esp32-esp8266_iot-manager_modules_firmware.ino.bin");
|
ret = ESPhttpUpdate.update(wifiClient, "http://91.204.228.124:1100/update/esp8266/esp32-esp8266_iot-manager_modules_firmware.ino.bin");
|
||||||
#else
|
#else
|
||||||
ret = httpUpdate.update(client_for_upgrade, "http://91.204.228.124:1100/update/esp32/esp32-esp8266_iot-manager_modules_firmware.ino.bin");
|
ret = httpUpdate.update(wifiClient, "http://91.204.228.124:1100/update/esp32/esp32-esp8266_iot-manager_modules_firmware.ino.bin");
|
||||||
#endif
|
#endif
|
||||||
if (ret == HTTP_UPDATE_OK) {
|
if (ret == HTTP_UPDATE_OK) {
|
||||||
pm.info("done! restart...");
|
pm.info("done! restart...");
|
||||||
|
|||||||
@@ -20,7 +20,7 @@ void startSTAMode() {
|
|||||||
|
|
||||||
bool keepConnecting = true;
|
bool keepConnecting = true;
|
||||||
uint8_t tries = 20;
|
uint8_t tries = 20;
|
||||||
sint8_t connRes;
|
int8_t connRes;
|
||||||
do {
|
do {
|
||||||
#ifdef ESP8266
|
#ifdef ESP8266
|
||||||
connRes = WiFi.waitForConnectResult(1000);
|
connRes = WiFi.waitForConnectResult(1000);
|
||||||
|
|||||||
@@ -15,10 +15,12 @@ void initWS();
|
|||||||
void init() {
|
void init() {
|
||||||
String login = jsonReadStr(configSetupJson, "weblogin");
|
String login = jsonReadStr(configSetupJson, "weblogin");
|
||||||
String pass = jsonReadStr(configSetupJson, "webpass");
|
String pass = jsonReadStr(configSetupJson, "webpass");
|
||||||
|
#ifdef FSEditor
|
||||||
#ifdef ESP32
|
#ifdef ESP32
|
||||||
server.addHandler(new FSEditor(LittleFS, login, pass));
|
server.addHandler(new FSEditor(LittleFS, login, pass));
|
||||||
#else
|
#else
|
||||||
server.addHandler(new FSEditor(login, pass));
|
server.addHandler(new FSEditor(login, pass));
|
||||||
|
#endif
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
server.serveStatic("/css/", LittleFS, "/css/").setCacheControl("max-age=600");
|
server.serveStatic("/css/", LittleFS, "/css/").setCacheControl("max-age=600");
|
||||||
|
|||||||
@@ -1,5 +1,6 @@
|
|||||||
|
|
||||||
#include <SSDP.h>
|
#include <SSDP.h>
|
||||||
|
|
||||||
#include "Class/CallBackTest.h"
|
#include "Class/CallBackTest.h"
|
||||||
#include "Class/NotAsinc.h"
|
#include "Class/NotAsinc.h"
|
||||||
#include "Class/ScenarioClass.h"
|
#include "Class/ScenarioClass.h"
|
||||||
@@ -72,9 +73,10 @@ void setup() {
|
|||||||
pm.info("Broadcast UDP");
|
pm.info("Broadcast UDP");
|
||||||
udpInit();
|
udpInit();
|
||||||
#endif
|
#endif
|
||||||
|
#ifdef SSDP
|
||||||
pm.info("Ssdp Init");
|
pm.info("Ssdp Init");
|
||||||
SsdpInit();
|
SsdpInit();
|
||||||
|
#endif
|
||||||
|
|
||||||
ts.add(
|
ts.add(
|
||||||
TEST, 1000 * 60, [&](void*) {
|
TEST, 1000 * 60, [&](void*) {
|
||||||
|
|||||||
Reference in New Issue
Block a user