mirror of
https://github.com/IoTManagerProject/IoTManager.git
synced 2026-03-27 06:32:19 +03:00
esp32 compiling version
This commit is contained in:
@@ -46,11 +46,15 @@
|
||||
|
||||
#define BME_ENABLED
|
||||
|
||||
//#define FSEditor
|
||||
|
||||
//#define SSDP
|
||||
|
||||
/*
|
||||
* Gears
|
||||
*/
|
||||
#define STEPPER_ENABLED
|
||||
#define SERVO_ENABLED
|
||||
//#define SERVO_ENABLED
|
||||
|
||||
/*
|
||||
* Other
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
#pragma once
|
||||
|
||||
#ifdef FSEditor
|
||||
#include <ESPAsyncWebServer.h>
|
||||
#include <FS.h>
|
||||
|
||||
@@ -25,4 +25,5 @@ class FSEditor : public AsyncWebHandler {
|
||||
virtual void handleRequest(AsyncWebServerRequest* request) 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; }
|
||||
};
|
||||
};
|
||||
#endif
|
||||
@@ -1,6 +1,8 @@
|
||||
#pragma once
|
||||
#ifdef SSDP
|
||||
#include <Arduino.h>
|
||||
|
||||
extern void SsdpInit();
|
||||
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
|
||||
#ifdef SERVO_ENABLED
|
||||
|
||||
#include <Arduino.h>
|
||||
#include <ESP32Servo.h>
|
||||
#include <Servo.h>
|
||||
|
||||
struct Servo_t {
|
||||
@@ -22,4 +24,6 @@ class Servos {
|
||||
std::vector<Servo_t> _items;
|
||||
};
|
||||
|
||||
extern Servos myServo;
|
||||
extern Servos myServo;
|
||||
|
||||
#endif
|
||||
@@ -9,7 +9,7 @@
|
||||
; https://docs.platformio.org/page/projectconf.html
|
||||
|
||||
[platformio]
|
||||
default_envs = esp32
|
||||
default_envs = esp8266
|
||||
|
||||
[common_env_data]
|
||||
lib_deps_external =
|
||||
@@ -25,21 +25,6 @@ lib_deps_internal =
|
||||
GyverFilters
|
||||
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]
|
||||
framework = arduino
|
||||
board = esp01_1m
|
||||
@@ -73,6 +58,23 @@ monitor_speed = 115200
|
||||
board_build.filesystem = littlefs
|
||||
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_flags =
|
||||
; -DDEBUG_ESP_CORE
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
#ifdef FSEditor
|
||||
#include "FSEditor.h"
|
||||
|
||||
#ifdef ESP32
|
||||
#include "LITTLEFS.h"
|
||||
#define LittleFS LITTLEFS
|
||||
@@ -324,3 +324,4 @@ void FSEditor::handleUpload(AsyncWebServerRequest *request, const String &filena
|
||||
}
|
||||
}
|
||||
}
|
||||
#endif
|
||||
@@ -1,3 +1,4 @@
|
||||
#ifdef SSDP
|
||||
#ifdef ESP8266
|
||||
#include <ESP8266SSDP.h>
|
||||
#endif
|
||||
@@ -52,4 +53,5 @@ String decToHex(uint32_t decValue, byte desiredStringLength) {
|
||||
String hexString = String(decValue, HEX);
|
||||
while (hexString.length() < desiredStringLength) hexString = "0" + hexString;
|
||||
return hexString;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
@@ -1,5 +1,5 @@
|
||||
#ifdef SERVO_ENABLED
|
||||
#include "Servo/Servos.h"
|
||||
|
||||
Servos myServo;
|
||||
|
||||
Servos::Servos(){};
|
||||
@@ -38,3 +38,4 @@ Servo *Servos::get(uint8_t num) {
|
||||
size_t Servos::count() {
|
||||
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");
|
||||
#else
|
||||
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
|
||||
if (ret == HTTP_UPDATE_OK) {
|
||||
writeFile(String(DEVICE_SCENARIO_FILE), scanerioBackup);
|
||||
@@ -78,7 +78,7 @@ void upgrade_firmware() {
|
||||
#ifdef ESP8266
|
||||
ret = ESPhttpUpdate.update(wifiClient, "http://91.204.228.124:1100/update/esp8266/esp32-esp8266_iot-manager_modules_firmware.ino.bin");
|
||||
#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
|
||||
if (ret == HTTP_UPDATE_OK) {
|
||||
pm.info("done! restart...");
|
||||
|
||||
@@ -20,7 +20,7 @@ void startSTAMode() {
|
||||
|
||||
bool keepConnecting = true;
|
||||
uint8_t tries = 20;
|
||||
sint8_t connRes;
|
||||
int8_t connRes;
|
||||
do {
|
||||
#ifdef ESP8266
|
||||
connRes = WiFi.waitForConnectResult(1000);
|
||||
|
||||
@@ -15,10 +15,12 @@ void initWS();
|
||||
void init() {
|
||||
String login = jsonReadStr(configSetupJson, "weblogin");
|
||||
String pass = jsonReadStr(configSetupJson, "webpass");
|
||||
#ifdef FSEditor
|
||||
#ifdef ESP32
|
||||
server.addHandler(new FSEditor(LittleFS, login, pass));
|
||||
#else
|
||||
server.addHandler(new FSEditor(login, pass));
|
||||
#endif
|
||||
#endif
|
||||
|
||||
server.serveStatic("/css/", LittleFS, "/css/").setCacheControl("max-age=600");
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
|
||||
#include <SSDP.h>
|
||||
|
||||
#include "Class/CallBackTest.h"
|
||||
#include "Class/NotAsinc.h"
|
||||
#include "Class/ScenarioClass.h"
|
||||
@@ -72,9 +73,10 @@ void setup() {
|
||||
pm.info("Broadcast UDP");
|
||||
udpInit();
|
||||
#endif
|
||||
|
||||
#ifdef SSDP
|
||||
pm.info("Ssdp Init");
|
||||
SsdpInit();
|
||||
#endif
|
||||
|
||||
ts.add(
|
||||
TEST, 1000 * 60, [&](void*) {
|
||||
|
||||
Reference in New Issue
Block a user