feat: added get mac address
This commit is contained in:
parent
1391c9b3c1
commit
6e508c49b0
@ -86,8 +86,11 @@ void app_main(void)
|
|||||||
strcpy(send_message.char_value, "THIS IS A CHAR");
|
strcpy(send_message.char_value, "THIS IS A CHAR");
|
||||||
send_message.float_value = 1.234;
|
send_message.float_value = 1.234;
|
||||||
send_message.bool_value = false;
|
send_message.bool_value = false;
|
||||||
printf("Used ESP-NOW version %d.\n", zh_espnow_get_version());
|
printf("ESP-NOW version %d.\n", zh_espnow_get_version());
|
||||||
printf("ESP-NOW channel %d. \n", zh_espnow_get_channel());
|
printf("ESP-NOW channel %d. \n", zh_espnow_get_channel());
|
||||||
|
uint8_t node_mac[6] = {0};
|
||||||
|
zh_espnow_get_mac(node_mac);
|
||||||
|
printf("ESP-NOW MAC %02X:%02X:%02X:%02X:%02X:%02X.\n", MAC2STR(node_mac));
|
||||||
uint8_t counter = 0;
|
uint8_t counter = 0;
|
||||||
for (;;)
|
for (;;)
|
||||||
{
|
{
|
||||||
|
@ -171,13 +171,22 @@ extern "C"
|
|||||||
* @brief Set battery mode.
|
* @brief Set battery mode.
|
||||||
*
|
*
|
||||||
* @param[in] battery_mode True to enable the mode false to disable it.
|
* @param[in] battery_mode True to enable the mode false to disable it.
|
||||||
*
|
*
|
||||||
* @note If true the node does not receive messages.
|
* @note If true the node does not receive messages.
|
||||||
*
|
*
|
||||||
* @return ESP_OK if success or an error code otherwise.
|
* @return ESP_OK if success or an error code otherwise.
|
||||||
*/
|
*/
|
||||||
esp_err_t zh_espnow_set_battery_mode(bool battery_mode);
|
esp_err_t zh_espnow_set_battery_mode(bool battery_mode);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Get MAC address of the node.
|
||||||
|
*
|
||||||
|
* @param[out] mac_addr Pointer to a buffer containing an eight-byte MAC.
|
||||||
|
*
|
||||||
|
* @return ESP_OK if success or an error code otherwise.
|
||||||
|
*/
|
||||||
|
esp_err_t zh_espnow_get_mac(uint8_t *mac_addr);
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
@ -1 +1 @@
|
|||||||
1.6.0
|
1.7.0
|
@ -592,4 +592,9 @@ esp_err_t zh_espnow_set_battery_mode(bool battery_mode)
|
|||||||
_init_config.battery_mode = battery_mode;
|
_init_config.battery_mode = battery_mode;
|
||||||
ZH_ESPNOW_LOGI("Battery mode set successfully.");
|
ZH_ESPNOW_LOGI("Battery mode set successfully.");
|
||||||
return ESP_OK;
|
return ESP_OK;
|
||||||
|
}
|
||||||
|
|
||||||
|
esp_err_t zh_espnow_get_mac(uint8_t *mac_addr)
|
||||||
|
{
|
||||||
|
return esp_wifi_get_mac(_init_config.wifi_interface, mac_addr);
|
||||||
}
|
}
|
Loading…
x
Reference in New Issue
Block a user