diff --git a/PrepareProject.py b/PrepareProject.py new file mode 100644 index 00000000..bc120001 --- /dev/null +++ b/PrepareProject.py @@ -0,0 +1,179 @@ +# PrepareProject.py - инструмент для подготовки проекта к компиляции. +# Необходимо вызвать при изменении персональных настроек или состава модулей. +# +# При отсутствии файла с персональными настройками, myProfile.json будет создан автоматически +# python PrepareProject.py +# +# Если myProfile.json уже существует, можно запустить PrepareProject.py с параметром -u или --update для обновления списка модулей. +# Данная функция будет полезна для разработчиков при добавлении модуля в папку src/modules +# python PrepareProject.py --update +# python PrepareProject.py -u +# +# Возможно использовать несколько вариантов персональных настроек и уточнять имя файла при запуске с использованием параметра -p или -profile +# python PrepareProject.py --profile <ИмяФайла> +# python PrepareProject.py -p <ИмяФайла> +# +# + +import configparser +import os, json, sys, getopt +from pathlib import Path + + +config = configparser.ConfigParser() # создаём объекта парсера INI + +def printHelp(): + print('''Usage: + PrepareProject.py + -p --profile + -u --update + -h --help''') + + +def updateModulesInProfile(profJson): + profJson["modules"] = {} + for root,d_names,f_names in os.walk("src\\modules"): + for fname in f_names: + if fname == "modinfo.json": + with open(root + "\\" + fname, "r", encoding='utf-8') as read_file: + modinfoJson = json.load(read_file) + # проверяем есть ли уже узловой элемент и если нет, то создаем + if not modinfoJson['menuSection'] in profJson["modules"]: + profJson["modules"][modinfoJson['menuSection']] = [] + # добавляем информацию о модуле в узловой элемент + profJson["modules"][modinfoJson['menuSection']].append({ + 'path': root, + 'active': modinfoJson['defActive'] + }) + + + + + +update = False # признак необходимости обновить список модулей +profile = 'myProfile.json' # имя профиля. Будет заменено из консоли, если указано при старте + +argv = sys.argv[1:] +try: + opts, args = getopt.getopt(argv, 'hp:u', ['help', 'profile=', 'update']) +except getopt.GetoptError: + print('Ошибка обработки параметров!') + printHelp() + sys.exit(2) + +for opt, arg in opts: + if opt in ("-h", "--help"): + printHelp() + sys.exit() + elif opt in ("-p", "--profile"): + profile = arg + elif opt in ("-u", "--update"): + update = True + + +if Path(profile).is_file(): + # подтягиваем уже существующий профиль + with open(profile, "r", encoding='utf-8') as read_file: + profJson = json.load(read_file) + # если хотим обновить список модулей в существующем профиле + if update: + updateModulesInProfile(profJson) + with open(profile, "w", encoding='utf-8') as write_file: + json.dump(profJson, write_file, ensure_ascii=False, indent=4, sort_keys=False) +else: + # если файла нет - создаем по образу настроек из проекта + profJson = json.loads('{}') + # копируем параметры IOTM из settings.json в новый профиль + with open("data_svelte/settings.json", "r", encoding='utf-8') as read_file: + profJson['iotmSettings'] = json.load(read_file) + # устанавливаем параметры сборки + profJson['projectProp'] = { + 'platformio': { + 'default_envs': 'esp8266_4mb', + 'data_dir': 'data_svelte' + } + } + # загружаем список модулей для сборки + updateModulesInProfile(profJson) + # сохраняем новый профиль + with open(profile, "w", encoding='utf-8') as write_file: + json.dump(profJson, write_file, ensure_ascii=False, indent=4, sort_keys=False) + + +# генерируем файлы проекта на основе подготовленного профиля +# заполняем конфигурационный файл прошивки параметрами из профиля +with open("data_svelte/settings.json", "r", encoding='utf-8') as read_file: + iotmJson = json.load(read_file) +for key, value in profJson['iotmSettings'].items(): + iotmJson[key] = value +with open("data_svelte/settings.json", "w", encoding='utf-8') as write_file: + json.dump(iotmJson, write_file, ensure_ascii=False, indent=4, sort_keys=False) + +# определяем какое устройство используется в профиле +deviceName = profJson['projectProp']['platformio']['default_envs'] + +# собираем меню прошивки из модулей +# параллельно формируем список имен активных модулей +# параллельно собираем необходимые активным модулям библиотеки для включения в компиляцию для текущего типа устройства (esp8266_4m, esp32_4mb) +activeModulesName = [] # список имен активных модулей +allLibs = "" # подборка всех библиотек необходимых модулям для дальнейшей записи в конфигурацию platformio +itemsCount = 1; +includeDirs = "" # подборка путей ко всем модулям для дальнейшей записи в конфигурацию platformio +itemsJson = json.loads('[{"name": "Выберите элемент", "num": 0}]') +for section, modules in profJson['modules'].items(): + itemsJson.append({"header": section}) + for module in modules: + if module['active']: + with open(module['path'] + "\\modinfo.json", "r", encoding='utf-8') as read_file: + moduleJson = json.load(read_file) + if deviceName in moduleJson['devices']: # проверяем поддерживает ли модуль текущее устройство + activeModulesName.append(moduleJson['about']['moduleName']) # запоминаем имена для использования на след шагах + includeDirs = includeDirs + "\n+<" + module['path'].replace("src\\", "") + ">" # запоминаем пути к модулям для компиляции + for libPath in moduleJson['devices'][deviceName]: # запоминаем библиотеки необходимые модулю для текущей платы + allLibs = allLibs + "\n" + libPath + for configItemsJson in moduleJson['configItem']: + configItemsJson['num'] = itemsCount + configItemsJson['name'] = str(itemsCount) + ". " + configItemsJson['name'] + itemsCount = itemsCount + 1 + itemsJson.append(configItemsJson) +with open("data_svelte/items.json", "w", encoding='utf-8') as write_file: + json.dump(itemsJson, write_file, ensure_ascii=False, indent=4, sort_keys=False) + + +# учитываем вызовы модулей в API.cpp +allAPI_head = "" +allAPI_exec = "" +for activModuleName in activeModulesName: + allAPI_head = allAPI_head + "\nvoid* getAPI_" + activModuleName + "(String subtype, String params);" + allAPI_exec = allAPI_exec + "\nif ((tmpAPI = getAPI_" + activModuleName + "(subtype, params)) != nullptr) return tmpAPI;" +apicpp = '#include "ESPConfiguration.h"\n' +apicpp = apicpp + allAPI_head +apicpp = apicpp + '\n\nvoid* getAPI(String subtype, String params) {\nvoid* tmpAPI;' +apicpp = apicpp + allAPI_exec +apicpp = apicpp + '\nreturn nullptr;\n}' +with open('src/modules/API.cpp', 'w') as f: + f.write(apicpp) + +# корректируем параметры platformio +# собираем пути всех отключенных модулей для исключения их из процесса компиляции +# excludeDirs = "" +# for root,d_names,f_names in os.walk("src\\modules"): +# for fname in f_names: +# if fname == "modinfo.json": +# with open(root + "\\" + fname, "r", encoding='utf-8') as read_file: +# modinfoJson = json.load(read_file) +# if not modinfoJson['about']['moduleName'] in activeModulesName: +# excludeDirs = excludeDirs + "\n-<" + root.replace("src\\", "") + ">" + +# фиксируем изменения в platformio.ini +config.clear() +config.read("platformio.ini") +config["env:" + deviceName + "_fromitems"]["lib_deps"] = allLibs +config["env:" + deviceName + "_fromitems"]["build_src_filter"] = includeDirs +config["platformio"]["default_envs"] = deviceName +config["platformio"]["data_dir"] = profJson['projectProp']['platformio']['data_dir'] +with open("platformio.ini", 'w') as configFile: + config.write(configFile) + + + \ No newline at end of file diff --git a/accembleItems.py b/accembleItems.py deleted file mode 100644 index 6a5fdfcd..00000000 --- a/accembleItems.py +++ /dev/null @@ -1,116 +0,0 @@ -import configparser -import os -import json, pprint - -config = configparser.ConfigParser() # создаём объекта парсера INI -allLibs_esp8266_4mb = "" -allLibs_esp32_4mb = "" - -allMenuItems = json.loads('[]') -allMenuItemsCount = 1 - -allAPI_head = "" -allAPI_exec = "" - -excludeDirs = "" - - -def getDirs(path): - global excludeDirs - for file in os.listdir(path): - 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 - 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"] - allLibs_esp32_4mb = allLibs_esp32_4mb + config["env:esp32_4mb"]["lib_deps"] - - -def getMenuItems(patch): - global allMenuItems, allMenuItemsCount - with open(patch + "items.json", "r") as read_file: - allMenuItems = allMenuItems + json.load(read_file) - - for dir in getDirs(patch): - with open(patch + dir + "/items.json", "r") as read_file: - print(patch + dir + "/items.json") - data = json.load(read_file) - for item in data: - item["name"] = str(allMenuItemsCount) + ". " + item["name"] - item["num"] = allMenuItemsCount - allMenuItemsCount = allMenuItemsCount + 1 - allMenuItems = allMenuItems + data - - -def getAPI(patch): - global allAPI_head, allAPI_exec - for dir in getDirs(patch): - print(patch + dir) - allAPI_head = allAPI_head + "\nvoid* getAPI_" + dir + "(String subtype, String params);" - allAPI_exec = allAPI_exec + "\nif ((tmpAPI = getAPI_" + dir + "(subtype, params)) != nullptr) return tmpAPI;" - - - -# читаем и запоминаем все либы мз каждого модуля -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"]["build_src_filter"] = excludeDirs -config["env:esp32_4mb_fromitems"]["build_src_filter"] = excludeDirs -with open("platformio.ini", 'w') as configfile: - config.write(configfile) - - - -# готовим первый элемент меню -with open("src/modules/items.json", "r") as read_file: - allMenuItems = allMenuItems + json.load(read_file) - -# читаем и запоминаем пункты меню модуелей -getMenuItems("src/modules/system/") -getMenuItems("src/modules/exec/") -getMenuItems("src/modules/sensors/") -getMenuItems("src/modules/lcd/") - -# сохраняем пункты меню в общий файл -with open('data_svelte/items.json', 'w') as f: - json.dump(allMenuItems, f, ensure_ascii=False, indent=4, sort_keys=False) - - -# собираем списки API для интеграции вызовов модулей -getAPI("src/modules/system/") -getAPI("src/modules/exec/") -getAPI("src/modules/sensors/") -getAPI("src/modules/lcd/") - -# сохраняем все API в API.cpp -apicpp = '#include "ESPConfiguration.h"\n' -apicpp = apicpp + allAPI_head -apicpp = apicpp + '\n\nvoid* getAPI(String subtype, String params) {\nvoid* tmpAPI;' -apicpp = apicpp + allAPI_exec -apicpp = apicpp + 'return nullptr;\n}' -with open('src/modules/API.cpp', 'w') as f: - f.write(apicpp) \ No newline at end of file diff --git a/data_svelte/items.json b/data_svelte/items.json index 63671869..fcf14db1 100644 --- a/data_svelte/items.json +++ b/data_svelte/items.json @@ -3,12 +3,133 @@ "name": "Выберите элемент", "num": 0 }, + { + "header": "Экраны" + }, + { + "name": "1. LCD экран 2004", + "type": "Reading", + "subtype": "Lcd2004", + "id": "Lcd", + "widget": "", + "page": "", + "descr": "T", + "int": 15, + "addr": "0x27", + "size": "20,4", + "coord": "0,0", + "id2show": "id датчика", + "num": 1 + }, + { + "name": "2. LCD экран 1602", + "type": "Reading", + "subtype": "Lcd2004", + "id": "Lcd", + "widget": "", + "page": "", + "descr": "T", + "int": 15, + "addr": "0x27", + "size": "16,2", + "coord": "0,0", + "id2show": "id датчика", + "num": 2 + }, + { + "header": "Модули управления" + }, + { + "name": "3. Кнопка (подключенная физически)", + "type": "Writing", + "subtype": "ButtonIn", + "id": "btn", + "widget": "toggle", + "page": "Кнопки", + "descr": "", + "int": 0, + "pin": 16, + "execLevel": "1", + "pinMode": "INPUT", + "debounceDelay": 50, + "fixState": 1, + "num": 3 + }, + { + "name": "4. Кнопка управляющая пином (Реле с кнопкой)", + "type": "Writing", + "subtype": "ButtonOut", + "id": "btn", + "widget": "toggle", + "page": "Кнопки", + "descr": "", + "int": 0, + "inv": 0, + "pin": 2, + "num": 4 + }, + { + "name": "5. Сервопривод", + "type": "Writing", + "subtype": "IoTServo", + "id": "servo", + "widget": "range", + "page": "servo", + "descr": "угол", + "int": 1, + "pin": 12, + "apin": -1, + "amap": "0, 4096, 0, 180", + "num": 5 + }, + { + "name": "6. MP3 плеер", + "type": "Reading", + "subtype": "Mp3", + "id": "mp3", + "widget": "", + "page": "", + "descr": "", + "int": 1, + "pins": "14,12", + "volume": 20, + "num": 6 + }, + { + "name": "7. Телеграм-Бот", + "type": "Writing", + "subtype": "Telegram", + "id": "tg", + "widget": "", + "page": "", + "descr": "", + "int": 10, + "token": "", + "autos": 1, + "receiveMsg": 0, + "chatID": "", + "num": 7 + }, + { + "name": "8. Таймер", + "type": "Writing", + "subtype": "Timer", + "id": "timer", + "widget": "", + "page": "", + "descr": "", + "int": 1, + "countDown": 15, + "ticker": 0, + "repeat": 0, + "needSave": 0, + "num": 8 + }, { "header": "Расширения" }, { - "name": "1. Поддержка DS1302(1), DS1307(2), DS3231(3), RX8025(4)", - "num": 1, + "name": "9. Поддержка DS1302(1), DS1307(2), DS3231(3), RX8025(4)", "type": "Reading", "subtype": "IarduinoRTC", "id": "RTC", @@ -21,11 +142,11 @@ "clk": 5, "dat": 4, "defFormat": "d-m-Y", - "ticker": 0 + "ticker": 0, + "num": 9 }, { - "name": "2. Расширитель портов Mcp23017", - "num": 2, + "name": "10. Расширитель портов Mcp23017", "type": "Reading", "subtype": "Mcp23017", "id": "Mcp", @@ -34,22 +155,22 @@ "descr": "", "int": "0", "addr": "0x20", - "index": 1 + "index": 1, + "num": 10 }, { - "name": "3. Доп. функции системы", - "num": 3, + "name": "11. Доп. функции системы", "type": "Reading", "subtype": "SysExt", "id": "SysExt", "widget": "", "page": "", "descr": "", - "int": 15 + "int": 15, + "num": 11 }, { - "name": "4. Переменная", - "num": 4, + "name": "12. Переменная", "type": "Reading", "subtype": "Variable", "id": "var", @@ -57,533 +178,7 @@ "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. Сервопривод", - "num": 7, - "type": "Writing", - "subtype": "IoTServo", - "id": "servo", - "widget": "range", - "page": "servo", - "descr": "угол", - "int": 1, - "pin": 12, - "apin": -1, - "amap": "0, 4096, 0, 180" - }, - { - "name": "8. MP3 плеер", - "num": 8, - "type": "Reading", - "subtype": "Mp3", - "id": "mp3", - "widget": "", - "page": "", - "descr": "", - "int": 1, - "pins": "14,12", - "volume": 20 - }, - { - "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, - "type": "Reading", - "subtype": "Ads1115", - "id": "Ads3", - "widget": "anydataVlt", - "page": "Сенсоры", - "descr": "ADS_3", - "pin": "0", - "mode": "volt", - "gain": "3/4x", - "plus": 0, - "multiply": 1, - "round": 2, - "int": 10 - }, - { - "name": "11. Cенсор температуры AHT20", - "num": 11, - "type": "Reading", - "subtype": "Aht20t", - "id": "Temp20", - "widget": "anydataTmp", - "page": "Сенсоры", - "descr": "AHT20 Температура", - "int": 15, - "addr": "0x38", - "round": 1 - }, - { - "name": "12. Cенсор влажности AHT20", - "num": 12, - "type": "Reading", - "subtype": "Aht20h", - "id": "Hum20", - "widget": "anydataHum", - "page": "Сенсоры", - "descr": "AHT20 Влажность", - "int": 15, - "addr": "0x38", - "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, - "avgSteps": 1 - }, - { - "name": "14. Cенсор температуры Bme280", - "num": 14, - "type": "Reading", - "subtype": "Bme280t", - "id": "tmp3", - "widget": "anydataTmp", - "page": "Сенсоры", - "descr": "Температура", - "int": 15, - "addr": "0x77", - "round": 1 - }, - { - "name": "15. Cенсор давления Bme280", - "num": 15, - "type": "Reading", - "subtype": "Bme280p", - "id": "Press3", - "widget": "anydataMm", - "page": "Сенсоры", - "descr": "Давление", - "int": 15, - "addr": "0x77", - "round": 1 - }, - { - "name": "16. Cенсор влажности Bme280", - "num": 16, - "type": "Reading", - "subtype": "Bme280h", - "id": "Hum3", - "widget": "anydataHum", - "page": "Сенсоры", - "descr": "Влажность", - "int": 15, - "addr": "0x77", - "round": 1 - }, - { - "name": "17. Cенсор температуры Bmp280", - "num": 17, - "type": "Reading", - "subtype": "Bmp280t", - "id": "tmp3", - "widget": "anydataTmp", - "page": "Сенсоры", - "descr": "280 Температура", - "int": 15, - "addr": "0x77", - "round": 1 - }, - { - "name": "18. Cенсор давления Bmp280", - "num": 18, - "type": "Reading", - "subtype": "Bmp280p", - "id": "Press3", - "widget": "anydataMm", - "page": "Сенсоры", - "descr": "280 Давление", - "int": 15, - "addr": "0x77", - "round": 1 - }, - { - "name": "19. Cенсор температуры dht11", - "num": 19, - "type": "Reading", - "subtype": "Dht1122t", - "id": "tmp3", - "widget": "anydataTmp", - "page": "Сенсоры", - "descr": "Температура", - "int": 15, - "pin": 0, - "senstype": "dht11" - }, - { - "name": "20. Cенсор влажности dht11", - "num": 20, - "type": "Reading", - "subtype": "Dht1122h", - "id": "Hum3", - "widget": "anydataHum", - "page": "Сенсоры", - "descr": "Влажность", - "int": 15, - "pin": 0, - "senstype": "dht11" - }, - { - "name": "21. Cенсор температуры ds18b20", - "num": 21, - "type": "Reading", - "subtype": "Ds18b20", - "id": "dstmp", - "widget": "anydataTmp", - "page": "Сенсоры", - "descr": "DS Температура", - "int": 15, - "pin": 2, - "index": 0, - "addr": "", - "round": 1 - }, - { - "name": "22. Датчик тока", - "num": 22, - "type": "Reading", - "subtype": "I", - "id": "current", - "widget": "anydataAmp", - "page": "Сенсоры", - "descr": "Датчик тока", - "int": 10, - "pin_I": 34, - "calib_I": 111.1, - "plus": 0, - "multiply": 1 - }, - { - "name": "23. Датчик напряжения", - "num": 23, - "type": "Reading", - "subtype": "U", - "id": "voltage", - "widget": "anydataVlt", - "page": "Сенсоры", - "descr": "Датчик напряжения", - "int": 10, - "pin_U": 35, - "calib_U": 223.1, - "plus": 0, - "multiply": 1 - }, - { - "name": "24. Cенсор температуры GY21", - "num": 24, - "type": "Reading", - "subtype": "GY21t", - "id": "tmp4", - "widget": "anydataTmp", - "page": "Сенсоры", - "descr": "Температура", - "round": 1, - "int": 15 - }, - { - "name": "25. Cенсор влажности GY21", - "num": 25, - "type": "Reading", - "subtype": "GY21h", - "id": "Hum4", - "widget": "anydataHum", - "page": "Сенсоры", - "descr": "Влажность", - "round": 1, - "int": 15 - }, - { - "name": "26. Cенсор температуры HDC1080", - "num": 26, - "type": "Reading", - "subtype": "Hdc1080t", - "id": "Temp1080", - "widget": "anydataTmp", - "page": "Сенсоры", - "descr": "1080 Температура", - "int": 15, - "addr": "0x40", - "round": 1 - }, - { - "name": "27. Cенсор влажности HDC1080", - "num": 27, - "type": "Reading", - "subtype": "Hdc1080h", - "id": "Hum1080", - "widget": "anydataHum", - "page": "Сенсоры", - "descr": "1080 Влажность", - "int": 15, - "addr": "0x40", - "round": 1 - }, - { - "name": "28. Cенсор температуры MAX6675", - "num": 28, - "type": "Reading", - "subtype": "Max6675t", - "id": "maxtmp", - "widget": "anydataTmp", - "page": "Сенсоры", - "descr": "MAX Температура", - "int": 15, - "DO": 12, - "CS": 13, - "CLK": 14 - }, - { - "name": "29. Датчик CO2 MHZ-19 UART", - "num": 29, - "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": "30. Датчик CO2 MHZ-19 PWM", - "num": 30, - "type": "Reading", - "subtype": "Mhz19pwm", - "id": "co2pwm", - "widget": "anydataPpm", - "page": "Сенсоры", - "descr": "CO2pwm", - "plus": 0, - "multiply": 1, - "round": 1, - "pin": 16, - "int": 300 - }, - { - "name": "31. Cенсор температуры от MHZ-19 UART", - "num": 31, - "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": "32. Рабочий диапазон от MHZ-19 UART", - "num": 32, - "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": "33. Автокалибровка от MHZ-19 UART", - "num": 33, - "type": "Reading", - "subtype": "Mhz19ABC", - "id": "Mhz19ABC", - "widget": "anydataDef", - "page": "Сенсоры", - "descr": "ABC", - "rxPin": 14, - "txPin": 16, - "range": 5000, - "ABC": 1, - "int": 30 - }, - { - "name": "34. Датчик пыли SDS011 PM25", - "num": 34, - "type": "Reading", - "subtype": "Sds011_25", - "id": "pmuart25", - "widget": "anydataPpm", - "page": "Сенсоры", - "descr": "PM-2.5", - "plus": 0, - "multiply": 1, - "round": 10, - "rxPin": 13, - "txPin": 12, - "int": 15, - "warmUp": 30, - "period": 300 - }, - { - "name": "35. Датчик пыли SDS011 PM10", - "num": 35, - "type": "Reading", - "subtype": "Sds011_10", - "id": "pmuart10", - "widget": "anydataPpm", - "page": "Сенсоры", - "descr": "PM-10", - "plus": 0, - "multiply": 1, - "round": 10, - "rxPin": 13, - "txPin": 12, - "int": 15, - "warmUp": 30, - "period": 300 - }, - { - "name": "36. Cенсор температуры Sht20", - "num": 36, - "type": "Reading", - "subtype": "Sht20t", - "id": "tmp2", - "widget": "anydataTmp", - "page": "Сенсоры", - "descr": "Температура", - "int": 15, - "round": 1 - }, - { - "name": "37. Cенсор влажности Sht20", - "num": 37, - "type": "Reading", - "subtype": "Sht20h", - "id": "Hum2", - "widget": "anydataHum", - "page": "Сенсоры", - "descr": "Влажность", - "int": 15, - "round": 1 - }, - { - "name": "38. Сонар HC-SR04", - "num": 38, - "type": "Reading", - "subtype": "Sonar", - "id": "sonar", - "widget": "anydataTmp", - "page": "Сенсоры", - "descr": "Расстояние", - "pinTrig": 5, - "pinEcho": 4, - "int": 5 - }, - { - "header": "Экраны" - }, - { - "name": "39. LCD экран 2004", - "num": 39, - "type": "Reading", - "subtype": "Lcd2004", - "id": "Lcd", - "widget": "", - "page": "", - "descr": "T", - "int": 15, - "addr": "0x27", - "size": "20,4", - "coord": "0,0", - "id2show": "id датчика" - }, - { - "name": "40. LCD экран 1602", - "num": 40, - "type": "Reading", - "subtype": "Lcd2004", - "id": "Lcd", - "widget": "", - "page": "", - "descr": "T", - "int": 15, - "addr": "0x27", - "size": "16,2", - "coord": "0,0", - "id2show": "id датчика" + "val": "0", + "num": 12 } ] \ No newline at end of file diff --git a/platformio.ini b/platformio.ini index 3fd4e4c8..6eb84ef9 100644 --- a/platformio.ini +++ b/platformio.ini @@ -12,7 +12,11 @@ monitor_filters = esp8266_exception_decoder upload_speed = 115200 monitor_speed = 115200 board_build.filesystem = littlefs -build_src_filter = +<*> +build_src_filter = + +<*.cpp> + + + + + + ${env:esp8266_4mb_fromitems.build_src_filter} [env:esp32_4mb] @@ -27,12 +31,13 @@ platform = espressif32 @3.3.0 monitor_filters = esp32_exception_decoder upload_speed = 115200 monitor_speed = 115200 -build_src_filter = +<*> +build_src_filter = + +<*.cpp> + + + + + + ${env:esp32_4mb_fromitems.build_src_filter} -[iotm] -exclude = 1 - [platformio] default_envs = esp8266_4mb data_dir = data_svelte @@ -45,48 +50,42 @@ lib_deps_external = [env:esp8266_4mb_fromitems] lib_deps = - adafruit/Adafruit MCP23017 Arduino Library@^2.0.2 - dfrobot/DFRobotDFPlayerMini @ ^1.0.5 - adafruit/Adafruit ADS1X15 @ ^2.3.0 - Adafruit AHTX0 - adafruit/Adafruit BME280 Library - adafruit/Adafruit BMP280 Library - beegee-tokyo/DHT sensor library for ESPx - milesburton/DallasTemperature@^3.9.1 - openenergymonitor/EmonLib@1.1.0 - https://github.com/JonasGMorsch/GY-21.git - ClosedCube HDC1080 - adafruit/MAX6675 library - Nova Fitness Sds dust sensors library@1.5.1 - robtillaart/SHT2x@^0.1.1 marcoschwartz/LiquidCrystal_I2C@^1.1.4 + dfrobot/DFRobotDFPlayerMini @ ^1.0.5 + CTBot @2.1.9 + adafruit/Adafruit MCP23017 Arduino Library@^2.0.2 + adafruit/Adafruit BusIO @ ^1.13.0 build_src_filter = - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + [env:esp32_4mb_fromitems] lib_deps = - adafruit/Adafruit MCP23017 Arduino Library@^2.0.2 + marcoschwartz/LiquidCrystal_I2C@^1.1.4 https://github.com/RoboticsBrno/ServoESP32 dfrobot/DFRobotDFPlayerMini @ ^1.0.5 - adafruit/Adafruit ADS1X15 @ ^2.3.0 - Adafruit AHTX0 - adafruit/Adafruit BME280 Library - adafruit/Adafruit BMP280 Library - beegee-tokyo/DHT sensor library for ESPx - milesburton/DallasTemperature@^3.9.1 - openenergymonitor/EmonLib@1.1.0 - https://github.com/JonasGMorsch/GY-21.git - ClosedCube HDC1080 - adafruit/MAX6675 library - Nova Fitness Sds dust sensors library@1.5.1 - robtillaart/SHT2x@^0.1.1 - marcoschwartz/LiquidCrystal_I2C@^1.1.4 + CTBot @2.1.9 + adafruit/Adafruit MCP23017 Arduino Library@^2.0.2 + adafruit/Adafruit BusIO @ ^1.13.0 build_src_filter = - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + diff --git a/src/modules/API.cpp b/src/modules/API.cpp index 5fcf2a5d..50863c25 100644 --- a/src/modules/API.cpp +++ b/src/modules/API.cpp @@ -1,56 +1,29 @@ #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_Lcd2004(String subtype, String params); void* getAPI_ButtonIn(String subtype, String params); void* getAPI_ButtonOut(String subtype, String params); void* getAPI_IoTServo(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); -void* getAPI_Ds18b20(String subtype, String params); -void* getAPI_Emon(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_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(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_Lcd2004(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_IoTServo(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; -if ((tmpAPI = getAPI_Ds18b20(subtype, params)) != nullptr) return tmpAPI; -if ((tmpAPI = getAPI_Emon(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; +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; +return nullptr; } \ No newline at end of file diff --git a/src/modules/lcd/Lcd2004/Lcd2004.cpp b/src/modules/display/Lcd2004/Lcd2004.cpp similarity index 100% rename from src/modules/lcd/Lcd2004/Lcd2004.cpp rename to src/modules/display/Lcd2004/Lcd2004.cpp diff --git a/src/modules/display/Lcd2004/modinfo.json b/src/modules/display/Lcd2004/modinfo.json new file mode 100644 index 00000000..59e4e2b0 --- /dev/null +++ b/src/modules/display/Lcd2004/modinfo.json @@ -0,0 +1,62 @@ +{ + "menuSection": "Экраны", + + "configItem": [{ + "name": "LCD экран 2004", + "type": "Reading", + "subtype": "Lcd2004", + "id": "Lcd", + "widget": "", + "page": "", + "descr": "T", + + "int": 15, + "addr": "0x27", + "size": "20,4", + "coord": "0,0", + "id2show": "id датчика" + }, + { + "name": "LCD экран 1602", + "type": "Reading", + "subtype": "Lcd2004", + "id": "Lcd", + "widget": "", + "page": "", + "descr": "T", + + "int": 15, + "addr": "0x27", + "size": "16,2", + "coord": "0,0", + "id2show": "id датчика" + }], + + "about": { + "authorName": "Ilya Belyakov", + "authorContact": "https://t.me/Biveraxe", + "authorGit": "https://github.com/biveraxe", + "specialThanks": "Sergey @Serghei63", + "moduleName": "Lcd2004", + "moduleVersion": "1.0", + "moduleDesc": "Позволяет выводить на символьные экраны по указанным позициям значения других элементов конфигурации.", + "propInfo": { + "int": "Период времени в секундах обновления информации на экране по конкретному элементу.", + "addr": "Адрес устройства на шине, обычно 0x27.", + "size": "Размерность матрицы экрана.", + "coord": "Координата позиции для вывода данных элемента конфигурации.", + "id2show": "id элемента конфигурации." + } + }, + + "defActive": true, + + "devices": { + "esp32_4mb": [ + "marcoschwartz/LiquidCrystal_I2C@^1.1.4" + ], + "esp8266_4mb": [ + "marcoschwartz/LiquidCrystal_I2C@^1.1.4" + ] + } +} \ No newline at end of file diff --git a/src/modules/exec/ButtonIn/items.json b/src/modules/exec/ButtonIn/items.json deleted file mode 100644 index e501f50a..00000000 --- a/src/modules/exec/ButtonIn/items.json +++ /dev/null @@ -1,19 +0,0 @@ -[ - { - "name": "Кнопка (подключенная физически)", - "num": 31, - "type": "Writing", - "subtype": "ButtonIn", - "id": "btn", - "widget": "toggle", - "page": "Кнопки", - "descr": "", - "int": 0, - - "pin": 16, - "execLevel": "1", - "pinMode": "INPUT", - "debounceDelay": 50, - "fixState": 1 - } -] \ No newline at end of file diff --git a/src/modules/exec/ButtonIn/modinfo.json b/src/modules/exec/ButtonIn/modinfo.json new file mode 100644 index 00000000..642532fe --- /dev/null +++ b/src/modules/exec/ButtonIn/modinfo.json @@ -0,0 +1,44 @@ +{ + "menuSection": "Модули управления", + + "configItem": [{ + "name": "Кнопка (подключенная физически)", + "type": "Writing", + "subtype": "ButtonIn", + "id": "btn", + "widget": "toggle", + "page": "Кнопки", + "descr": "", + "int": 0, + + "pin": 16, + "execLevel": "1", + "pinMode": "INPUT", + "debounceDelay": 50, + "fixState": 1 + }], + + "about": { + "authorName": "Ilya Belyakov", + "authorContact": "https://t.me/Biveraxe", + "authorGit": "https://github.com/biveraxe", + "specialThanks": "", + "moduleName": "ButtonIn", + "moduleVersion": "1.0", + "moduleDesc": "Позволяет интерпретировать сигналы на цифровом пине как кнопку, т.е. создает в системе объект для чтения булевых значений с внешнего физического источника. Может вести себя как кнопка или как переключатель.", + "propInfo": { + "pin": "Укажите GPIO номер пина для чтения состояний подключенной кнопки", + "execLevel": "Высокий 1 или низкий 0 уровень переключения состояния", + "pinMode": "Может быть INPUT_PULLUP INPUT_PULLDOWN INPUT", + "debounceDelay": "Время обработки дребезга", + "fixState": "Поведение входа, срабатывание на переходе или на фиксации уровня (триггерный режим)" + } + }, + + "defActive": true, + + "devices": { + "esp32_4mb": [], + "esp8266_4mb": [] + } +} \ No newline at end of file diff --git a/src/modules/exec/ButtonOut/items.json b/src/modules/exec/ButtonOut/items.json deleted file mode 100644 index 2ab65d68..00000000 --- a/src/modules/exec/ButtonOut/items.json +++ /dev/null @@ -1,16 +0,0 @@ -[ - { - "name": "Кнопка управляющая пином (Реле с кнопкой)", - "num": 31, - "type": "Writing", - "subtype": "ButtonOut", - "id": "btn", - "widget": "toggle", - "page": "Кнопки", - "descr": "", - "int": 0, - - "inv": 0, - "pin": 2 - } -] \ No newline at end of file diff --git a/src/modules/exec/ButtonOut/modinfo.json b/src/modules/exec/ButtonOut/modinfo.json new file mode 100644 index 00000000..d85a2220 --- /dev/null +++ b/src/modules/exec/ButtonOut/modinfo.json @@ -0,0 +1,38 @@ +{ + "menuSection": "Модули управления", + + "configItem": [{ + "name": "Кнопка управляющая пином (Реле с кнопкой)", + "type": "Writing", + "subtype": "ButtonOut", + "id": "btn", + "widget": "toggle", + "page": "Кнопки", + "descr": "", + "int": 0, + + "inv": 0, + "pin": 2 + }], + + "about": { + "authorName": "Ilya Belyakov", + "authorContact": "https://t.me/Biveraxe", + "authorGit": "https://github.com/biveraxe", + "specialThanks": "", + "moduleName": "ButtonOut", + "moduleVersion": "1.0", + "moduleDesc": "Управляем состоянием конкретного пина по модели реле.", + "propInfo": { + "pin": "Укажите GPIO номер пина для управления выходом", + "inv": "Инвертировать выходные сигналы" + } + }, + + "defActive": true, + + "devices": { + "esp32_4mb": [], + "esp8266_4mb": [] + } +} \ No newline at end of file diff --git a/src/modules/exec/EspCam/items.json b/src/modules/exec/EspCam/items.json deleted file mode 100644 index 3b960a74..00000000 --- a/src/modules/exec/EspCam/items.json +++ /dev/null @@ -1,17 +0,0 @@ -[ - { - "name": "Camera OV2640 (ESPcam)", - "num": 30, - "type": "Reading", - "subtype": "EspCam", - "id": "EspCam", - "widget": "", - "page": "", - "descr": "", - - "int": 60, - "useLed": 0, - "ticker": 0, - "webTicker": 0 - } -] \ No newline at end of file diff --git a/src/modules/exec/EspCam/modinfo.json b/src/modules/exec/EspCam/modinfo.json new file mode 100644 index 00000000..35768e3c --- /dev/null +++ b/src/modules/exec/EspCam/modinfo.json @@ -0,0 +1,42 @@ +{ + "menuSection": "Модули управления", + + "configItem": [{ + "name": "Camera OV2640 (ESPcam)", + "type": "Reading", + "subtype": "EspCam", + "id": "EspCam", + "widget": "", + "page": "", + "descr": "", + + "int": 60, + "useLed": 0, + "ticker": 0, + "webTicker": 0 + }], + + "about": { + "authorName": "Ilya Belyakov", + "authorContact": "https://t.me/Biveraxe", + "authorGit": "https://github.com/biveraxe", + "specialThanks": "", + "moduleName": "EspCam", + "moduleVersion": "1.0", + "moduleDesc": "Предназначен для специальной платы esp32 со встроенной камерой. Добавляет в прошивку функцию создания фото и сохранения в оперативную память. Для сброса на флешкарту необходимо использовать парный модуль SDcard. Это экспериментальные модули и в будущем планируется пересобрать их.", + "propInfo": { + "int": "Пауза в секундах во время постоянной съемки.", + "useLed": "использовать диод подсветки при съемке.", + "ticker": "Генерировать(1) или нет(0) событие с интервалом int", + "webTicker": "Генерировать(1) или нет(0) событие при обращении через веб-страницу с текущим фото в памяти." + } + }, + + "defActive": false, + + "devices": { + "esp32_4mb": [ + "espressif/esp32-camera @ ^2.0.0" + ] + } +} \ No newline at end of file diff --git a/src/modules/exec/EspCam/platformio.ini b/src/modules/exec/EspCam/platformio.ini deleted file mode 100644 index 0659fba9..00000000 --- a/src/modules/exec/EspCam/platformio.ini +++ /dev/null @@ -1,9 +0,0 @@ -[env:esp8266_4mb] -lib_deps = - -[env:esp32_4mb] -lib_deps = - espressif/esp32-camera @ ^2.0.0 - -[iotm] - exclude = true diff --git a/src/modules/exec/IoTServo/items.json b/src/modules/exec/IoTServo/items.json deleted file mode 100644 index 16aba55c..00000000 --- a/src/modules/exec/IoTServo/items.json +++ /dev/null @@ -1,17 +0,0 @@ -[ - { - "name": "Сервопривод", - "num": 30, - "type": "Writing", - "subtype": "IoTServo", - "id": "servo", - "widget": "range", - "page": "servo", - "descr": "угол", - - "int": 1, - "pin": 12, - "apin": -1, - "amap": "0, 4096, 0, 180" - } -] \ No newline at end of file diff --git a/src/modules/exec/IoTServo/modinfo.json b/src/modules/exec/IoTServo/modinfo.json new file mode 100644 index 00000000..c0936b75 --- /dev/null +++ b/src/modules/exec/IoTServo/modinfo.json @@ -0,0 +1,43 @@ +{ + "menuSection": "Модули управления", + + "configItem": [{ + "name": "Сервопривод", + "type": "Writing", + "subtype": "IoTServo", + "id": "servo", + "widget": "range", + "page": "servo", + "descr": "угол", + + "int": 1, + "pin": 12, + "apin": -1, + "amap": "0, 4096, 0, 180" + }], + + "about": { + "authorName": "Ilya Belyakov", + "authorContact": "https://t.me/Biveraxe", + "authorGit": "https://github.com/biveraxe", + "specialThanks": "Oleg @Threedreality, Sergey @Serghei63", + "moduleName": "IoTServo", + "moduleVersion": "1.0", + "moduleDesc": "Предназначен для управления сервоприводом по уровню аналогово сигнала.", + "propInfo": { + "int": "Пауза в секундах между опросами аналогового входа. Если 0, то читаем постоянно", + "pin": "Пин, к которому подключен сервопривод", + "apin": "Номер GPIO аналогового пина. Если -1, то функция отключена.", + "amap": "Настройки преобразования значений аналога в нужный диапазон сервы, имеет смысл, если аналог включен." + } + }, + + "defActive": true, + + "devices": { + "esp32_4mb": [ + "https://github.com/RoboticsBrno/ServoESP32" + ], + "esp8266_4mb": [] + } +} \ No newline at end of file diff --git a/src/modules/exec/IoTServo/platformio.ini b/src/modules/exec/IoTServo/platformio.ini deleted file mode 100644 index 8933c36f..00000000 --- a/src/modules/exec/IoTServo/platformio.ini +++ /dev/null @@ -1,7 +0,0 @@ -[env:esp8266_4mb] -lib_deps = - - -[env:esp32_4mb] -lib_deps = - https://github.com/RoboticsBrno/ServoESP32 diff --git a/src/modules/exec/Mp3/items.json b/src/modules/exec/Mp3/items.json deleted file mode 100644 index 4065d308..00000000 --- a/src/modules/exec/Mp3/items.json +++ /dev/null @@ -1,16 +0,0 @@ -[ - { - "name": "MP3 плеер", - "num": 30, - "type": "Reading", - "subtype": "Mp3", - "id": "mp3", - "widget": "", - "page": "", - "descr": "", - - "int": 1, - "pins": "14,12", - "volume": 20 - } -] \ No newline at end of file diff --git a/src/modules/exec/Mp3/modinfo.json b/src/modules/exec/Mp3/modinfo.json new file mode 100644 index 00000000..74341161 --- /dev/null +++ b/src/modules/exec/Mp3/modinfo.json @@ -0,0 +1,43 @@ +{ + "menuSection": "Модули управления", + + "configItem": [{ + "name": "MP3 плеер", + "type": "Reading", + "subtype": "Mp3", + "id": "mp3", + "widget": "", + "page": "", + "descr": "", + + "int": 1, + "pins": "14,12", + "volume": 20 + }], + + "about": { + "authorName": "Ilya Belyakov", + "authorContact": "https://t.me/Biveraxe", + "authorGit": "https://github.com/biveraxe", + "specialThanks": "", + "moduleName": "Mp3", + "moduleVersion": "1.0", + "moduleDesc": "Позволяет управлять модулем проигрывания MP3 файлов с SD-карты по serial интерфейсу (DFplayer mini).", + "propInfo": { + "int": "Периодичность в секундах опроса состояния плеера.", + "pins": "Список GPIO через запятую, к которым подключен плеер.", + "volume": "Уровень громкости при инициализации." + } + }, + + "defActive": true, + + "devices": { + "esp32_4mb": [ + "dfrobot/DFRobotDFPlayerMini @ ^1.0.5" + ], + "esp8266_4mb": [ + "dfrobot/DFRobotDFPlayerMini @ ^1.0.5" + ] + } +} \ No newline at end of file diff --git a/src/modules/exec/Mp3/platformio.ini b/src/modules/exec/Mp3/platformio.ini deleted file mode 100644 index fabde04c..00000000 --- a/src/modules/exec/Mp3/platformio.ini +++ /dev/null @@ -1,10 +0,0 @@ -[env:esp8266_4mb] -lib_deps = - dfrobot/DFRobotDFPlayerMini @ ^1.0.5 - -[env:esp32_4mb] -lib_deps = - dfrobot/DFRobotDFPlayerMini @ ^1.0.5 - -[iotm] - exclude = false diff --git a/src/modules/exec/SDcard/items.json b/src/modules/exec/SDcard/items.json deleted file mode 100644 index aad696bc..00000000 --- a/src/modules/exec/SDcard/items.json +++ /dev/null @@ -1,14 +0,0 @@ -[ - { - "name": "SD карта", - "num": 30, - "type": "Writing", - "subtype": "SDcard", - "id": "sd", - "widget": "", - "page": "", - "descr": "", - - "int": 60 - } -] \ No newline at end of file diff --git a/src/modules/exec/SDcard/modinfo.json b/src/modules/exec/SDcard/modinfo.json new file mode 100644 index 00000000..7e6746a6 --- /dev/null +++ b/src/modules/exec/SDcard/modinfo.json @@ -0,0 +1,36 @@ +{ + "menuSection": "Модули управления", + + "configItem": [{ + "name": "SD карта", + "type": "Writing", + "subtype": "SDcard", + "id": "sd", + "widget": "", + "page": "", + "descr": "", + + "int": 1 + }], + + "about": { + "authorName": "Ilya Belyakov", + "authorContact": "https://t.me/Biveraxe", + "authorGit": "https://github.com/biveraxe", + "specialThanks": "", + "moduleName": "SDcard", + "moduleVersion": "1.0", + "moduleDesc": "Предназначен для специальной платы esp32 со встроенной камерой. Добавляет в прошивку функцию сохранения фото из оперативной памяти. Работает в паре с EspCam. Это экспериментальные модули и в будущем планируется пересобрать их.", + "propInfo": { + "int": "Не используется." + } + }, + + "defActive": false, + + "devices": { + "esp32_4mb": [ + "espressif/esp32-camera @ ^2.0.0" + ] + } +} \ No newline at end of file diff --git a/src/modules/exec/SDcard/platformio.ini b/src/modules/exec/SDcard/platformio.ini deleted file mode 100644 index 918c9a4f..00000000 --- a/src/modules/exec/SDcard/platformio.ini +++ /dev/null @@ -1,9 +0,0 @@ -[env:esp8266_4mb] -lib_deps = - -[env:esp32_4mb] -lib_deps = - - -[iotm] - exclude = true diff --git a/src/modules/exec/Telegram/items.json b/src/modules/exec/Telegram/items.json deleted file mode 100644 index d083db83..00000000 --- a/src/modules/exec/Telegram/items.json +++ /dev/null @@ -1,18 +0,0 @@ -[ - { - "name": "Телеграм-Бот", - "num": 31, - "type": "Writing", - "subtype": "Telegram", - "id": "tg", - "widget": "", - "page": "", - "descr": "", - "int": 10, - - "token": "", - "autos": 1, - "receiveMsg": 0, - "chatID": "" - } -] \ No newline at end of file diff --git a/src/modules/exec/Telegram/modinfo.json b/src/modules/exec/Telegram/modinfo.json new file mode 100644 index 00000000..05bcc36a --- /dev/null +++ b/src/modules/exec/Telegram/modinfo.json @@ -0,0 +1,46 @@ +{ + "menuSection": "Модули управления", + + "configItem": [{ + "name": "Телеграм-Бот", + "type": "Writing", + "subtype": "Telegram", + "id": "tg", + "widget": "", + "page": "", + "descr": "", + "int": 10, + + "token": "", + "autos": 1, + "receiveMsg": 0, + "chatID": "" + }], + + "about": { + "authorName": "Ilya Belyakov", + "authorContact": "https://t.me/Biveraxe", + "authorGit": "https://github.com/biveraxe", + "specialThanks": "", + "moduleName": "Telegram", + "moduleVersion": "1.0", + "moduleDesc": "Добавляет возможность отправлять сообщения от имени бота контакту в Телеграм-чате и получать команды.", + "propInfo": { + "token": "Токен для авторизации бота в системе Telegram", + "autos": "Автоматически(1) или нет(0) запоминать ChatID по входящим сообщениям. Т.е. бот будет информировать тех, кто последний прислал сообщение.", + "receiveMsg": "Обрабатывать(1) или нет(0) входящие сообщения.", + "chatID": "ИД диалога с контактом. Необходим для отправки сообщений именно вам." + } + }, + + "defActive": true, + + "devices": { + "esp32_4mb": [ + "CTBot @2.1.9" + ], + "esp8266_4mb": [ + "CTBot @2.1.9" + ] + } +} \ No newline at end of file diff --git a/src/modules/exec/Telegram/platformio.ini b/src/modules/exec/Telegram/platformio.ini deleted file mode 100644 index cde3621b..00000000 --- a/src/modules/exec/Telegram/platformio.ini +++ /dev/null @@ -1,7 +0,0 @@ -[env:esp8266_4mb] -lib_deps = - CTBot @2.1.9 - -[env:esp32_4mb] -lib_deps = - CTBot @2.1.9 diff --git a/src/modules/exec/Timer/items.json b/src/modules/exec/Timer/items.json deleted file mode 100644 index 22445f36..00000000 --- a/src/modules/exec/Timer/items.json +++ /dev/null @@ -1,18 +0,0 @@ -[ - { - "name": "Таймер", - "num": 31, - "type": "Writing", - "subtype": "Timer", - "id": "timer", - "widget": "", - "page": "", - "descr": "", - - "int": 1, - "countDown": 15, - "ticker": 0, - "repeat": 0, - "needSave": 0 - } -] \ No newline at end of file diff --git a/src/modules/exec/Timer/modinfo.json b/src/modules/exec/Timer/modinfo.json new file mode 100644 index 00000000..e5e367a0 --- /dev/null +++ b/src/modules/exec/Timer/modinfo.json @@ -0,0 +1,43 @@ +{ + "menuSection": "Модули управления", + + "configItem": [{ + "name": "Таймер", + "type": "Writing", + "subtype": "Timer", + "id": "timer", + "widget": "", + "page": "", + "descr": "", + + "int": 1, + "countDown": 15, + "ticker": 0, + "repeat": 0, + "needSave": 0 + }], + + "about": { + "authorName": "Ilya Belyakov", + "authorContact": "https://t.me/Biveraxe", + "authorGit": "https://github.com/biveraxe", + "specialThanks": "", + "moduleName": "Timer", + "moduleVersion": "1.0", + "moduleDesc": "Добавляет инструмент таймеров обратного отсчета для организации периодичных операций или логических конструкций. Часто используется как вспомогательный элемент для автоматизации.", + "propInfo": { + "int": "Задает размер в секундах одного шага(тика) таймера.", + "countDown": "Начальное значение таймера, с которого начинается обратный отсчет.", + "ticker": "Генерировать(1) или нет(0) события при каждом тике таймера.", + "repeat": "Сбрасывать(1) или нет(0) таймер в начальное состояние при достижении нуля.", + "needSave": "Требуется сохранять(1) или нет(0) состояние в энерго независимую память. Функция находится в разработке." + } + }, + + "defActive": true, + + "devices": { + "esp32_4mb": [], + "esp8266_4mb": [] + } +} \ No newline at end of file diff --git a/src/modules/exec/items.json b/src/modules/exec/items.json deleted file mode 100644 index 8cb113d8..00000000 --- a/src/modules/exec/items.json +++ /dev/null @@ -1,5 +0,0 @@ -[ - { - "header": "Модули управления" - } -] \ No newline at end of file diff --git a/src/modules/items.json b/src/modules/items.json deleted file mode 100644 index a71a6cfd..00000000 --- a/src/modules/items.json +++ /dev/null @@ -1,6 +0,0 @@ -[ - { - "name": "Выберите элемент", - "num": 0 - } -] \ No newline at end of file diff --git a/src/modules/lcd/Lcd2004/items.json b/src/modules/lcd/Lcd2004/items.json deleted file mode 100644 index 81118ea4..00000000 --- a/src/modules/lcd/Lcd2004/items.json +++ /dev/null @@ -1,32 +0,0 @@ -[ - { - "name": "LCD экран 2004", - "num": 25, - "type": "Reading", - "subtype": "Lcd2004", - "id": "Lcd", - "widget": "", - "page": "", - "descr": "T", - "int": 15, - "addr": "0x27", - "size": "20,4", - "coord": "0,0", - "id2show": "id датчика" - }, - { - "name": "LCD экран 1602", - "num": 26, - "type": "Reading", - "subtype": "Lcd2004", - "id": "Lcd", - "widget": "", - "page": "", - "descr": "T", - "int": 15, - "addr": "0x27", - "size": "16,2", - "coord": "0,0", - "id2show": "id датчика" - } -] \ No newline at end of file diff --git a/src/modules/lcd/Lcd2004/platformio.ini b/src/modules/lcd/Lcd2004/platformio.ini deleted file mode 100644 index bdecd531..00000000 --- a/src/modules/lcd/Lcd2004/platformio.ini +++ /dev/null @@ -1,7 +0,0 @@ -[env:esp8266_4mb] -lib_deps = - marcoschwartz/LiquidCrystal_I2C@^1.1.4 - -[env:esp32_4mb] -lib_deps = - marcoschwartz/LiquidCrystal_I2C@^1.1.4 diff --git a/src/modules/lcd/items.json b/src/modules/lcd/items.json deleted file mode 100644 index c0739a1d..00000000 --- a/src/modules/lcd/items.json +++ /dev/null @@ -1,5 +0,0 @@ -[ - { - "header": "Экраны" - } -] \ No newline at end of file diff --git a/src/modules/sensors/IoTWiegand/platformio.ini b/src/modules/sensors/IoTWiegand/platformio.ini index 0a4331bd..bb1e349b 100644 --- a/src/modules/sensors/IoTWiegand/platformio.ini +++ b/src/modules/sensors/IoTWiegand/platformio.ini @@ -1,12 +1,10 @@ [env:esp8266_4mb] +iotm_include = false lib_deps = https://github.com/jpliew/Wiegand-NG-Multi-Bit-Wiegand-Library-for-Arduino [env:esp32_4mb] +iotm_include = false lib_deps = https://github.com/jpliew/Wiegand-NG-Multi-Bit-Wiegand-Library-for-Arduino - -[iotm] - ;exclude = false - exclude = true diff --git a/src/modules/system/IarduinoRTC/items.json b/src/modules/system/IarduinoRTC/items.json deleted file mode 100644 index 72a3bbf6..00000000 --- a/src/modules/system/IarduinoRTC/items.json +++ /dev/null @@ -1,20 +0,0 @@ -[ - { - "name": "Поддержка DS1302(1), DS1307(2), DS3231(3), RX8025(4)", - "num": 29, - "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 - } -] \ No newline at end of file diff --git a/src/modules/system/IarduinoRTC/modinfo.json b/src/modules/system/IarduinoRTC/modinfo.json new file mode 100644 index 00000000..568f0ed9 --- /dev/null +++ b/src/modules/system/IarduinoRTC/modinfo.json @@ -0,0 +1,47 @@ +{ + "menuSection": "Расширения", + + "configItem": [{ + "name": "Поддержка DS1302(1), DS1307(2), DS3231(3), RX8025(4)", + "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 + }], + + "about": { + "authorName": "Ilya Belyakov", + "authorContact": "https://t.me/Biveraxe", + "authorGit": "https://github.com/biveraxe", + "specialThanks": "Sergey @Serghei63", + "moduleName": "IarduinoRTC", + "moduleVersion": "1.0", + "moduleDesc": "Позволяет использовать часы реального времени в виде внешнего физического модуля или виртуального с синхронизацией через сеть Интернет.", + "propInfo": { + "int": "Период времени в секундах между опросами времени с RTC", + "chipNum": "Выбор источника: 0 - время с Интернет, 1 - модуль DS1302, 2 - модуль DS1307, 3 - модуль DS3231, 4 - модуль RX38025", + "rst": "Номер пина для подключения вашего модуля часов. (не всегда используется).", + "clk": "Номер пина для SDL вашего модуля часов", + "dat": "Номер пина для SDA вашего модуля часов", + "defFormat": "Вывод информации в формате defFormat", + "ticker": "Генерировать(1) или нет(0) события при каждом тике модуля = int. Позволяет не применять модуль таймера, если нужно просто тактировать работу." + } + }, + + "defActive": true, + + "devices": { + "esp32_4mb": [], + "esp8266_4mb": [] + } +} \ No newline at end of file diff --git a/src/modules/system/Mcp23017/items.json b/src/modules/system/Mcp23017/items.json deleted file mode 100644 index 8c44661c..00000000 --- a/src/modules/system/Mcp23017/items.json +++ /dev/null @@ -1,16 +0,0 @@ -[ - { - "name": "Расширитель портов Mcp23017", - "num": 29, - "type": "Reading", - "subtype": "Mcp23017", - "id": "Mcp", - "widget": "", - "page": "", - "descr": "", - - "int": "0", - "addr": "0x20", - "index": 1 - } -] \ No newline at end of file diff --git a/src/modules/system/Mcp23017/modinfo.json b/src/modules/system/Mcp23017/modinfo.json new file mode 100644 index 00000000..0d3df2c1 --- /dev/null +++ b/src/modules/system/Mcp23017/modinfo.json @@ -0,0 +1,45 @@ +{ + "menuSection": "Расширения", + + "configItem": [{ + "name": "Расширитель портов Mcp23017", + "type": "Reading", + "subtype": "Mcp23017", + "id": "Mcp", + "widget": "", + "page": "", + "descr": "", + + "int": "0", + "addr": "0x20", + "index": 1 + }], + + "about": { + "authorName": "Ilya Belyakov", + "authorContact": "https://t.me/Biveraxe", + "authorGit": "https://github.com/biveraxe", + "specialThanks": "", + "moduleName": "Mcp23017", + "moduleVersion": "1.0", + "moduleDesc": "Добавляет в систему дополнительные GPIO для элементов, которые поддерживают такую функцию.", + "propInfo": { + "int": "Не используется", + "addr": "Адрес устройства на шине, обычно 0x20", + "index": "Значения от 1 до 4, где при выборе 1 будет нумерация pin 100-115, при выборе 2 200-215 и т.д." + } + }, + + "defActive": true, + + "devices": { + "esp32_4mb": [ + "adafruit/Adafruit MCP23017 Arduino Library@^2.0.2", + "adafruit/Adafruit BusIO @ ^1.13.0" + ], + "esp8266_4mb": [ + "adafruit/Adafruit MCP23017 Arduino Library@^2.0.2", + "adafruit/Adafruit BusIO @ ^1.13.0" + ] + } +} \ No newline at end of file diff --git a/src/modules/system/Mcp23017/platformio.ini b/src/modules/system/Mcp23017/platformio.ini deleted file mode 100644 index 77357a41..00000000 --- a/src/modules/system/Mcp23017/platformio.ini +++ /dev/null @@ -1,8 +0,0 @@ -[env:esp8266_4mb] -lib_deps = - adafruit/Adafruit MCP23017 Arduino Library@^2.0.2 - -[env:esp32_4mb] -lib_deps = - adafruit/Adafruit MCP23017 Arduino Library@^2.0.2 - diff --git a/src/modules/system/SysExt/items.json b/src/modules/system/SysExt/items.json deleted file mode 100644 index 9ee6a261..00000000 --- a/src/modules/system/SysExt/items.json +++ /dev/null @@ -1,13 +0,0 @@ -[ - { - "name": "Доп. функции системы", - "num": 27, - "type": "Reading", - "subtype": "SysExt", - "id": "SysExt", - "widget": "", - "page": "", - "descr": "", - "int": 15 - } -] \ No newline at end of file diff --git a/src/modules/system/SysExt/modinfo.json b/src/modules/system/SysExt/modinfo.json new file mode 100644 index 00000000..53166d97 --- /dev/null +++ b/src/modules/system/SysExt/modinfo.json @@ -0,0 +1,34 @@ +{ + "menuSection": "Расширения", + + "configItem": [{ + "name": "Доп. функции системы", + "type": "Reading", + "subtype": "SysExt", + "id": "SysExt", + "widget": "", + "page": "", + "descr": "", + "int": 15 + }], + + "about": { + "authorName": "Ilya Belyakov", + "authorContact": "https://t.me/Biveraxe", + "authorGit": "https://github.com/biveraxe", + "specialThanks": "", + "moduleName": "SysExt", + "moduleVersion": "1.0", + "moduleDesc": "Добавляет в систему дополнительные функции. Например, возможность прямого управления GPIO из сценариев.", + "propInfo": { + "int": "Не используется" + } + }, + + "defActive": true, + + "devices": { + "esp32_4mb": [], + "esp8266_4mb": [] + } +} \ No newline at end of file diff --git a/src/modules/system/Variable/items.json b/src/modules/system/Variable/items.json deleted file mode 100644 index d86f6d58..00000000 --- a/src/modules/system/Variable/items.json +++ /dev/null @@ -1,15 +0,0 @@ -[ - { - "name": "Переменная", - "num": 30, - "type": "Reading", - "subtype": "Variable", - "id": "var", - "widget": "", - "page": "", - "descr": "", - - "int": "0", - "val": "0" - } -] \ No newline at end of file diff --git a/src/modules/system/Variable/modinfo.json b/src/modules/system/Variable/modinfo.json new file mode 100644 index 00000000..2a2bfb47 --- /dev/null +++ b/src/modules/system/Variable/modinfo.json @@ -0,0 +1,37 @@ +{ + "menuSection": "Расширения", + + "configItem": [{ + "name": "Переменная", + "type": "Reading", + "subtype": "Variable", + "id": "var", + "widget": "", + "page": "", + "descr": "", + + "int": "0", + "val": "0" + }], + + "about": { + "authorName": "Ilya Belyakov", + "authorContact": "https://t.me/Biveraxe", + "authorGit": "https://github.com/biveraxe", + "specialThanks": "", + "moduleName": "Variable", + "moduleVersion": "1.0", + "moduleDesc": "Специальный системный модуль для использования переменных в процессе автоматизации как элементов конфигурации.", + "propInfo": { + "int": "Не используется", + "val": "Не используется" + } + }, + + "defActive": true, + + "devices": { + "esp32_4mb": [], + "esp8266_4mb": [] + } +} \ No newline at end of file diff --git a/src/modules/system/items.json b/src/modules/system/items.json deleted file mode 100644 index 18bf3b6a..00000000 --- a/src/modules/system/items.json +++ /dev/null @@ -1,5 +0,0 @@ -[ - { - "header": "Расширения" - } -] \ No newline at end of file diff --git a/training/QueueFromChar.cpp b/training/QueueFromChar.cpp deleted file mode 100644 index 3d7a4bc3..00000000 --- a/training/QueueFromChar.cpp +++ /dev/null @@ -1,46 +0,0 @@ -#ifdef QUEUE_FROM_CHAR -#include "classes/QueueFromChar.h" - -QueueFromChar::QueueFromChar() { - commandList = NULL; - commandCount = 0; -} -QueueFromChar::~QueueFromChar() {} - -//добавление команды в буфер -void QueueFromChar::addCommand(const char* command) { - commandList = (CharBufferStruct*)realloc(commandList, (commandCount + 1) * sizeof(CharBufferStruct)); - strncpy(commandList[commandCount].command, command, MAX_COMMAND_LENGTH); - Serial.println("command added: " + String(command) + " " + String(commandCount)); - commandCount++; -} - -//распечатаем все добавленные команды -void QueueFromChar::printCommands() { - if (commandCount > 0 && commandList != NULL) { - for (int i = 0; i < commandCount; i++) { - Serial.println(commandList[i].command); - } - } -} - -//заберем последнюю из положенных в буфер команд -String QueueFromChar::getLastCommand() { - String ret = "empty"; - if (commandList != NULL) { - int cnt = commandCount - 1; - ret = commandList[cnt].command; - if (cnt > 0) { - delete commandList[cnt].command; - } else if (cnt == 0) { - commandList = NULL; - } - Serial.println("command deleted: " + ret + " " + String(cnt)); - commandCount--; - } - return ret; -} - -// QueueFromChar* myBuf; - -#endif diff --git a/training/QueueFromChar.h b/training/QueueFromChar.h deleted file mode 100644 index c16b799e..00000000 --- a/training/QueueFromChar.h +++ /dev/null @@ -1,42 +0,0 @@ -#pragma once -#include "Global.h" -#ifdef QUEUE_FROM_CHAR - -#define MAX_COMMAND_LENGTH 16 -#define BUFFER 128 - -class QueueFromChar; - -class QueueFromChar { - public: - QueueFromChar(); - ~QueueFromChar(); - - void addCommand(const char* command); - - void printCommands(); - - String getLastCommand(); - - private: - struct CharBufferStruct { - char command[MAX_COMMAND_LENGTH + 1]; - }; - CharBufferStruct* commandList; - int commandCount = 0; -}; - -// extern QueueFromChar* myBuf; - -//========проверка очереди===================== -// myBuf = new QueueFromChar; -// myBuf->addCommand("zero"); -// myBuf->addCommand("one"); -// myBuf->addCommand("two"); -// myBuf->printCommands(); -// myBuf->getLastCommand(); -// myBuf->getLastCommand(); -// myBuf->getLastCommand(); -// myBuf->printCommands(); - -#endif diff --git a/training/QueueFromInstance.cpp b/training/QueueFromInstance.cpp deleted file mode 100644 index 69321913..00000000 --- a/training/QueueFromInstance.cpp +++ /dev/null @@ -1,30 +0,0 @@ -#ifdef QUEUE_FROM_INST -#include "classes/QueueFromInstance.h" - -QueueFromInstance::QueueFromInstance() {} -QueueFromInstance::~QueueFromInstance() {} - -//добавим элемент в конец очереди -void QueueFromInstance::push(QueueInstance instance) { - queue1.push(instance); -} - -//удалим элемент из начала очереди -void QueueFromInstance::pop() { - if (!queue1.empty()) { - queue1.pop(); - } -} - -//вернуть элемент из начала очереди и удалить его -QueueInstance QueueFromInstance::front() { - QueueInstance instance(""); - if (!queue1.empty()) { - instance = queue1.front(); - queue1.pop(); - } - return instance; -} - -// QueueFromInstance* myQueue; -#endif diff --git a/training/QueueFromInstance.h b/training/QueueFromInstance.h deleted file mode 100644 index 0a509bf8..00000000 --- a/training/QueueFromInstance.h +++ /dev/null @@ -1,26 +0,0 @@ -#pragma once -#include "Global.h" -#ifdef QUEUE_FROM_INST -#include "classes/QueueInst.h" -#include -#include - -using namespace std; - -class QueueFromInstance; - -class QueueFromInstance { - public: - QueueFromInstance(); - ~QueueFromInstance(); - - void push(QueueInstance instance); - void pop(); - QueueInstance front(); - - private: - queue queue1; -}; - -// extern QueueFromInstance* myQueue; -#endif \ No newline at end of file diff --git a/training/QueueFromStruct.cpp b/training/QueueFromStruct.cpp deleted file mode 100644 index 52c5fb4c..00000000 --- a/training/QueueFromStruct.cpp +++ /dev/null @@ -1,32 +0,0 @@ -#include "classes/QueueFromStruct.h" -#ifdef QUEUE_FROM_STR -QueueFromStruct::QueueFromStruct() {} -QueueFromStruct::~QueueFromStruct() {} - -//добавим элемент в конец очереди -void QueueFromStruct::push(QueueItems word) { - queue1.push(word); -} - -//удалим элемент из начала очереди -void QueueFromStruct::pop() { - if (!queue1.empty()) { - queue1.pop(); - } -} - -//вернуть элемент из начала очереди и удалить его -QueueItems QueueFromStruct::front() { - if (!queue1.empty()) { - tmpItem = queue1.front(); - queue1.pop(); - } - return tmpItem; -} - -bool QueueFromStruct::empty() { - return queue1.empty(); -} - -QueueFromStruct* filesQueue; -#endif diff --git a/training/QueueFromStruct.h b/training/QueueFromStruct.h deleted file mode 100644 index d51de82f..00000000 --- a/training/QueueFromStruct.h +++ /dev/null @@ -1,46 +0,0 @@ -#pragma once -#include "Global.h" -#ifdef QUEUE_FROM_STR -#include -//#include долбанный стрим сука - -using namespace std; - -struct QueueItems { - String myword; - uint8_t num; -}; - -class QueueFromStruct; - -class QueueFromStruct { - public: - QueueFromStruct(); - ~QueueFromStruct(); - - void push(QueueItems word); - void pop(); - QueueItems front(); - bool empty(); - - private: - queue queue1; - QueueItems tmpItem; -}; - -extern QueueFromStruct* filesQueue; - -//=======проверка очереди из структур================= -// myQueueStruct = new QueueFromStruct; -// QueueItems myItem; -// myItem.myword = "word1"; -// myQueueStruct->push(myItem); -// myItem.myword = "word2"; -// myQueueStruct->push(myItem); -// myItem.myword = "word3"; -// myQueueStruct->push(myItem); -// Serial.println(myQueueStruct->front().myword); -// Serial.println(myQueueStruct->front().myword); -// Serial.println(myQueueStruct->front().myword); - -#endif diff --git a/training/QueueInst.cpp b/training/QueueInst.cpp deleted file mode 100644 index 7439f3a5..00000000 --- a/training/QueueInst.cpp +++ /dev/null @@ -1,24 +0,0 @@ -#ifdef QUEUE_FROM_INST -#include "queue/QueueInst.h" - -QueueInstance::QueueInstance(String text) { - _text = text; -} -QueueInstance::~QueueInstance() {} - -String QueueInstance::get() { - return _text; -} - -//========проверка очереди из экземпляров====== - -// myQueue = new QueueFromInstance; - -// myQueue->push(QueueInstance("text1")); -// myQueue->push(QueueInstance("text2")); -// myQueue->push(QueueInstance("text3")); - -// Serial.println(myQueue->front().get()); -// Serial.println(myQueue->front().get()); -// Serial.println(myQueue->front().get()); -#endif \ No newline at end of file diff --git a/training/QueueInst.h b/training/QueueInst.h deleted file mode 100644 index 9731980c..00000000 --- a/training/QueueInst.h +++ /dev/null @@ -1,21 +0,0 @@ -#pragma once -#include "Global.h" -#ifdef QUEUE_FROM_INST -#include -#include - -using namespace std; - -class QueueInstance; - -class QueueInstance { - public: - QueueInstance(String text); - ~QueueInstance(); - - String get(); - - private: - String _text; -}; -#endif diff --git a/training/SendJson.cpp b/training/SendJson.cpp deleted file mode 100644 index 9a7af2fb..00000000 --- a/training/SendJson.cpp +++ /dev/null @@ -1,44 +0,0 @@ -#include "classes/SendJson.h" -#ifdef QUEUE_FROM_STR - -SendJson::SendJson() { - filesQueue = new QueueFromStruct; -} -SendJson::~SendJson() {} - -void SendJson::addFileToQueue(String path, uint8_t num) { - myItem.myword = path; - myItem.num = num; - filesQueue->push(myItem); - SerialPrint(F("i"), F("WS"), "file added to Queue " + path); -} - -//опсылает массив json по объектно в сокеты -void SendJson::loop() { - if (!filesQueue->empty() && !sendingInProgress) { - Serial.println("Queue not empty"); - myItem = filesQueue->front(); - _path = myItem.myword; - _num = myItem.num; - file = seekFile(_path); - SerialPrint(F("i"), F("WS"), "seek File to WS " + _path); - sendingInProgress = true; - } - if (file.available()) { - String jsonArrayElement = _path + file.readStringUntil('}') + "}"; - sendWs(jsonArrayElement); - } else { - sendingInProgress = false; - } -} - -void SendJson::sendWs(String& jsonArrayElement) { - standWebSocket.sendTXT(_num, jsonArrayElement); -} - -void SendJson::sendMqtt(String& jsonArrayElement) { - // mqtt send to do -} - -SendJson* sendJsonFiles; -#endif \ No newline at end of file diff --git a/training/SendJson.h b/training/SendJson.h deleted file mode 100644 index 0fabea32..00000000 --- a/training/SendJson.h +++ /dev/null @@ -1,31 +0,0 @@ -#pragma once -#include "Global.h" -#ifdef QUEUE_FROM_STR -#include "classes/QueueFromStruct.h" - -class SendJson; - -class SendJson { - public: - SendJson(); - ~SendJson(); - - void addFileToQueue(String path, uint8_t num); - - void loop(); - - void sendWs(String& jsonArrayElement); - - void sendMqtt(String& jsonArrayElement); - - QueueItems myItem; - - private: - File file; - String _path; - uint8_t _num; - bool sendingInProgress = false; -}; - -extern SendJson* sendJsonFiles; -#endif diff --git a/training/info.txt b/training/info.txt deleted file mode 100644 index b7cb2d9e..00000000 --- a/training/info.txt +++ /dev/null @@ -1,8 +0,0 @@ -здесь пишу статистику по остатку оперативной памяти после глобальных изменений - -22.12.21 пустой код без wifi остаток = 50.28 kB -22.12.21 запустил wifi остаток = 48.59 kB -22.12.21 добавил асинхронный веб сервер = 38.36 kB -22.12.21 добавил web sockets = 37.63 kB - -20.01.22 стандартный сервер mqtt в работе = 41.00 kb \ No newline at end of file