• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

C++ ESP_LOGD函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了C++中ESP_LOGD函数的典型用法代码示例。如果您正苦于以下问题:C++ ESP_LOGD函数的具体用法?C++ ESP_LOGD怎么用?C++ ESP_LOGD使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。



在下文中一共展示了ESP_LOGD函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。

示例1: http_on_headers_complete

static int http_on_headers_complete(http_parser *parser)
{
    esp_http_client_handle_t client = parser->data;
    client->response->status_code = parser->status_code;
    client->response->data_offset = parser->nread;
    client->response->content_length = parser->content_length;
    client->response->data_process = 0;
    ESP_LOGD(TAG, "http_on_headers_complete, status=%d, offset=%d, nread=%d", parser->status_code, client->response->data_offset, parser->nread);
    client->state = HTTP_STATE_RES_COMPLETE_HEADER;
    return 0;
}
开发者ID:xieweimin,项目名称:esp-adf,代码行数:11,代码来源:esp_http_client.c


示例2: ESP_LOGD

/**
 * @brief Begin a new %I2C transaction.
 *
 * Begin a transaction by adding an %I2C start to the queue.
 * @return N/A.
 */
void I2C::beginTransaction() {
	if (debug) {
		ESP_LOGD(LOG_TAG, "beginTransaction()");
	}
	m_cmd = ::i2c_cmd_link_create();
	esp_err_t errRc = ::i2c_master_start(m_cmd);
	if (errRc != ESP_OK) {
		ESP_LOGE(LOG_TAG, "i2c_master_start: rc=%d %s", errRc, GeneralUtils::errorToString(errRc));
	}
	m_directionKnown = false;
} // beginTransaction
开发者ID:hliebscher,项目名称:esp32-snippets,代码行数:17,代码来源:I2C.cpp


示例3: ESP_LOGD

/**
 * @brief Create a %BLE Service.
 *
 * With a %BLE server, we can host one or more services.  Invoking this function causes the creation of a definition
 * of a new service.  Every service must have a unique UUID.
 * @param [in] uuid The UUID of the new service.
 * @param [in] numHandles The maximum number of handles associated with this service.
 * @param [in] inst_id With multiple services with the same UUID we need to provide inst_id value different for each service.
 * @return A reference to the new service object.
 */
BLEService* BLEServer::createService(BLEUUID uuid, uint32_t numHandles, uint8_t inst_id) {
	ESP_LOGD(LOG_TAG, ">> createService - %s", uuid.toString().c_str());
	m_semaphoreCreateEvt.take("createService");

	// Check that a service with the supplied UUID does not already exist.
	if (m_serviceMap.getByUUID(uuid) != nullptr) {
		ESP_LOGW(LOG_TAG, "<< Attempt to create a new service with uuid %s but a service with that UUID already exists.",
			uuid.toString().c_str());
	}

	BLEService* pService = new BLEService(uuid, numHandles);
	pService->m_instId = inst_id;
	m_serviceMap.setByUUID(uuid, pService); // Save a reference to this service being on this server.
	pService->executeCreate(this);          // Perform the API calls to actually create the service.

	m_semaphoreCreateEvt.wait("createService");

	ESP_LOGD(LOG_TAG, "<< createService");
	return pService;
} // createService
开发者ID:xbed,项目名称:Mixly_Arduino,代码行数:30,代码来源:BLEServer.cpp


示例4: ESP_LOGD

/**
 * @brief Publish a message.
 * Publish a message on the given topic.
 *
 * @param [in] topic The topic against which we wish to publish.
 * @param [in] payload The payload of the message we wish to publish.
 * @param [in] qos The quality of service for the publish.
 * @return N/A.
 */
void AWS::publish(std::string topic, std::string payload, QoS qos) {
	IoT_Publish_Message_Params message;
	message.payload = (void *)payload.data();
	message.payloadLen = payload.length();
	message.qos = qos;
	message.isRetained = 0;
	IoT_Error_t err = ::aws_iot_mqtt_publish(&m_client, topic.c_str(), topic.length(), &message);
	if (err != SUCCESS) {
		ESP_LOGD(tag, "aws_iot_mqtt_publish: error=%d", err);
	}
} // publish
开发者ID:EdWeller,项目名称:esp32-snippets,代码行数:20,代码来源:AWS.cpp


示例5: run

	void run(void *data) {
		ESP_LOGD(tag, "Testing curl ...");
		RESTClient client;

		/**
		 * Test POST
		 */

		RESTTimings *timings = client.getTimings();

		client.setURL("https://httpbin.org/post");
		client.addHeader("Content-Type", "application/json");
		client.post("hello world!");
		ESP_LOGD(tag, "Result: %s", client.getResponse().c_str());
		timings->refresh();
		ESP_LOGD(tag, "timings: %s", timings->toString().c_str());

		printf("Tests done\n");
		return;
	}
开发者ID:EdWeller,项目名称:esp32-snippets,代码行数:20,代码来源:test_rest.cpp


示例6: get_wlan

STATIC mp_obj_t get_wlan(size_t n_args, const mp_obj_t *args) {
    static int initialized = 0;
    if (!initialized) {
        wifi_init_config_t cfg = WIFI_INIT_CONFIG_DEFAULT();
        ESP_LOGD("modnetwork", "Initializing WiFi");
        ESP_EXCEPTIONS( esp_wifi_init(&cfg) );
        ESP_EXCEPTIONS( esp_wifi_set_storage(WIFI_STORAGE_RAM) );
        ESP_LOGD("modnetwork", "Initialized");
        initialized = 1;
    }

    int idx = (n_args > 0) ? mp_obj_get_int(args[0]) : WIFI_IF_STA;
    if (idx == WIFI_IF_STA) {
        return MP_OBJ_FROM_PTR(&wlan_sta_obj);
    } else if (idx == WIFI_IF_AP) {
        return MP_OBJ_FROM_PTR(&wlan_ap_obj);
    } else {
        mp_raise_ValueError("invalid WLAN interface identifier");
    }
}
开发者ID:pfalcon,项目名称:micropython,代码行数:20,代码来源:modnetwork.c


示例7: while

/**
 * @brief Accept an incoming connection.
 * @private
 *
 * Block waiting for an incoming connection and accept it when it arrives.  The new
 * socket is placed on a queue and a semaphore signaled that a new client is available.
 */
/* static */ void SockServ::acceptTask(void* data) {
	SockServ* pSockServ = (SockServ*)data;
	try {
		while(1) {
			ESP_LOGD(LOG_TAG, "Waiting on accept")
			Socket tempSock = pSockServ->m_serverSocket.accept();
			if (!tempSock.isValid()) {
				continue;
			}

			pSockServ->m_clientSet.insert(tempSock);
			xQueueSendToBack(pSockServ->m_acceptQueue, &tempSock, portMAX_DELAY);
			pSockServ->m_clientSemaphore.give();
		}
	} catch(std::exception e) {
		ESP_LOGD(LOG_TAG, "acceptTask ending");
		pSockServ->m_clientSemaphore.give();   // Wake up any waiting clients.
		FreeRTOS::deleteTask();
	}
} // acceptTask
开发者ID:hliebscher,项目名称:esp32-snippets,代码行数:27,代码来源:SockServ.cpp


示例8: ESP_LOGD

/**
 * @brief Create the service.
 * Create the service.
 * @param [in] gatts_if The handle of the GATT server interface.
 * @return N/A.
 */
void BLEService::executeCreate(BLEServer *pServer) {
	ESP_LOGD(LOG_TAG, ">> executeCreate() - Creating service (esp_ble_gatts_create_service) service uuid: %s", getUUID().toString().c_str());

	m_pServer          = pServer;
	esp_gatt_srvc_id_t srvc_id;
	srvc_id.id.inst_id = 0;
	srvc_id.id.uuid    = *m_uuid.getNative();

	m_semaphoreCreateEvt.take("executeCreate"); // Take the mutex and release at event ESP_GATTS_CREATE_EVT

	esp_err_t errRc = ::esp_ble_gatts_create_service(getServer()->getGattsIf(), &srvc_id, 10);

	if (errRc != ESP_OK) {
		ESP_LOGE(LOG_TAG, "esp_ble_gatts_create_service: rc=%d %s", errRc, GeneralUtils::errorToString(errRc));
		return;
	}

	m_semaphoreCreateEvt.wait("executeCreate");

	ESP_LOGD(LOG_TAG, "<< executeCreate");
} // executeCreate
开发者ID:EdWeller,项目名称:esp32-snippets,代码行数:27,代码来源:BLEService.cpp


示例9: check_working_socket

int check_working_socket()
{
    int ret;
#if EXAMPLE_ESP_TCP_MODE_SERVER
    ESP_LOGD(TAG, "check server_socket");
    ret = get_socket_error_code(server_socket);
    if(ret != 0) {
	ESP_LOGW(TAG, "server socket error %d %s", ret, strerror(ret));
    }
    if(ret == ECONNRESET)
	return ret;
#endif
    ESP_LOGD(TAG, "check connect_socket");
    ret = get_socket_error_code(connect_socket);
    if(ret != 0) {
	ESP_LOGW(TAG, "connect socket error %d %s", ret, strerror(ret));
    }
    if(ret != 0)
	return ret;
    return 0;
}
开发者ID:Exchizz,项目名称:esp-idf,代码行数:21,代码来源:tcp_perf.c


示例10: bootloader_common_erase_part_type_data

bool bootloader_common_erase_part_type_data(const char *list_erase, bool ota_data_erase)
{
    const esp_partition_info_t *partitions;
    const char *marker;
    esp_err_t err;
    int num_partitions;
    bool ret = true;

    partitions = bootloader_mmap(ESP_PARTITION_TABLE_OFFSET, ESP_PARTITION_TABLE_MAX_LEN);
    if (!partitions) {
        ESP_LOGE(TAG, "bootloader_mmap(0x%x, 0x%x) failed", ESP_PARTITION_TABLE_OFFSET, ESP_PARTITION_TABLE_MAX_LEN);
        return false;
    }
    ESP_LOGD(TAG, "mapped partition table 0x%x at 0x%x", ESP_PARTITION_TABLE_OFFSET, (intptr_t)partitions);

    err = esp_partition_table_verify(partitions, true, &num_partitions);
    if (err != ESP_OK) {
        ESP_LOGE(TAG, "Failed to verify partition table");
        ret = false;
    } else {
        ESP_LOGI(TAG, "## Label            Usage Offset   Length   Cleaned");
        for (int i = 0; i < num_partitions; i++) {
            const esp_partition_info_t *partition = &partitions[i];
            char label[sizeof(partition->label) + 1] = {0};
            if (partition->type == PART_TYPE_DATA) {
                bool fl_ota_data_erase = false;
                if (ota_data_erase == true && partition->subtype == PART_SUBTYPE_DATA_OTA) {
                    fl_ota_data_erase = true;
                }
                // partition->label is not null-terminated string.
                strncpy(label, (char *)&partition->label, sizeof(label) - 1);
                if (fl_ota_data_erase == true || (bootloader_common_label_search(list_erase, label) == true)) {
                    err = bootloader_flash_erase_range(partition->pos.offset, partition->pos.size);
                    if (err != ESP_OK) {
                        ret = false;
                        marker = "err";
                    } else {
                        marker = "yes";
                    }
                } else {
                    marker = "no";
                }

                ESP_LOGI(TAG, "%2d %-16s data  %08x %08x [%s]", i, partition->label,
                         partition->pos.offset, partition->pos.size, marker);
            }
        }
    }

    bootloader_munmap(partitions);

    return ret;
}
开发者ID:tve,项目名称:esp-idf,代码行数:53,代码来源:bootloader_common.c


示例11: ESP_LOGD

/**
 * @brief Get the service object corresponding to the uuid.
 * @param [in] uuid The UUID of the service being sought.
 * @return A reference to the Service or nullptr if don't know about it.
 * @throws BLEUuidNotFound
 */
BLERemoteService* BLEClient::getService(BLEUUID uuid) {
	ESP_LOGD(LOG_TAG, ">> getService: uuid: %s", uuid.toString().c_str());
// Design
// ------
// We wish to retrieve the service given its UUID.  It is possible that we have not yet asked the
// device what services it has in which case we have nothing to match against.  If we have not
// asked the device about its services, then we do that now.  Once we get the results we can then
// examine the services map to see if it has the service we are looking for.
	if (!m_haveServices) {
		getServices();
	}
	std::string uuidStr = uuid.toString();
	for (auto &myPair : m_servicesMap) {
		if (myPair.first == uuidStr) {
			ESP_LOGD(LOG_TAG, "<< getService: found the service with uuid: %s", uuid.toString().c_str());
			return myPair.second;
		}
	} // End of each of the services.
	ESP_LOGD(LOG_TAG, "<< getService: not found");
	return nullptr;
} // getService
开发者ID:xbed,项目名称:Mixly_Arduino,代码行数:27,代码来源:BLEClient.cpp


示例12: stream

/**
 * @brief Return the constituent parts of the path.
 * If we imagine a path as composed of parts separated by slashes, then this function
 * returns a vector composed of the parts.  For example:
 *
 * ```
 * /x/y/z
 * ```
 * will break out to:
 *
 * ```
 * path[0] = ""
 * path[1] = "x"
 * path[2] = "y"
 * path[3] = "z"
 * ```
 *
 * @return A vector of the constituent parts of the path.
 */
std::vector<std::string> FileSystem::pathSplit(std::string path) {
	std::istringstream stream(path);
	std::vector<std::string> ret;
	std::string pathPart;
	while (std::getline(stream, pathPart, '/')) {
		ret.push_back(pathPart);
	}
	// Debug
	for (int i = 0; i < ret.size(); i++) {
		ESP_LOGD(LOG_TAG, "part[%d]: %s", i, ret[i].c_str());
	}
	return ret;
} // pathSplit
开发者ID:pilate,项目名称:esp32-snippets,代码行数:32,代码来源:FileSystem.cpp


示例13: stream

/**
 * @brief Return the constituent parts of the path.
 * If we imagine a path as composed of parts separated by slashes, then this function
 * returns a vector composed of the parts.  For example:
 *
 * ```
 * /x/y/z
 * ```
 * will break out to:
 *
 * ```
 * path[0] = ""
 * path[1] = "x"
 * path[2] = "y"
 * path[3] = "z"
 * ```
 *
 * @return A vector of the constituent parts of the path.
 */
std::vector<std::string> WebServer::HTTPRequest::pathSplit() {
	std::istringstream stream(getPath());
	std::vector<std::string> ret;
	std::string pathPart;
	while(std::getline(stream, pathPart, '/')) {
		ret.push_back(pathPart);
	}
	// Debug
	for (int i=0; i<ret.size(); i++) {
		ESP_LOGD(tag, "part[%d]: %s", i, ret[i].c_str());
	}
	return ret;
} // pathSplit
开发者ID:EdWeller,项目名称:esp32-snippets,代码行数:32,代码来源:WebServer.cpp


示例14: stream

/**
 * @brief Return the constituent parts of the path.
 * If we imagine a path as composed of parts separated by slashes, then this function
 * returns a vector composed of the parts.  For example:
 *
 * ```
 * /x/y/z
 * ```
 * will break out to:
 *
 * ```
 * path[0] = ""
 * path[1] = "x"
 * path[2] = "y"
 * path[3] = "z"
 * ```
 *
 * @return A vector of the constituent parts of the path.
 */
std::vector<std::string> WebServer::HTTPRequest::pathSplit() const {
	std::istringstream stream(std::string(getPath(), getPathLen())); // I don't know if there's a better istringstream constructor for this
	std::vector<std::string> ret;
	std::string pathPart;
	while (std::getline(stream, pathPart, '/')) {
		ret.push_back(pathPart);
	}
	// Debug
	for (int i = 0; i < ret.size(); i++) {
		ESP_LOGD(LOG_TAG, "part[%d]: %s", i, ret[i].c_str());
	}
	return ret;
} // pathSplit
开发者ID:pilate,项目名称:esp32-snippets,代码行数:32,代码来源:WebServer.cpp


示例15: ESP_LOGD

// A request Line is built from:
// <method> <sp> <request-target> <sp> <HTTP-version>
//
void HttpParser::parseRequestLine(std::string &line) {
	ESP_LOGD(LOG_TAG, ">> parseRequestLine: %s [%d]", line.c_str(), line.length());
	std::string::iterator it = line.begin();

	// Get the method
	m_method = toCharToken(it, line, ' ');

	// Get the url
	m_url = toCharToken(it, line, ' ');

	// Get the version
	m_version = toCharToken(it, line, ' ');
} // parseRequestLine
开发者ID:EdWeller,项目名称:esp32-snippets,代码行数:16,代码来源:HttpParser.cpp


示例16: periph_sdcard_mount

esp_err_t periph_sdcard_mount(esp_periph_handle_t periph)
{
    VALIDATE_SDCARD(periph, ESP_FAIL);

    periph_sdcard_t *sdcard = esp_periph_get_data(periph);

    int ret = sdcard_mount(sdcard->root);

    if (ret == ESP_OK) {
        ESP_LOGD(TAG, "Mount SDCARD success");
        sdcard->is_mounted = true;
        return esp_periph_send_event(periph, SDCARD_STATUS_MOUNTED, NULL, 0);
    } else if (ret == ESP_ERR_INVALID_STATE) {
        ESP_LOGD(TAG, "periph sdcard handle already mounted!");
        return ESP_OK;
    } else {
        esp_periph_send_event(periph, SDCARD_STATUS_MOUNT_ERROR, NULL, 0);
        sdcard->is_mounted = false;
        ESP_LOGE(TAG, "mount sdcard error!");
        return ESP_FAIL;
    }
}
开发者ID:xieweimin,项目名称:esp-adf,代码行数:22,代码来源:periph_sdcard.c


示例17: mgStrToString

/**
 * @brief Process an incoming HTTP request.
 *
 * We look at the path of the request and see if it has a matching path handler.  If it does,
 * we invoke the handler function.  If it does not, we try and find a file on the file system
 * that would resolve to the path.
 *
 * @param [in] mgConnection The network connection on which the request was received.
 * @param [in] message The message representing the request.
 */
void WebServer::processRequest(struct mg_connection *mgConnection, struct http_message* message) {
	std::string uri = mgStrToString(message->uri);
	ESP_LOGD(tag, "WebServer::processRequest: Matching: %s", uri.c_str());
	HTTPResponse httpResponse = HTTPResponse(mgConnection);
	httpResponse.setRootPath(getRootPath());

	/*
	 * Iterate through each of the path handlers looking for a match with the method and specified path.
	 */
	std::vector<PathHandler>::iterator it;
	for (it = m_pathHandlers.begin(); it != m_pathHandlers.end(); ++it) {
		if ((*it).match(mgStrToString(message->method), uri)) {
			HTTPRequest httpRequest(message);
			(*it).invoke(&httpRequest, &httpResponse);
			ESP_LOGD(tag, "Found a match!!");
			return;
		}
	} // End of examine path handlers.

	// Because we reached here, it means that we did NOT match a handler.  Now we want to attempt
	// to retrieve the corresponding file content.
	std::string filePath = httpResponse.getRootPath() + uri;
	ESP_LOGD(tag, "Opening file: %s", filePath.c_str());
	FILE *file = fopen(filePath.c_str(), "r");
	if (file != nullptr) {
		fseek(file, 0L, SEEK_END);
		size_t length = ftell(file);
		fseek(file, 0L, SEEK_SET);
		uint8_t *pData = (uint8_t *)malloc(length);
		fread(pData, length, 1, file);
		fclose(file);
		httpResponse.sendData(pData, length);
		free(pData);
	} else {
		// Handle unable to open file
		httpResponse.setStatus(404); // Not found
		httpResponse.sendData("");
	}
} // processRequest
开发者ID:EdWeller,项目名称:esp32-snippets,代码行数:49,代码来源:WebServer.cpp


示例18: becomeStation

/**
 * Become a station connecting to an existing access point.
 */
static void becomeStation(connection_info_t *pConnectionInfo) {
	ESP_LOGD(tag, "- Connecting to access point \"%s\" ...", pConnectionInfo->ssid);
	assert(strlen(pConnectionInfo->ssid) > 0);

	// If we have a static IP address information, use that.
	if (pConnectionInfo->ipInfo.ip.addr != 0) {
		ESP_LOGD(tag, " - using a static IP address of " IPSTR, IP2STR(&pConnectionInfo->ipInfo.ip));
		tcpip_adapter_dhcpc_stop(TCPIP_ADAPTER_IF_STA);
		tcpip_adapter_set_ip_info(TCPIP_ADAPTER_IF_STA, &pConnectionInfo->ipInfo);
	} else {
		tcpip_adapter_dhcpc_start(TCPIP_ADAPTER_IF_STA);
	}

  ESP_ERROR_CHECK( esp_wifi_set_mode(WIFI_MODE_STA));
  wifi_config_t sta_config;
  sta_config.sta.bssid_set = 0;
  memcpy(sta_config.sta.ssid, pConnectionInfo->ssid, SSID_SIZE);
  memcpy(sta_config.sta.password, pConnectionInfo->password, PASSWORD_SIZE);
  ESP_ERROR_CHECK(esp_wifi_set_config(WIFI_IF_STA, &sta_config));
  ESP_ERROR_CHECK(esp_wifi_start());
  ESP_ERROR_CHECK(esp_wifi_connect());
} // becomeStation
开发者ID:EdWeller,项目名称:esp32-snippets,代码行数:25,代码来源:bootwifi.c


示例19: void

/**
 * @brief Register for notifications.
 * @param [in] notifyCallback A callback to be invoked for a notification.  If NULL is provided then we are
 * unregistering a notification.
 * @return N/A.
 */
void BLERemoteCharacteristic::registerForNotify(
		void (*notifyCallback)(
			BLERemoteCharacteristic* pBLERemoteCharacteristic,
			uint8_t*                 pData,
			size_t                   length,
			bool                     isNotify)) {
	ESP_LOGD(LOG_TAG, ">> registerForNotify(): %s", toString().c_str());

	m_notifyCallback = notifyCallback;   // Save the notification callback.

	m_semaphoreRegForNotifyEvt.take("registerForNotify");

	if (notifyCallback != nullptr) {   // If we have a callback function, then this is a registration.
		esp_err_t errRc = ::esp_ble_gattc_register_for_notify(
			m_pRemoteService->getClient()->getGattcIf(),
			*m_pRemoteService->getClient()->getPeerAddress().getNative(),
			getHandle()
		);

		if (errRc != ESP_OK) {
			ESP_LOGE(LOG_TAG, "esp_ble_gattc_register_for_notify: rc=%d %s", errRc, GeneralUtils::errorToString(errRc));
		}
	} // End Register
	else {   // If we weren't passed a callback function, then this is an unregistration.
		esp_err_t errRc = ::esp_ble_gattc_unregister_for_notify(
			m_pRemoteService->getClient()->getGattcIf(),
			*m_pRemoteService->getClient()->getPeerAddress().getNative(),
			getHandle()
		);

		if (errRc != ESP_OK) {
			ESP_LOGE(LOG_TAG, "esp_ble_gattc_unregister_for_notify: rc=%d %s", errRc, GeneralUtils::errorToString(errRc));
		}
	} // End Unregister

	m_semaphoreRegForNotifyEvt.wait("registerForNotify");

	ESP_LOGD(LOG_TAG, "<< registerForNotify()");
} // registerForNotify
开发者ID:LefterisAd,项目名称:esp32-snippets,代码行数:45,代码来源:BLERemoteCharacteristic.cpp


示例20: doGPS

void doGPS() {
	ESP_LOGD(tag, ">> doGPS");
	uart_config_t myUartConfig;
	myUartConfig.baud_rate           = 9600;
	myUartConfig.data_bits           = UART_DATA_8_BITS;
	myUartConfig.parity              = UART_PARITY_DISABLE;
	myUartConfig.stop_bits           = UART_STOP_BITS_1;
	myUartConfig.flow_ctrl           = UART_HW_FLOWCTRL_DISABLE;
	myUartConfig.rx_flow_ctrl_thresh = 120;

	uart_param_config(UART_NUM_1, &myUartConfig);

	uart_set_pin(UART_NUM_1,
			UART_PIN_NO_CHANGE, // TX
			GPS_TX_PIN,         // RX
			UART_PIN_NO_CHANGE, // RTS
			UART_PIN_NO_CHANGE  // CTS
  );

	uart_driver_install(UART_NUM_1, 2048, 2048, 10, 17, NULL);

	while(1) {
		char *line = readLine(UART_NUM_1);
		//ESP_LOGD(tag, "%s", line);
		switch(minmea_sentence_id(line, false)) {
		case MINMEA_SENTENCE_RMC:
			ESP_LOGD(tag, "Sentence - MINMEA_SENTENCE_RMC");
      struct minmea_sentence_rmc frame;
      if (minmea_parse_rmc(&frame, line)) {
          ESP_LOGD(tag, "$xxRMC: raw coordinates and speed: (%d/%d,%d/%d) %d/%d",
                  frame.latitude.value, frame.latitude.scale,
                  frame.longitude.value, frame.longitude.scale,
                  frame.speed.value, frame.speed.scale);
          ESP_LOGD(tag, "$xxRMC fixed-point coordinates and speed scaled to three decimal places: (%d,%d) %d",
                  minmea_rescale(&frame.latitude, 1000),
                  minmea_rescale(&frame.longitude, 1000),
                  minmea_rescale(&frame.speed, 1000));
          ESP_LOGD(tag, "$xxRMC floating point degree coordinates and speed: (%f,%f) %f",
                  minmea_tocoord(&frame.latitude),
                  minmea_tocoord(&frame.longitude),
                  minmea_tofloat(&frame.speed));
      }
      else {
      	ESP_LOGD(tag, "$xxRMC sentence is not parsed\n");
      }
			break;
		case MINMEA_SENTENCE_GGA:
			//ESP_LOGD(tag, "Sentence - MINMEA_SENTENCE_GGA");
			break;
		case MINMEA_SENTENCE_GSV:
			//ESP_LOGD(tag, "Sentence - MINMEA_SENTENCE_GSV");
			break;
		default:
			//ESP_LOGD(tag, "Sentence - other");
			break;
		}
	}
} // doGPS
开发者ID:EdWeller,项目名称:esp32-snippets,代码行数:58,代码来源:gps.c



注:本文中的ESP_LOGD函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C++ ESP_LOGE函数代码示例发布时间:2022-05-30
下一篇:
C++ ESP_ERROR_CHECK函数代码示例发布时间:2022-05-30
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap