mirror of
https://github.com/IoTManagerProject/IoTManager.git
synced 2026-03-26 14:12:16 +03:00
прошивка работает и для esp32
This commit is contained in:
3
.vscode/settings.json
vendored
Normal file
3
.vscode/settings.json
vendored
Normal file
@@ -0,0 +1,3 @@
|
||||
{
|
||||
"C_Cpp.clang_format_sortIncludes": false
|
||||
}
|
||||
@@ -4,6 +4,14 @@
|
||||
|
||||
#define JSON_BUFFER_SIZE 4096
|
||||
|
||||
#ifdef esp8266_4mb
|
||||
#define USE_LITTLEFS true
|
||||
#endif
|
||||
|
||||
#ifdef esp32_4mb
|
||||
#define USE_LITTLEFS false
|
||||
#endif
|
||||
|
||||
//задачи таскера
|
||||
enum TimerTask_t { WIFI_SCAN,
|
||||
WIFI_MQTT_CONNECTION_CHECK,
|
||||
|
||||
@@ -1,13 +1,27 @@
|
||||
#pragma once
|
||||
|
||||
#include "Global.h"
|
||||
#include "LittleFS.h"
|
||||
|
||||
#ifdef ESP32
|
||||
#include <SPIFFS.h>
|
||||
extern FS* filesystem;
|
||||
#define FileFS SPIFFS
|
||||
#define FS_NAME "SPIFFS"
|
||||
#endif
|
||||
|
||||
#ifdef ESP8266
|
||||
#if USE_LITTLEFS
|
||||
#include "LittleFS.h"
|
||||
extern FS LittleFS;
|
||||
using littlefs_impl::LittleFSConfig;
|
||||
extern FS* filesystem;
|
||||
#define FileFS LittleFS
|
||||
#define FS_NAME "LittleFS"
|
||||
#else
|
||||
extern FS* filesystem;
|
||||
#define FileFS SPIFFS
|
||||
#define FS_NAME "SPIFFS"
|
||||
#endif
|
||||
#endif
|
||||
|
||||
extern bool fileSystemInit();
|
||||
extern void globalVarsSync();
|
||||
|
||||
@@ -3,10 +3,20 @@
|
||||
//внешние глобальные директории
|
||||
#include <Arduino.h>
|
||||
#include <ArduinoJson.h>
|
||||
#include <TickerScheduler.h>
|
||||
|
||||
#ifdef ESP32
|
||||
#include <WiFi.h>
|
||||
#include <HTTPClient.h>
|
||||
#include <HTTPUpdate.h>
|
||||
#endif
|
||||
|
||||
#ifdef ESP8266
|
||||
#include <ESP8266httpUpdate.h>
|
||||
#endif
|
||||
|
||||
#include <ESPAsyncWebServer.h>
|
||||
#include <FS.h>
|
||||
#include <TickerScheduler.h>
|
||||
|
||||
//внутренние глобальные директории проекта
|
||||
#include "Const.h"
|
||||
|
||||
@@ -18,6 +18,9 @@ lib_deps_external =
|
||||
bblanchon/ArduinoJson @6.18.0
|
||||
me-no-dev/ESP Async WebServer
|
||||
|
||||
;lib_deps_internal =
|
||||
|
||||
|
||||
[env:esp8266_4mb]
|
||||
build_flags = -Desp8266_4mb="esp8266_4mb"
|
||||
framework = arduino
|
||||
@@ -29,4 +32,15 @@ lib_deps =
|
||||
monitor_filters = esp8266_exception_decoder
|
||||
upload_speed = 921600
|
||||
monitor_speed = 115200
|
||||
board_build.filesystem = littlefs
|
||||
board_build.filesystem = littlefs
|
||||
|
||||
[env:esp32_4mb]
|
||||
build_flags = -Desp32_4mb="esp32_4mb"
|
||||
framework = arduino
|
||||
board = esp32dev
|
||||
platform = espressif32 @3.3.0
|
||||
lib_deps =
|
||||
${common_env_data.lib_deps_external}
|
||||
monitor_filters = esp32_exception_decoder
|
||||
upload_speed = 921600
|
||||
monitor_speed = 115200
|
||||
@@ -10,14 +10,14 @@ bool fileSystemInit() {
|
||||
}
|
||||
|
||||
void globalVarsSync() {
|
||||
settingsFlashJson = readFile("settings.json", 4096);
|
||||
settingsFlashJson = readFile(F("settings.json"), 4096);
|
||||
settingsFlashJson.replace("\r\n", "");
|
||||
}
|
||||
|
||||
void saveSettingsFlashJson() {
|
||||
writeFile(String("config.json"), settingsFlashJson);
|
||||
writeFile(F("settings.json"), settingsFlashJson);
|
||||
}
|
||||
|
||||
void saveParamsFlashJson() {
|
||||
writeFile(String("store.json"), paramsFlashJson);
|
||||
writeFile(F("params.json"), paramsFlashJson);
|
||||
}
|
||||
@@ -5,6 +5,6 @@ TickerScheduler ts(MYTEST + 1);
|
||||
AsyncWebServer server(80);
|
||||
|
||||
//глобальные переменные
|
||||
String settingsFlashJson = "{}"; //переменная в которой хранятся все настройки, находится в оперативной памяти только и синхронизированна с flash памятью
|
||||
String paramsFlashJson = "{}"; //переменная в которой хранятся все параметры, находится в оперативной памяти только и синхронизированна с flash памятью
|
||||
String settingsFlashJson = "{}"; //переменная в которой хранятся все настройки, находится в оперативной памяти и синхронизированна с flash памятью
|
||||
String paramsFlashJson = "{}"; //переменная в которой хранятся все параметры, находится в оперативной памяти и синхронизированна с flash памятью
|
||||
String paramsHeapJson = "{}"; //переменная в которой хранятся все параметры, находится в оперативной памяти только
|
||||
Reference in New Issue
Block a user