Меняем способ исключения модулей из компиляции. Exclude = true в platformio.ini папки модуля см. пример модуля Mp3

This commit is contained in:
2022-05-18 15:12:20 +03:00
parent 8f0b50a6f3
commit 0aab5dcbed
5 changed files with 82 additions and 269 deletions

View File

@@ -12,16 +12,28 @@ allMenuItemsCount = 1
allAPI_head = ""
allAPI_exec = ""
excludeDirs = ""
def getDirs(path):
global excludeDirs
for file in os.listdir(path):
if os.path.isdir(os.path.join(path, file)) and not("--" in file):
yield file
maybeDir = os.path.join(path, file)
if os.path.isdir(maybeDir):
config.clear()
if config.read(maybeDir + "/platformio.ini"):
if config.getboolean("iotm", "exclude", fallback=False):
print("Excluded: " + maybeDir)
maybeDir = maybeDir.replace("src/", "")
excludeDirs = excludeDirs + "\n-<" + maybeDir + ">"
else:
yield file
def getPIOLibs(patch):
global allLibs_esp8266_4mb, allLibs_esp32_4mb
for dir in getDirs(patch):
config.clear()
if (config.read(patch + dir + "/platformio.ini")):
print(patch + dir + "/platformio.ini")
allLibs_esp8266_4mb = allLibs_esp8266_4mb + config["env:esp8266_4mb"]["lib_deps"]
@@ -58,12 +70,14 @@ getPIOLibs("src/modules/system/")
getPIOLibs("src/modules/exec/")
getPIOLibs("src/modules/sensors/")
getPIOLibs("src/modules/lcd/")
# сохраняем собранные либы в настройках PIO
config.clear()
config.read("platformio.ini")
config["env:esp8266_4mb_fromitems"]["lib_deps"] = allLibs_esp8266_4mb
config["env:esp32_4mb_fromitems"]["lib_deps"] = allLibs_esp32_4mb
config["env:esp8266_4mb_fromitems"]["src_filter"] = excludeDirs
config["env:esp32_4mb_fromitems"]["src_filter"] = excludeDirs
with open("platformio.ini", 'w') as configfile:
config.write(configfile)

View File

@@ -7,26 +7,9 @@
"header": "Расширения"
},
{
"name": "1. Поддержка DS1302(1), DS1307(2), DS3231(3), RX8025(4)",
"name": "1. Расширитель портов Mcp23017",
"num": 1,
"type": "Reading",
"subtype": "IarduinoRTC",
"id": "RTC",
"widget": "",
"page": "",
"descr": "",
"int": "1",
"chipNum": 1,
"rst": 16,
"clk": 5,
"dat": 4,
"defFormat": "d-m-Y",
"ticker": 0
},
{
"name": "2. Расширитель портов Mcp23017",
"num": 2,
"type": "Reading",
"subtype": "Mcp23017",
"id": "Mcp",
"widget": "",
@@ -36,64 +19,12 @@
"addr": "0x20",
"index": 1
},
{
"name": "3. Доп. функции системы",
"num": 3,
"type": "Reading",
"subtype": "SysExt",
"id": "SysExt",
"widget": "",
"page": "",
"descr": "",
"int": 15
},
{
"name": "4. Переменная",
"num": 4,
"type": "Reading",
"subtype": "Variable",
"id": "var",
"widget": "",
"page": "",
"descr": "",
"int": "0",
"val": "0"
},
{
"header": "Модули управления"
},
{
"name": "5. Кнопка (подключенная физически)",
"num": 5,
"type": "Writing",
"subtype": "ButtonIn",
"id": "btn",
"widget": "toggle",
"page": "Кнопки",
"descr": "",
"int": 0,
"pin": 16,
"execLevel": "1",
"pinMode": "INPUT",
"debounceDelay": 50,
"fixState": 1
},
{
"name": "6. Кнопка управляющая пином (Реле с кнопкой)",
"num": 6,
"type": "Writing",
"subtype": "ButtonOut",
"id": "btn",
"widget": "toggle",
"page": "Кнопки",
"descr": "",
"int": 0,
"inv": 0,
"pin": 2
},
{
"name": "7. MP3 плеер",
"num": 7,
"name": "2. MP3 плеер",
"num": 2,
"type": "Reading",
"subtype": "Mp3",
"id": "mp3",
@@ -105,8 +36,8 @@
"volume": 20
},
{
"name": "8. Телеграм-Бот",
"num": 8,
"name": "3. Телеграм-Бот",
"num": 3,
"type": "Writing",
"subtype": "Telegram",
"id": "tg",
@@ -119,27 +50,12 @@
"receiveMsg": 0,
"chatID": ""
},
{
"name": "9. Таймер",
"num": 9,
"type": "Writing",
"subtype": "Timer",
"id": "timer",
"widget": "",
"page": "",
"descr": "",
"int": 1,
"countDown": 15,
"ticker": 0,
"repeat": 0,
"needSave": 0
},
{
"header": "Сенсоры"
},
{
"name": "10. Датчик напряжения ADS1115",
"num": 10,
"name": "4. Датчик напряжения ADS1115",
"num": 4,
"type": "Reading",
"subtype": "Ads1115",
"id": "Ads3",
@@ -155,8 +71,8 @@
"int": 10
},
{
"name": "11. Cенсор температуры AHT20",
"num": 11,
"name": "5. Cенсор температуры AHT20",
"num": 5,
"type": "Reading",
"subtype": "Aht20t",
"id": "Temp20",
@@ -168,8 +84,8 @@
"round": 1
},
{
"name": "12. Cенсор влажности AHT20",
"num": 12,
"name": "6. Cенсор влажности AHT20",
"num": 6,
"type": "Reading",
"subtype": "Aht20h",
"id": "Hum20",
@@ -181,24 +97,8 @@
"round": 1
},
{
"name": "13. Аналоговый сенсор",
"num": 13,
"type": "Reading",
"subtype": "AnalogAdc",
"id": "t",
"widget": "anydataTmp",
"page": "Сенсоры",
"descr": "Температура",
"map": "1,1024,1,100",
"plus": 0,
"multiply": 1,
"round": 1,
"pin": 0,
"int": 15
},
{
"name": "14. Cенсор температуры Bme280",
"num": 14,
"name": "7. Cенсор температуры Bme280",
"num": 7,
"type": "Reading",
"subtype": "Bme280t",
"id": "tmp3",
@@ -210,8 +110,8 @@
"round": 1
},
{
"name": "15. Cенсор давления Bme280",
"num": 15,
"name": "8. Cенсор давления Bme280",
"num": 8,
"type": "Reading",
"subtype": "Bme280p",
"id": "Press3",
@@ -223,8 +123,8 @@
"round": 1
},
{
"name": "16. Cенсор влажности Bme280",
"num": 16,
"name": "9. Cенсор влажности Bme280",
"num": 9,
"type": "Reading",
"subtype": "Bme280h",
"id": "Hum3",
@@ -236,8 +136,8 @@
"round": 1
},
{
"name": "17. Cенсор температуры Bmp280",
"num": 17,
"name": "10. Cенсор температуры Bmp280",
"num": 10,
"type": "Reading",
"subtype": "Bmp280t",
"id": "tmp3",
@@ -249,8 +149,8 @@
"round": 1
},
{
"name": "18. Cенсор давления Bmp280",
"num": 18,
"name": "11. Cенсор давления Bmp280",
"num": 11,
"type": "Reading",
"subtype": "Bmp280p",
"id": "Press3",
@@ -262,8 +162,8 @@
"round": 1
},
{
"name": "19. Cенсор температуры dht11",
"num": 19,
"name": "12. Cенсор температуры dht11",
"num": 12,
"type": "Reading",
"subtype": "Dht1122t",
"id": "tmp3",
@@ -275,8 +175,8 @@
"senstype": "dht11"
},
{
"name": "20. Cенсор влажности dht11",
"num": 20,
"name": "13. Cенсор влажности dht11",
"num": 13,
"type": "Reading",
"subtype": "Dht1122h",
"id": "Hum3",
@@ -288,8 +188,8 @@
"senstype": "dht11"
},
{
"name": "21. Cенсор температуры ds18b20",
"num": 21,
"name": "14. Cенсор температуры ds18b20",
"num": 14,
"type": "Reading",
"subtype": "Ds18b20",
"id": "dstmp",
@@ -303,8 +203,8 @@
"round": 1
},
{
"name": "22. Cенсор температуры GY21",
"num": 22,
"name": "15. Cенсор температуры GY21",
"num": 15,
"type": "Reading",
"subtype": "GY21t",
"id": "tmp4",
@@ -315,8 +215,8 @@
"int": 15
},
{
"name": "23. Cенсор влажности GY21",
"num": 23,
"name": "16. Cенсор влажности GY21",
"num": 16,
"type": "Reading",
"subtype": "GY21h",
"id": "Hum4",
@@ -327,8 +227,8 @@
"int": 15
},
{
"name": "24. Cенсор температуры HDC1080",
"num": 24,
"name": "17. Cенсор температуры HDC1080",
"num": 17,
"type": "Reading",
"subtype": "Hdc1080t",
"id": "Temp1080",
@@ -340,8 +240,8 @@
"round": 1
},
{
"name": "25. Cенсор влажности HDC1080",
"num": 25,
"name": "18. Cенсор влажности HDC1080",
"num": 18,
"type": "Reading",
"subtype": "Hdc1080h",
"id": "Hum1080",
@@ -353,8 +253,8 @@
"round": 1
},
{
"name": "26. Cенсор температуры MAX6675",
"num": 26,
"name": "19. Cенсор температуры MAX6675",
"num": 19,
"type": "Reading",
"subtype": "Max6675t",
"id": "maxtmp",
@@ -367,92 +267,8 @@
"CLK": 14
},
{
"name": "27. Датчик CO2 MHZ-19 UART",
"num": 27,
"type": "Reading",
"subtype": "Mhz19uart",
"id": "co2uart",
"widget": "anydataPpm",
"page": "Сенсоры",
"descr": "CO2uart",
"plus": 0,
"multiply": 1,
"round": 1,
"pin": 0,
"rxPin": 14,
"txPin": 16,
"int": 15,
"range": 5000,
"ABC": 1
},
{
"name": "28. Датчик CO2 MHZ-19 PWM",
"num": 28,
"type": "Reading",
"subtype": "Mhz19pwm",
"id": "co2pwm",
"widget": "anydataPpm",
"page": "Сенсоры",
"descr": "CO2pwm",
"plus": 0,
"multiply": 1,
"round": 1,
"pin": 16,
"int": 300
},
{
"name": "29. Cенсор температуры от MHZ-19 UART",
"num": 29,
"type": "Reading",
"subtype": "Mhz19temp",
"id": "Mhz19temp",
"widget": "anydataTmp",
"page": "Сенсоры",
"descr": "Температура",
"plus": 0,
"multiply": 1,
"round": 1,
"rxPin": 14,
"txPin": 16,
"ABC": 1,
"int": 30
},
{
"name": "30. Рабочий диапазон от MHZ-19 UART",
"num": 30,
"type": "Reading",
"subtype": "Mhz19range",
"id": "Mhz19range",
"widget": "anydataPpm",
"page": "Сенсоры",
"descr": "Диапазон",
"plus": 0,
"multiply": 1,
"round": 1,
"rxPin": 14,
"txPin": 16,
"range": 5000,
"ABC": 1,
"int": 30
},
{
"name": "31. Автокалибровка от MHZ-19 UART",
"num": 31,
"type": "Reading",
"subtype": "Mhz19ABC",
"id": "Mhz19ABC",
"widget": "anydataDef",
"page": "Сенсоры",
"descr": "ABC",
"rxPin": 14,
"txPin": 16,
"range": 5000,
"ABC": 1,
"int": 30
},
{
"name": "32. Датчик пыли SDS011 PM25",
"num": 32,
"name": "20. Датчик пыли SDS011 PM25",
"num": 20,
"type": "Reading",
"subtype": "Sds011_25",
"id": "pmuart25",
@@ -469,8 +285,8 @@
"period": 300
},
{
"name": "33. Датчик пыли SDS011 PM10",
"num": 33,
"name": "21. Датчик пыли SDS011 PM10",
"num": 21,
"type": "Reading",
"subtype": "Sds011_10",
"id": "pmuart10",
@@ -487,8 +303,8 @@
"period": 300
},
{
"name": "34. Cенсор температуры Sht20",
"num": 34,
"name": "22. Cенсор температуры Sht20",
"num": 22,
"type": "Reading",
"subtype": "Sht20t",
"id": "tmp2",
@@ -499,8 +315,8 @@
"round": 1
},
{
"name": "35. Cенсор влажности Sht20",
"num": 35,
"name": "23. Cенсор влажности Sht20",
"num": 23,
"type": "Reading",
"subtype": "Sht20h",
"id": "Hum2",
@@ -510,25 +326,12 @@
"int": 15,
"round": 1
},
{
"name": "36. Сонар HC-SR04",
"num": 36,
"type": "Reading",
"subtype": "Sonar",
"id": "sonar",
"widget": "anydata",
"page": "Сенсоры",
"descr": "Расстояние",
"pinTrig": 5,
"pinEcho": 4,
"int": 5
},
{
"header": "Экраны"
},
{
"name": "37. LCD экран 2004",
"num": 37,
"name": "24. LCD экран 2004",
"num": 24,
"type": "Reading",
"subtype": "Lcd2004",
"id": "Lcd",
@@ -542,8 +345,8 @@
"id2show": "id датчика"
},
{
"name": "38. LCD экран 1602",
"num": 38,
"name": "25. LCD экран 1602",
"num": 25,
"type": "Reading",
"subtype": "Lcd2004",
"id": "Lcd",

View File

@@ -9,9 +9,11 @@ board = nodemcuv2
board_build.ldscript = eagle.flash.4m1m.ld
platform = espressif8266 @2.6.3
monitor_filters = esp8266_exception_decoder
upload_speed = 921600
upload_speed = 115200
monitor_speed = 115200
board_build.filesystem = littlefs
src_filter = +<*>
${env:esp8266_4mb_fromitems.src_filter}
[env:esp32_4mb]
lib_deps =
@@ -23,8 +25,13 @@ framework = arduino
board = esp32dev
platform = espressif32 @3.3.0
monitor_filters = esp32_exception_decoder
upload_speed = 921600
upload_speed = 115200
monitor_speed = 115200
src_filter = +<*>
${env:esp32_4mb_fromitems.src_filter}
[iotm]
exclude = 1
[platformio]
default_envs = esp8266_4mb
@@ -40,6 +47,7 @@ lib_deps_external =
lib_deps =
adafruit/Adafruit MCP23017 Arduino Library@^2.0.2
dfrobot/DFRobotDFPlayerMini @ ^1.0.5
CTBot @2.1.9
adafruit/Adafruit ADS1X15 @ ^2.3.0
Adafruit AHTX0
adafruit/Adafruit BME280 Library
@@ -52,11 +60,13 @@ lib_deps =
Nova Fitness Sds dust sensors library@1.5.1
robtillaart/SHT2x@^0.1.1
marcoschwartz/LiquidCrystal_I2C@^1.1.4
src_filter =
[env:esp32_4mb_fromitems]
lib_deps =
adafruit/Adafruit MCP23017 Arduino Library@^2.0.2
dfrobot/DFRobotDFPlayerMini @ ^1.0.5
CTBot @2.1.9
adafruit/Adafruit ADS1X15 @ ^2.3.0
Adafruit AHTX0
adafruit/Adafruit BME280 Library
@@ -69,4 +79,5 @@ lib_deps =
Nova Fitness Sds dust sensors library@1.5.1
robtillaart/SHT2x@^0.1.1
marcoschwartz/LiquidCrystal_I2C@^1.1.4
src_filter =

View File

@@ -1,17 +1,10 @@
#include "ESPConfiguration.h"
void* getAPI_IarduinoRTC(String subtype, String params);
void* getAPI_Mcp23017(String subtype, String params);
void* getAPI_SysExt(String subtype, String params);
void* getAPI_Variable(String subtype, String params);
void* getAPI_ButtonIn(String subtype, String params);
void* getAPI_ButtonOut(String subtype, String params);
void* getAPI_Mp3(String subtype, String params);
void* getAPI_Telegram(String subtype, String params);
void* getAPI_Timer(String subtype, String params);
void* getAPI_Ads1115(String subtype, String params);
void* getAPI_Aht20(String subtype, String params);
void* getAPI_AnalogAdc(String subtype, String params);
void* getAPI_Bme280(String subtype, String params);
void* getAPI_Bmp280(String subtype, String params);
void* getAPI_Dht1122(String subtype, String params);
@@ -19,26 +12,17 @@ void* getAPI_Ds18b20(String subtype, String params);
void* getAPI_GY21(String subtype, String params);
void* getAPI_Hdc1080(String subtype, String params);
void* getAPI_Max6675(String subtype, String params);
void* getAPI_Mhz19(String subtype, String params);
void* getAPI_Sds011(String subtype, String params);
void* getAPI_Sht20(String subtype, String params);
void* getAPI_Sonar(String subtype, String params);
void* getAPI_Lcd2004(String subtype, String params);
void* getAPI(String subtype, String params) {
void* tmpAPI;
if ((tmpAPI = getAPI_IarduinoRTC(subtype, params)) != nullptr) return tmpAPI;
if ((tmpAPI = getAPI_Mcp23017(subtype, params)) != nullptr) return tmpAPI;
if ((tmpAPI = getAPI_SysExt(subtype, params)) != nullptr) return tmpAPI;
if ((tmpAPI = getAPI_Variable(subtype, params)) != nullptr) return tmpAPI;
if ((tmpAPI = getAPI_ButtonIn(subtype, params)) != nullptr) return tmpAPI;
if ((tmpAPI = getAPI_ButtonOut(subtype, params)) != nullptr) return tmpAPI;
if ((tmpAPI = getAPI_Mp3(subtype, params)) != nullptr) return tmpAPI;
if ((tmpAPI = getAPI_Telegram(subtype, params)) != nullptr) return tmpAPI;
if ((tmpAPI = getAPI_Timer(subtype, params)) != nullptr) return tmpAPI;
if ((tmpAPI = getAPI_Ads1115(subtype, params)) != nullptr) return tmpAPI;
if ((tmpAPI = getAPI_Aht20(subtype, params)) != nullptr) return tmpAPI;
if ((tmpAPI = getAPI_AnalogAdc(subtype, params)) != nullptr) return tmpAPI;
if ((tmpAPI = getAPI_Bme280(subtype, params)) != nullptr) return tmpAPI;
if ((tmpAPI = getAPI_Bmp280(subtype, params)) != nullptr) return tmpAPI;
if ((tmpAPI = getAPI_Dht1122(subtype, params)) != nullptr) return tmpAPI;
@@ -46,9 +30,7 @@ if ((tmpAPI = getAPI_Ds18b20(subtype, params)) != nullptr) return tmpAPI;
if ((tmpAPI = getAPI_GY21(subtype, params)) != nullptr) return tmpAPI;
if ((tmpAPI = getAPI_Hdc1080(subtype, params)) != nullptr) return tmpAPI;
if ((tmpAPI = getAPI_Max6675(subtype, params)) != nullptr) return tmpAPI;
if ((tmpAPI = getAPI_Mhz19(subtype, params)) != nullptr) return tmpAPI;
if ((tmpAPI = getAPI_Sds011(subtype, params)) != nullptr) return tmpAPI;
if ((tmpAPI = getAPI_Sht20(subtype, params)) != nullptr) return tmpAPI;
if ((tmpAPI = getAPI_Sonar(subtype, params)) != nullptr) return tmpAPI;
if ((tmpAPI = getAPI_Lcd2004(subtype, params)) != nullptr) return tmpAPI;return nullptr;
}

View File

@@ -5,3 +5,6 @@ lib_deps =
[env:esp32_4mb]
lib_deps =
dfrobot/DFRobotDFPlayerMini @ ^1.0.5
[iotm]
exclude = false