From 75a96508b218e8eefa6d403382778e3469028659 Mon Sep 17 00:00:00 2001 From: biver Date: Mon, 7 Mar 2022 21:53:13 +0300 Subject: [PATCH] =?UTF-8?q?=D0=A3=D1=82=D0=BE=D1=87=D0=BD=D1=8F=D0=B5?= =?UTF-8?q?=D0=BC=20=D0=98=D0=94=20=D0=BC=D0=BE=D0=B4=D1=83=D0=BB=D1=8F=20?= =?UTF-8?q?=D0=B4=D0=BB=D1=8F=20GY21?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/modules/API.cpp | 72 +++++++++---------- .../{GY-21/GY-21.cpp => GY21/GY21.cpp} | 0 .../sensors/{GY-21 => GY21}/items.json | 0 .../sensors/{GY-21 => GY21}/platformio.ini | 0 4 files changed, 32 insertions(+), 40 deletions(-) rename src/modules/sensors/{GY-21/GY-21.cpp => GY21/GY21.cpp} (100%) rename src/modules/sensors/{GY-21 => GY21}/items.json (100%) rename src/modules/sensors/{GY-21 => GY21}/platformio.ini (100%) diff --git a/src/modules/API.cpp b/src/modules/API.cpp index b08d148d..7101a3b0 100644 --- a/src/modules/API.cpp +++ b/src/modules/API.cpp @@ -1,48 +1,40 @@ #include "ESPConfiguration.h" -//============================================================================================ -//здесь скопируйте строку и вставьте ниже, заменив имя AnalogAdc на название вашего сенсора -void* getAPI_AnalogAdc(String subtype, String params); -void* getAPI_Ds18b20(String subtype, String params); -void* getAPI_Sht20(String subtype, String params); -void* getAPI_Dht1122(String subtype, String params); -void* getAPI_Bmp280(String subtype, String params); -void* getAPI_Bme280(String subtype, String params); -void* getAPI_Aht20(String subtype, String params); -void* getAPI_Hdc1080(String subtype, String params); -void* getAPI_GY21(String subtype, String params); -void* getAPI_Lcd2004(String subtype, String params); -void* getAPI_SysExt(String subtype, String params); -void* getAPI_Ads1115(String subtype, String params); void* getAPI_Mcp23017(String subtype, String params); -void* getAPI_ButtonOut(String subtype, String params); +void* getAPI_SysExt(String subtype, String params); void* getAPI_Variable(String subtype, String params); -void* getAPI_Sds011(String subtype, String params); +void* getAPI_ButtonOut(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_GY21(String subtype, String params); +void* getAPI_Hdc1080(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_Lcd2004(String subtype, String params); void* getAPI(String subtype, String params) { - void* tmpAPI; - //=============================================================================================================== - //здесь нужно скопировать строку еще раз и вставить ее ниже, переименовав AnalogAdc на название вашего сенсора - if ((tmpAPI = getAPI_AnalogAdc(subtype, params)) != nullptr) return tmpAPI; - if ((tmpAPI = getAPI_Ds18b20(subtype, params)) != nullptr) return tmpAPI; - if ((tmpAPI = getAPI_Sht20(subtype, params)) != nullptr) return tmpAPI; - if ((tmpAPI = getAPI_Dht1122(subtype, params)) != nullptr) return tmpAPI; - if ((tmpAPI = getAPI_Bmp280(subtype, params)) != nullptr) return tmpAPI; - if ((tmpAPI = getAPI_Bme280(subtype, params)) != nullptr) return tmpAPI; - if ((tmpAPI = getAPI_Aht20(subtype, params)) != nullptr) return tmpAPI; - if ((tmpAPI = getAPI_Hdc1080(subtype, params)) != nullptr) return tmpAPI; - if ((tmpAPI = getAPI_GY21(subtype, params)) != nullptr) return tmpAPI; - if ((tmpAPI = getAPI_Lcd2004(subtype, params)) != nullptr) return tmpAPI; - if ((tmpAPI = getAPI_SysExt(subtype, params)) != nullptr) return tmpAPI; - if ((tmpAPI = getAPI_Ads1115(subtype, params)) != nullptr) return tmpAPI; - if ((tmpAPI = getAPI_Mcp23017(subtype, params)) != nullptr) return tmpAPI; - if ((tmpAPI = getAPI_ButtonOut(subtype, params)) != nullptr) return tmpAPI; - if ((tmpAPI = getAPI_Variable(subtype, params)) != nullptr) return tmpAPI; - if ((tmpAPI = getAPI_Sds011(subtype, params)) != nullptr) return tmpAPI; - if ((tmpAPI = getAPI_Mhz19(subtype, params)) != nullptr) return tmpAPI; - //================================================================================================================ - - return nullptr; +void* 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_ButtonOut(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_GY21(subtype, params)) != nullptr) return tmpAPI; +if ((tmpAPI = getAPI_Hdc1080(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_Lcd2004(subtype, params)) != nullptr) return tmpAPI;return nullptr; } \ No newline at end of file diff --git a/src/modules/sensors/GY-21/GY-21.cpp b/src/modules/sensors/GY21/GY21.cpp similarity index 100% rename from src/modules/sensors/GY-21/GY-21.cpp rename to src/modules/sensors/GY21/GY21.cpp diff --git a/src/modules/sensors/GY-21/items.json b/src/modules/sensors/GY21/items.json similarity index 100% rename from src/modules/sensors/GY-21/items.json rename to src/modules/sensors/GY21/items.json diff --git a/src/modules/sensors/GY-21/platformio.ini b/src/modules/sensors/GY21/platformio.ini similarity index 100% rename from src/modules/sensors/GY-21/platformio.ini rename to src/modules/sensors/GY21/platformio.ini