add WDT 10s, fix 8266, tiny

This commit is contained in:
Mit4el
2024-11-16 15:00:04 +03:00
parent dc87331c4b
commit dbad34b42c
8 changed files with 143 additions and 159 deletions

View File

@@ -17,15 +17,17 @@ typedef struct {
time_t heap_min_time; time_t heap_min_time;
uint32_t backtrace[CONFIG_RESTART_DEBUG_STACK_DEPTH]; uint32_t backtrace[CONFIG_RESTART_DEBUG_STACK_DEPTH];
} re_restart_debug_t; } re_restart_debug_t;
__NOINIT_ATTR static int8_t bootloop_panic_count;
void IRAM_ATTR debugUpdate();
#endif // RESTART_DEBUG_INFO #endif // RESTART_DEBUG_INFO
__NOINIT_ATTR static int8_t bootloop_panic_count;
extern "C" void __real_esp_panic_handler(void*); extern "C" void __real_esp_panic_handler(void*);
void printDebugTrace(); void printDebugTrace();
void sendDebugTraceAndFreeMemory(bool); void sendDebugTraceAndFreeMemory(bool);
void IRAM_ATTR debugUpdate();
void startWatchDog();
extern "C" bool verifyRollbackLater(); extern "C" bool verifyRollbackLater();
void verifyFirmware(); void verifyFirmware();

View File

@@ -869,6 +869,7 @@ build_src_filter =
[env:tiny_fromitems] [env:tiny_fromitems]
lib_deps = lib_deps =
plerup/EspSoftwareSerial
build_src_filter = build_src_filter =
+<modules/virtual/Cron> +<modules/virtual/Cron>
+<modules/virtual/Loging> +<modules/virtual/Loging>
@@ -878,5 +879,10 @@ build_src_filter =
+<modules/virtual/Timer> +<modules/virtual/Timer>
+<modules/virtual/Variable> +<modules/virtual/Variable>
+<modules/virtual/VButton> +<modules/virtual/VButton>
+<modules/sensors/AnalogAdc>
+<modules/sensors/BL0937> +<modules/sensors/BL0937>
+<modules/sensors/UART>
+<modules/exec/AnalogBtn>
+<modules/exec/ButtonIn>
+<modules/exec/ButtonOut>

View File

@@ -1,6 +1,6 @@
#include "DebugTrace.h" #include "DebugTrace.h"
#if defined(RESTART_DEBUG_INFO) && defined(ESP32) && !defined(esp32c3m_4mb) #if defined(RESTART_DEBUG_INFO) && defined(ESP32) && !defined(esp32c3m_4mb)
//#ifdef RESTART_DEBUG_INFO // #ifdef RESTART_DEBUG_INFO
__NOINIT_ATTR static re_restart_debug_t _debug_info; __NOINIT_ATTR static re_restart_debug_t _debug_info;
#include "esp_debug_helpers.h" #include "esp_debug_helpers.h"
@@ -9,7 +9,6 @@ __NOINIT_ATTR static re_restart_debug_t _debug_info;
#include "esp_err.h" #include "esp_err.h"
#include "soc/soc_memory_layout.h" #include "soc/soc_memory_layout.h"
#include "soc/cpu.h" #include "soc/cpu.h"
#include "esp_ota_ops.h"
// RU: Размер буфера для конвертации даты и времeни в строку // RU: Размер буфера для конвертации даты и времeни в строку
#define CONFIG_FORMAT_STRFTIME_BUFFER_SIZE 32 #define CONFIG_FORMAT_STRFTIME_BUFFER_SIZE 32
@@ -213,12 +212,11 @@ void printDebugTrace()
Serial.printf(CONFIG_MESSAGE_TG_VERSION_DEF, Serial.printf(CONFIG_MESSAGE_TG_VERSION_DEF,
jsonReadStr(settingsFlashJson, F("name")), ESP_getResetReason().c_str(), ESP32GetResetReason(0).c_str(), ESP32GetResetReason(1).c_str()); jsonReadStr(settingsFlashJson, F("name")), ESP_getResetReason().c_str(), ESP32GetResetReason(0).c_str(), ESP32GetResetReason(1).c_str());
} }
Serial.println(INFO_MESSAGE_DEBUG);
Serial.println(INFO_MESSAGE_DEBUG);
} }
void sendDebugTraceAndFreeMemory( bool postMsg) void sendDebugTraceAndFreeMemory(bool postMsg)
{ {
// esp_register_shutdown_handler(debugUpdate); // esp_register_shutdown_handler(debugUpdate);
re_restart_debug_t debug = debugGet(); re_restart_debug_t debug = debugGet();
@@ -265,27 +263,25 @@ void sendDebugTraceAndFreeMemory( bool postMsg)
} }
free(debug_heap); free(debug_heap);
} }
/* else /* else
{
// Serial.println("DEVICE START");
// Serial.printf(CONFIG_MESSAGE_TG_VERSION_DEF,
// FIRMWARE_VERSION, ESP_getResetReason().c_str(), ESP32GetResetReason(0).c_str(), ESP32GetResetReason(1).c_str());
if (tlgrmItem && isNetworkActive())
{ {
char *msg; // Serial.println("DEVICE START");
msg = malloc_stringf(CONFIG_MESSAGE_TG_VERSION_DEF, // Serial.printf(CONFIG_MESSAGE_TG_VERSION_DEF,
WiFi.localIP().toString(), FIRMWARE_VERSION, ESP_getResetReason().c_str(), ESP32GetResetReason(0).c_str(), ESP32GetResetReason(1).c_str()); // FIRMWARE_VERSION, ESP_getResetReason().c_str(), ESP32GetResetReason(0).c_str(), ESP32GetResetReason(1).c_str());
tlgrmItem->sendTelegramMsg(false, String(msg)); if (tlgrmItem && isNetworkActive())
free(msg); {
} char *msg;
};*/ msg = malloc_stringf(CONFIG_MESSAGE_TG_VERSION_DEF,
WiFi.localIP().toString(), FIRMWARE_VERSION, ESP_getResetReason().c_str(), ESP32GetResetReason(0).c_str(), ESP32GetResetReason(1).c_str());
tlgrmItem->sendTelegramMsg(false, String(msg));
free(msg);
}
};*/
} }
#else // RESTART_DEBUG_INFO
#else
void printDebugTrace() {} void printDebugTrace() {}
void sendDebugTraceAndFreeMemory(bool) {} void sendDebugTraceAndFreeMemory(bool) {}
void IRAM_ATTR debugUpdate() {} //void IRAM_ATTR debugUpdate() {}
extern "C" void __wrap_esp_panic_handler(void *info) extern "C" void __wrap_esp_panic_handler(void *info)
{ {
// Call the original panic handler function to finish processing this error (creating a core dump for example...) // Call the original panic handler function to finish processing this error (creating a core dump for example...)
@@ -293,33 +289,60 @@ extern "C" void __wrap_esp_panic_handler(void *info)
} }
#endif // RESTART_DEBUG_INFO #endif // RESTART_DEBUG_INFO
#if defined(ESP32)
extern "C" bool verifyRollbackLater(){ #include "esp_ota_ops.h"
Serial.printf("verifyRollbackLater OVERRIDDEN FUNCTION!");
return true;
}
void verifyFirmware(){ #include <esp_task_wdt.h>
Serial.printf("[SYSTEM] - Checking firmware...\n"); // 3 seconds WDT, reset in 1 seconds
const esp_partition_t *running = esp_ota_get_running_partition(); #define WDT_TIMEOUT 10
esp_ota_img_states_t ota_state;
if (esp_ota_get_state_partition(running, &ota_state) == ESP_OK) {
const char* otaState = ota_state == ESP_OTA_IMG_NEW ? "ESP_OTA_IMG_NEW"
: ota_state == ESP_OTA_IMG_PENDING_VERIFY ? "ESP_OTA_IMG_PENDING_VERIFY"
: ota_state == ESP_OTA_IMG_VALID ? "ESP_OTA_IMG_VALID"
: ota_state == ESP_OTA_IMG_INVALID ? "ESP_OTA_IMG_INVALID"
: ota_state == ESP_OTA_IMG_ABORTED ? "ESP_OTA_IMG_ABORTED"
: "ESP_OTA_IMG_UNDEFINED";
Serial.printf( "[System] - Ota state: %s\n",otaState);
if (ota_state == ESP_OTA_IMG_PENDING_VERIFY) { void startWatchDog()
if (esp_ota_mark_app_valid_cancel_rollback() == ESP_OK) { {
Serial.printf( "[System] - App is valid, rollback cancelled successfully\n"); esp_task_wdt_init(WDT_TIMEOUT, true); // enable panic so ESP32 restarts
} else { esp_task_wdt_add(NULL); // add current thread to WDT watch
Serial.printf("[System] - Failed to cancel rollback\n"); }
}
} extern "C" bool verifyRollbackLater()
}else{ {
Serial.printf("[System] - OTA partition has no record in OTA data\n"); Serial.printf("verifyRollbackLater OVERRIDDEN FUNCTION!");
return true;
}
void verifyFirmware()
{
Serial.printf("[SYSTEM] - Checking firmware...\n");
const esp_partition_t *running = esp_ota_get_running_partition();
esp_ota_img_states_t ota_state;
if (esp_ota_get_state_partition(running, &ota_state) == ESP_OK)
{
const char *otaState = ota_state == ESP_OTA_IMG_NEW ? "ESP_OTA_IMG_NEW"
: ota_state == ESP_OTA_IMG_PENDING_VERIFY ? "ESP_OTA_IMG_PENDING_VERIFY"
: ota_state == ESP_OTA_IMG_VALID ? "ESP_OTA_IMG_VALID"
: ota_state == ESP_OTA_IMG_INVALID ? "ESP_OTA_IMG_INVALID"
: ota_state == ESP_OTA_IMG_ABORTED ? "ESP_OTA_IMG_ABORTED"
: "ESP_OTA_IMG_UNDEFINED";
Serial.printf("[System] - Ota state: %s\n", otaState);
if (ota_state == ESP_OTA_IMG_PENDING_VERIFY)
{
if (esp_ota_mark_app_valid_cancel_rollback() == ESP_OK)
{
Serial.printf("[System] - App is valid, rollback cancelled successfully\n");
} }
} else
{
Serial.printf("[System] - Failed to cancel rollback\n");
}
}
}
else
{
Serial.printf("[System] - OTA partition has no record in OTA data\n");
}
}
#else //ESP32
void startWatchDog() {}
//extern "C" bool verifyRollbackLater() {}
void verifyFirmware() {}
#endif

View File

@@ -38,7 +38,7 @@ AsyncUDP asyncUdp;
void udpListningInit() { void udpListningInit() {
#if defined(LIBRETINY) #if defined(LIBRETINY)
if (asyncUdp.listenMulticast(IPAddress(239, 255, 255, 255), 4210/* , WiFi.localIP() */)) { if (asyncUdp.listenMulticast(IPAddress(239, 255, 255, 255), 4210 , WiFi.localIP() )) {
#else #else
if (asyncUdp.listenMulticast(IPAddress(239, 255, 255, 255), 4210)) { if (asyncUdp.listenMulticast(IPAddress(239, 255, 255, 255), 4210)) {
#endif #endif

View File

@@ -7,6 +7,9 @@
#include <Wire.h> #include <Wire.h>
#endif #endif
#include "DebugTrace.h" #include "DebugTrace.h"
#if defined(ESP32)
#include <esp_task_wdt.h>
#endif
#if defined(esp32s2_4mb) || defined(esp32s3_16mb) #if defined(esp32s2_4mb) || defined(esp32s3_16mb)
#include <USB.h> #include <USB.h>
#endif #endif
@@ -101,11 +104,13 @@ void setup() {
Serial.begin(115200); Serial.begin(115200);
Serial.flush(); Serial.flush();
//----------- Отладка EXCEPTION (функции с заглушками для отключения) --------- //----------- Отладка EXCEPTION (функции с заглушками для отключения) ---------
#if defined(RESTART_DEBUG_INFO) && defined(ESP32) && !defined(esp32c3m_4mb)
//Привязка коллбэк функции для вызова при перезагрузке //Привязка коллбэк функции для вызова при перезагрузке
esp_register_shutdown_handler(debugUpdate); esp_register_shutdown_handler(debugUpdate);
#endif // RESTART_DEBUG_INFO
// Печать или оправка отладочной информации // Печать или оправка отладочной информации
printDebugTrace(); printDebugTrace();
startWatchDog();
Serial.println(); Serial.println();
Serial.println(F("--------------started----------------")); Serial.println(F("--------------started----------------"));
@@ -151,7 +156,7 @@ void setup() {
#endif #endif
SerialPrint("i", "i2c", F("i2c pins overriding done")); SerialPrint("i", "i2c", F("i2c pins overriding done"));
} }
#if defined(RESTART_DEBUG_INFO) && defined(ESP32) && !defined(esp32c3m_4mb)
if (bootloop_panic_count >= 3) if (bootloop_panic_count >= 3)
{ {
resetSettingsFlashByPanic(); resetSettingsFlashByPanic();
@@ -162,7 +167,7 @@ void setup() {
SerialPrint("E", "CORE", F("CONFIG and SCENARIO reset !!!")); SerialPrint("E", "CORE", F("CONFIG and SCENARIO reset !!!"));
bootloop_panic_count = 0; bootloop_panic_count = 0;
} }
#endif // RESTART_DEBUG_INFO
// настраиваем микроконтроллер // настраиваем микроконтроллер
configure("/config.json"); configure("/config.json");
@@ -228,6 +233,11 @@ void setup() {
// настраиваем секундные обслуживания системы // настраиваем секундные обслуживания системы
ts.add( ts.add(
TIMES, 1000, [&](void *) { TIMES, 1000, [&](void *) {
// сброс WDT
#if defined(ESP32)
SerialPrint("i", "Task", "Resetting WDT...");
esp_task_wdt_reset();
#endif
// сохраняем значения IoTItems в файл каждую секунду, если были изменения (установлены маркеры на сохранение) // сохраняем значения IoTItems в файл каждую секунду, если были изменения (установлены маркеры на сохранение)
if (needSaveValues) { if (needSaveValues) {
syncValuesFlashJson(); syncValuesFlashJson();
@@ -248,7 +258,9 @@ void setup() {
Serial.println("--------test end---------"); Serial.println("--------test end---------");
stopErrorMarker(SETUPLAST_ERRORMARKER); stopErrorMarker(SETUPLAST_ERRORMARKER);
#if defined(RESTART_DEBUG_INFO) && defined(ESP32) && !defined(esp32c3m_4mb)
bootloop_panic_count = 0; bootloop_panic_count = 0;
#endif // RESTART_DEBUG_INFO
} }
void loop() { void loop() {

View File

@@ -8,7 +8,7 @@
#include "utils/SerialPrint.h" #include "utils/SerialPrint.h"
void ntpInit() { void ntpInit() {
#if defined(USE_LIBRETINY) #if defined(LIBRETINY)
if (sntp_enabled()) { if (sntp_enabled()) {
sntp_stop(); sntp_stop();
} }
@@ -23,6 +23,7 @@ void ntpInit() {
ts.add( ts.add(
TIME, 1000, [&](void*) { TIME, 1000, [&](void*) {
unixTime = getSystemTime(); unixTime = getSystemTime();
//SerialPrint("I", F("NTP"), "TIME " + String(unixTime));
if (unixTime < MIN_DATETIME) { if (unixTime < MIN_DATETIME) {
isTimeSynch = false; isTimeSynch = false;
// SerialPrint("E", "NTP", "Time not synched"); // SerialPrint("E", "NTP", "Time not synched");
@@ -62,8 +63,9 @@ void synchTime() {
// force resync // force resync
if (sntp_enabled()) { if (sntp_enabled()) {
sntp_stop(); sntp_stop();
}
sntp_init(); sntp_init();
}
#else #else
configTime(0, 0, "pool.ntp.org", "ru.pool.ntp.org", jsonReadStr(settingsFlashJson, F("ntp")).c_str()); configTime(0, 0, "pool.ntp.org", "ru.pool.ntp.org", jsonReadStr(settingsFlashJson, F("ntp")).c_str());
#endif #endif

View File

@@ -599,57 +599,52 @@ void handleFileList() {
if (path != "/" && !FileFS.exists(path)) { if (path != "/" && !FileFS.exists(path)) {
return replyBadRequest("BAD PATH"); return replyBadRequest("BAD PATH");
} }
FileFS.open(path.c_str());
lfs_dir_t dir;
struct lfs_info info;
int err = lfs_dir_open(FileFS.getFS(), &dir, path.c_str());
if (err) {
HTTP.send(500, "text/plain", "FAIL OPEN DIR");
return;
}
String output = "[";
while (true) {
int res = lfs_dir_read(FileFS.getFS(), &dir, &info);
if (res < 0) {
lfs_dir_close(FileFS.getFS(), &dir);
return ;
}
if (!res) {
break;
}
Serial.printf("%s %d", info.name, info.type);
lfs_dir_t dir; if (output != "[") {
struct lfs_info info; output += ',';
int err = lfs_dir_open(&lfs, &dir, path); }
if (err) { output += "{\"type\":\"";
HTTP.send(500, "text/plain", "FAIL OPEN DIR"); // output += (file.isDirectory()) ? "dir" : "file";
return; if (info.type == LFS_TYPE_DIR) {
} output += "dir";
String output = "["; } else {
while (true) { output += F("file\",\"size\":\"");
int res = lfs_dir_read(&lfs, &dir, &info); output += info.size;
if (res < 0) { }
lfs_dir_close(&lfs, &dir);
return err; output += "\",\"name\":\"";
} output += String(info.name);
output += "\"}";
if (!res) { //file = root.openNextFile();
break;
}
Serial.printf("%s %d", info.name, info.type);
if (output != "[") {
output += ',';
}
output += "{\"type\":\"";
// output += (file.isDirectory()) ? "dir" : "file";
if (info.type == LFS_TYPE_DIR) {
output += "dir";
} else {
output += F("file\",\"size\":\"");
output += info.size;
} }
output += "\",\"name\":\""; err = lfs_dir_close(FileFS.getFS(), &dir);
output += String(info.name); if (err) {
output += "\"}"; HTTP.send(500, "text/plain", "FAIL CLOSE DIR");
//file = root.openNextFile(); return;
}
}
err = lfs_dir_close(&lfs, &dir);
if (err) {
HTTP.send(500, "text/plain", "FAIL CLOSE DIR");
return;
}
output += "]"; output += "]";
HTTP.send(200, "text/json", output); HTTP.send(200, "text/json", output);

View File

@@ -5,43 +5,15 @@ void* getAPI_Loging(String subtype, String params);
void* getAPI_LogingDaily(String subtype, String params); void* getAPI_LogingDaily(String subtype, String params);
void* getAPI_IoTMath(String subtype, String params); void* getAPI_IoTMath(String subtype, String params);
void* getAPI_owmWeather(String subtype, String params); void* getAPI_owmWeather(String subtype, String params);
void* getAPI_Ping(String subtype, String params);
void* getAPI_Timer(String subtype, String params); void* getAPI_Timer(String subtype, String params);
void* getAPI_Variable(String subtype, String params); void* getAPI_Variable(String subtype, String params);
void* getAPI_VButton(String subtype, String params); void* getAPI_VButton(String subtype, String params);
void* getAPI_A02Distance(String subtype, String params);
void* getAPI_Acs712(String subtype, String params);
void* getAPI_AhtXX(String subtype, String params);
void* getAPI_AnalogAdc(String subtype, String params); void* getAPI_AnalogAdc(String subtype, String params);
void* getAPI_BL0937(String subtype, String params); void* getAPI_BL0937(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_Impulse(String subtype, String params);
void* getAPI_MQgas(String subtype, String params);
void* getAPI_Pzem004_v2(String subtype, String params);
void* getAPI_RTC(String subtype, String params);
void* getAPI_S8(String subtype, String params);
void* getAPI_Sht20(String subtype, String params);
void* getAPI_Sht30(String subtype, String params);
void* getAPI_Sonar(String subtype, String params);
void* getAPI_UART(String subtype, String params); void* getAPI_UART(String subtype, String params);
void* getAPI_AnalogBtn(String subtype, String params); void* getAPI_AnalogBtn(String subtype, String params);
void* getAPI_ButtonIn(String subtype, String params); void* getAPI_ButtonIn(String subtype, String params);
void* getAPI_ButtonOut(String subtype, String params); void* getAPI_ButtonOut(String subtype, String params);
void* getAPI_Buzzer(String subtype, String params);
void* getAPI_Encoder(String subtype, String params);
void* getAPI_IoTServo(String subtype, String params);
void* getAPI_Mcp23017(String subtype, String params);
void* getAPI_Mp3(String subtype, String params);
void* getAPI_Multitouch(String subtype, String params);
void* getAPI_Pcf8574(String subtype, String params);
void* getAPI_Pwm8266(String subtype, String params);
void* getAPI_TelegramLT(String subtype, String params);
void* getAPI_DwinI(String subtype, String params);
void* getAPI_Lcd2004(String subtype, String params);
void* getAPI_Oled64(String subtype, String params);
void* getAPI(String subtype, String params) { void* getAPI(String subtype, String params) {
void* tmpAPI; void* tmpAPI;
@@ -50,42 +22,14 @@ if ((tmpAPI = getAPI_Loging(subtype, params)) != nullptr) return tmpAPI;
if ((tmpAPI = getAPI_LogingDaily(subtype, params)) != nullptr) return tmpAPI; if ((tmpAPI = getAPI_LogingDaily(subtype, params)) != nullptr) return tmpAPI;
if ((tmpAPI = getAPI_IoTMath(subtype, params)) != nullptr) return tmpAPI; if ((tmpAPI = getAPI_IoTMath(subtype, params)) != nullptr) return tmpAPI;
if ((tmpAPI = getAPI_owmWeather(subtype, params)) != nullptr) return tmpAPI; if ((tmpAPI = getAPI_owmWeather(subtype, params)) != nullptr) return tmpAPI;
if ((tmpAPI = getAPI_Ping(subtype, params)) != nullptr) return tmpAPI;
if ((tmpAPI = getAPI_Timer(subtype, params)) != nullptr) return tmpAPI; if ((tmpAPI = getAPI_Timer(subtype, params)) != nullptr) return tmpAPI;
if ((tmpAPI = getAPI_Variable(subtype, params)) != nullptr) return tmpAPI; if ((tmpAPI = getAPI_Variable(subtype, params)) != nullptr) return tmpAPI;
if ((tmpAPI = getAPI_VButton(subtype, params)) != nullptr) return tmpAPI; if ((tmpAPI = getAPI_VButton(subtype, params)) != nullptr) return tmpAPI;
if ((tmpAPI = getAPI_A02Distance(subtype, params)) != nullptr) return tmpAPI;
if ((tmpAPI = getAPI_Acs712(subtype, params)) != nullptr) return tmpAPI;
if ((tmpAPI = getAPI_AhtXX(subtype, params)) != nullptr) return tmpAPI;
if ((tmpAPI = getAPI_AnalogAdc(subtype, params)) != nullptr) return tmpAPI; if ((tmpAPI = getAPI_AnalogAdc(subtype, params)) != nullptr) return tmpAPI;
if ((tmpAPI = getAPI_BL0937(subtype, params)) != nullptr) return tmpAPI; if ((tmpAPI = getAPI_BL0937(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_Impulse(subtype, params)) != nullptr) return tmpAPI;
if ((tmpAPI = getAPI_MQgas(subtype, params)) != nullptr) return tmpAPI;
if ((tmpAPI = getAPI_Pzem004_v2(subtype, params)) != nullptr) return tmpAPI;
if ((tmpAPI = getAPI_RTC(subtype, params)) != nullptr) return tmpAPI;
if ((tmpAPI = getAPI_S8(subtype, params)) != nullptr) return tmpAPI;
if ((tmpAPI = getAPI_Sht20(subtype, params)) != nullptr) return tmpAPI;
if ((tmpAPI = getAPI_Sht30(subtype, params)) != nullptr) return tmpAPI;
if ((tmpAPI = getAPI_Sonar(subtype, params)) != nullptr) return tmpAPI;
if ((tmpAPI = getAPI_UART(subtype, params)) != nullptr) return tmpAPI; if ((tmpAPI = getAPI_UART(subtype, params)) != nullptr) return tmpAPI;
if ((tmpAPI = getAPI_AnalogBtn(subtype, params)) != nullptr) return tmpAPI; if ((tmpAPI = getAPI_AnalogBtn(subtype, params)) != nullptr) return tmpAPI;
if ((tmpAPI = getAPI_ButtonIn(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_ButtonOut(subtype, params)) != nullptr) return tmpAPI;
if ((tmpAPI = getAPI_Buzzer(subtype, params)) != nullptr) return tmpAPI;
if ((tmpAPI = getAPI_Encoder(subtype, params)) != nullptr) return tmpAPI;
if ((tmpAPI = getAPI_IoTServo(subtype, params)) != nullptr) return tmpAPI;
if ((tmpAPI = getAPI_Mcp23017(subtype, params)) != nullptr) return tmpAPI;
if ((tmpAPI = getAPI_Mp3(subtype, params)) != nullptr) return tmpAPI;
if ((tmpAPI = getAPI_Multitouch(subtype, params)) != nullptr) return tmpAPI;
if ((tmpAPI = getAPI_Pcf8574(subtype, params)) != nullptr) return tmpAPI;
if ((tmpAPI = getAPI_Pwm8266(subtype, params)) != nullptr) return tmpAPI;
if ((tmpAPI = getAPI_TelegramLT(subtype, params)) != nullptr) return tmpAPI;
if ((tmpAPI = getAPI_DwinI(subtype, params)) != nullptr) return tmpAPI;
if ((tmpAPI = getAPI_Lcd2004(subtype, params)) != nullptr) return tmpAPI;
if ((tmpAPI = getAPI_Oled64(subtype, params)) != nullptr) return tmpAPI;
return nullptr; return nullptr;
} }