mirror of
https://github.com/IoTManagerProject/IoTManager.git
synced 2026-03-26 14:12:16 +03:00
Сделал сборку для esp32s2 (Wemos S2 mini)
This commit is contained in:
@@ -27,6 +27,10 @@
|
||||
#define FIRMWARE_NAME "esp32_4mb"
|
||||
#endif
|
||||
|
||||
#ifdef esp32s2_4mb
|
||||
#define FIRMWARE_NAME "esp32s2_4mb"
|
||||
#endif
|
||||
|
||||
//Размер буфера json
|
||||
#define JSON_BUFFER_SIZE 2048 //держим 2 кб не меняем
|
||||
#define WEB_SOCKETS_FRAME_SIZE 2048
|
||||
|
||||
@@ -174,6 +174,29 @@ build_src_filter =
|
||||
+<modules/*.cpp>
|
||||
${env:esp32_4mb_fromitems.build_src_filter}
|
||||
|
||||
[env:esp32s2_4mb]
|
||||
lib_deps =
|
||||
${common_env_data.lib_deps_external}
|
||||
${env:esp32s2_4mb_fromitems.lib_deps}
|
||||
build_flags =
|
||||
-Desp32s2_4mb="esp32s2_4mb"
|
||||
-DARDUINO_USB_CDC_ON_BOOT=1
|
||||
-DARDUINO_USB_MODE=0
|
||||
framework = arduino
|
||||
board = lolin_s2_mini
|
||||
platform = espressif32 @6.3.1
|
||||
monitor_filters = esp32_exception_decoder
|
||||
upload_speed = 921600
|
||||
monitor_speed = 115200
|
||||
debug_tool = esp-prog
|
||||
board_build.filesystem = littlefs
|
||||
build_src_filter =
|
||||
+<*.cpp>
|
||||
+<classes/*.cpp>
|
||||
+<utils/*.cpp>
|
||||
+<modules/*.cpp>
|
||||
${env:esp32s2_4mb_fromitems.build_src_filter}
|
||||
|
||||
[env:esp8266_1mb_ota_fromitems]
|
||||
lib_deps =
|
||||
adafruit/Adafruit BME280 Library
|
||||
@@ -471,3 +494,6 @@ build_src_filter =
|
||||
+<modules/exec/TelegramLT>
|
||||
+<modules/display/Lcd2004>
|
||||
|
||||
[env:esp32s2_4mb_fromitems]
|
||||
lib_deps =
|
||||
build_src_filter =
|
||||
|
||||
@@ -76,6 +76,7 @@ uint32_t ESP_getChipId(void) {
|
||||
#endif
|
||||
}
|
||||
|
||||
#ifndef esp32s2_4mb
|
||||
uint32_t ESP_getFlashChipId(void) {
|
||||
#ifdef ESP32
|
||||
// Нет аналогичной (без доп.кода) функций в 32
|
||||
@@ -85,6 +86,7 @@ uint32_t ESP_getFlashChipId(void) {
|
||||
return ESP.getFlashChipId();
|
||||
#endif
|
||||
}
|
||||
#endif
|
||||
|
||||
const String getMacAddress() {
|
||||
uint8_t mac[6];
|
||||
|
||||
15
src/Main.cpp
15
src/Main.cpp
@@ -3,6 +3,9 @@
|
||||
#include "classes/IoTDB.h"
|
||||
#include "utils/Statistic.h"
|
||||
#include <Wire.h>
|
||||
#ifdef esp32s2_4mb
|
||||
#include <USB.h>
|
||||
#endif
|
||||
|
||||
IoTScenario iotScen; // объект управления сценарием
|
||||
|
||||
@@ -66,14 +69,14 @@ void IRAM_ATTR onTimer(){
|
||||
#endif
|
||||
|
||||
void initErrorMarker(int id) {
|
||||
#ifdef esp32_4mb
|
||||
#ifdef esp32_4mb
|
||||
initErrorMarkerId = id;
|
||||
errorMarkerCounter = 0;
|
||||
#endif
|
||||
}
|
||||
|
||||
void stopErrorMarker(int id) {
|
||||
#ifdef esp32_4mb
|
||||
#ifdef esp32_4mb
|
||||
errorMarkerCounter = -1;
|
||||
if (errorMarkerId)
|
||||
SerialPrint("I", "WARNING!", "A lazy (freezing loop more than " + (String)(COUNTER_ERRORMARKER * STEPPER_ERRORMARKER / 1000) + " ms) section has been found! With ID=" + (String)errorMarkerId);
|
||||
@@ -85,8 +88,10 @@ void stopErrorMarker(int id) {
|
||||
|
||||
|
||||
void setup() {
|
||||
|
||||
#ifdef esp32_4mb
|
||||
#ifdef esp32s2_4mb
|
||||
USB.begin();
|
||||
#endif
|
||||
#ifdef esp32_4mb
|
||||
My_timer = timerBegin(0, 80, true);
|
||||
timerAttachInterrupt(My_timer, &onTimer, true);
|
||||
timerAlarmWrite(My_timer, STEPPER_ERRORMARKER, true);
|
||||
@@ -129,7 +134,7 @@ void setup() {
|
||||
jsonRead(settingsFlashJson, "i2cFreq", i2cFreq, false);
|
||||
jsonRead(settingsFlashJson, "i2c", i2c, false);
|
||||
if (i2c != 0) {
|
||||
#ifdef esp32_4mb
|
||||
#ifdef ESP32
|
||||
Wire.end();
|
||||
Wire.begin(pinSDA, pinSCL, (uint32_t)i2cFreq);
|
||||
#else
|
||||
|
||||
@@ -58,7 +58,50 @@ void printGlobalVarSize() {
|
||||
String ESP_getResetReason(void) {
|
||||
return ESP.getResetReason();
|
||||
}
|
||||
#else
|
||||
#endif
|
||||
#ifdef esp32s2_4mb
|
||||
String ESP_getResetReason(void) {
|
||||
return ESP32GetResetReason(0); // CPU 0
|
||||
}
|
||||
String ESP32GetResetReason(uint32_t cpu_no) {
|
||||
// tools\sdk\include\esp32\rom\rtc.h
|
||||
switch (rtc_get_reset_reason((RESET_REASON)cpu_no)) {
|
||||
case POWERON_RESET:
|
||||
return F("Vbat power on reset"); // 1
|
||||
case RTC_SW_SYS_RESET:
|
||||
return F("Software reset digital core"); // 3
|
||||
// case OWDT_RESET:
|
||||
// return F("Legacy Watchdog reset digital core"); // 4
|
||||
case DEEPSLEEP_RESET:
|
||||
return F("Deep Sleep reset digital core"); // 5
|
||||
// case SDIO_RESET:
|
||||
// return F("Reset by SLC module, reset digital core"); // 6
|
||||
case TG0WDT_SYS_RESET:
|
||||
return F("Timer Group0 Watchdog reset digital core"); // 7
|
||||
case TG1WDT_SYS_RESET:
|
||||
return F("Timer Group1 Watchdog reset digital core"); // 8
|
||||
case RTCWDT_SYS_RESET:
|
||||
return F("RTC Watchdog Reset digital core"); // 9
|
||||
case INTRUSION_RESET:
|
||||
return F("Instrusion tested to reset CPU"); // 10
|
||||
case TG0WDT_CPU_RESET:
|
||||
return F("Time Group reset CPU"); // 11
|
||||
case RTC_SW_CPU_RESET:
|
||||
return F("Software reset CPU"); // 12
|
||||
case RTCWDT_CPU_RESET:
|
||||
return F("RTC Watchdog Reset CPU"); // 13
|
||||
// case EXT_CPU_RESET:
|
||||
// return F("or APP CPU, reseted by PRO CPU"); // 14
|
||||
case RTCWDT_BROWN_OUT_RESET:
|
||||
return F("Reset when the vdd voltage is not stable"); // 15
|
||||
case RTCWDT_RTC_RESET:
|
||||
return F("RTC Watchdog reset digital core and rtc module"); // 16
|
||||
default:
|
||||
return F("NO_MEAN"); // 0
|
||||
}
|
||||
}
|
||||
#endif
|
||||
#ifdef esp32_4mb
|
||||
String ESP_getResetReason(void) {
|
||||
return ESP32GetResetReason(0); // CPU 0
|
||||
}
|
||||
|
||||
@@ -76,7 +76,7 @@ bool upgradeBuild() {
|
||||
ESPhttpUpdate.rebootOnUpdate(false);
|
||||
t_httpUpdate_return retBuild = ESPhttpUpdate.update(wifiClient, getBinPath("firmware.bin"));
|
||||
#endif
|
||||
#ifdef esp32_4mb
|
||||
#ifdef ESP32
|
||||
httpUpdate.rebootOnUpdate(false);
|
||||
HTTPUpdateResult retBuild = httpUpdate.update(wifiClient, getBinPath("firmware.bin"));
|
||||
#endif
|
||||
|
||||
@@ -41,6 +41,7 @@
|
||||
"defActive": true,
|
||||
"usedLibs": {
|
||||
"esp32_4mb": [],
|
||||
"esp32s2_4mb": [],
|
||||
"esp8266_4mb": [],
|
||||
"esp8266_1mb": [],
|
||||
"esp8266_1mb_ota": [],
|
||||
|
||||
@@ -88,6 +88,9 @@
|
||||
"esp32_4mb": [
|
||||
"https://github.com/adafruit/Adafruit_INA219.git"
|
||||
],
|
||||
"esp32s2_4mb": [
|
||||
"https://github.com/adafruit/Adafruit_INA219.git"
|
||||
],
|
||||
|
||||
"esp8266_4mb": [
|
||||
"https://github.com/adafruit/Adafruit_INA219.git"
|
||||
|
||||
@@ -40,6 +40,7 @@
|
||||
"defActive": false,
|
||||
"usedLibs": {
|
||||
"esp32_4mb": [],
|
||||
"esp32s2_4mb": [],
|
||||
"esp8266_4mb": [],
|
||||
"esp8266_1mb": [],
|
||||
"esp8266_1mb_ota": [],
|
||||
|
||||
Reference in New Issue
Block a user