#include "utils.h" #include #include #include #include #include #include #include "logger.h" char* getNextArg(char* args, const char separator) { uint8_t step = 0; uint8_t end = 0; // find next argument separator while (end == 0) { if (step < 255) { if (*(args + step) == separator) { // found end = 1; } else if ( *(args + step) == '\n' || *(args + step) == '\r' || *(args + step) == '\0' ) { // end of line end = 2; } } else { end = 3; // line to long } step++; } if (end == 1) { // argument separator found // find first char of argument while (end == 1) { if (step < 255) { if (*(args + step) != separator) { // found end = 10; } else if ( *(args + step) != '\n' && *(args + step) != '\r' && *(args + step) != '\0' ) { // end of line end = 11; } else { step++; } } else { end = 3; // line to long } } if (end == 10) { // start of next argument found return args + step; } else { // no new argument found return NULL; } } else { // is was the last argument (or the arguments is longer then 254 bytes) return NULL; } } void printChipInfo() { esp_chip_info_t chip_info; uint32_t flash_size; esp_chip_info(&chip_info); LOG_D("This is %s chip with %d CPU core(s), %s%s%s%s", CONFIG_IDF_TARGET, chip_info.cores, (chip_info.features & CHIP_FEATURE_WIFI_BGN) ? "WiFi/" : "", (chip_info.features & CHIP_FEATURE_BT) ? "BT" : "", (chip_info.features & CHIP_FEATURE_BLE) ? "BLE" : "", (chip_info.features & CHIP_FEATURE_IEEE802154) ? ", 802.15.4 (Zigbee/Thread)" : "" ); unsigned major_rev = chip_info.revision / 100; unsigned minor_rev = chip_info.revision % 100; LOG_D("silicon revision v%d.%d", major_rev, minor_rev); if(esp_flash_get_size(NULL, &flash_size) != ESP_OK) { LOG_W("Get flash size failed"); return; } LOG_D("%" PRIu32 "MB %s flash", flash_size / (uint32_t)(1024 * 1024), (chip_info.features & CHIP_FEATURE_EMB_FLASH) ? "embedded" : "external" ); LOG_D("Minimum free heap size: %" PRIu32 " bytes", esp_get_minimum_free_heap_size()); }