We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
这里的移除函数的处理是否有问题呢?在control组件中,有一个esp_err_t espnow_ctrl_responder_remove_bindlist(const espnow_ctrl_bind_info_t *info)函数,是这样的 esp_err_t espnow_ctrl_responder_remove_bindlist(const espnow_ctrl_bind_info_t *info) { espnow_load_bindlist(); for (int i = 0; i < g_bindlist.size; ++i) { if (!memcmp(g_bindlist.data + i, info, sizeof(espnow_ctrl_bind_info_t))) { g_bindlist.size--;
if (g_bindlist.size > 0) { g_bindlist.data[g_bindlist.size].initiator_attribute = info->initiator_attribute; memcpy(g_bindlist.data[g_bindlist.size].mac, info->mac, 6); } espnow_storage_set("bindlist", &g_bindlist, sizeof(g_bindlist)); break; }
}
return ESP_OK; } 其中 if (g_bindlist.size > 0) { g_bindlist.data[g_bindlist.size].initiator_attribute = info->initiator_attribute; memcpy(g_bindlist.data[g_bindlist.size].mac, info->mac, 6); } 是不是不太对,这里是将最后一位的值改变为移除的值,感觉不太对,应该是把移除位置的值改变为最后一位的值,是这样吗? memcpy(g_bindlist.data + i, g_bindlist.data + g_bindlist.size, sizeof(espnow_ctrl_bind_info_t));这里一直想不太懂,希望能解答一下
The text was updated successfully, but these errors were encountered:
在底下看到取消配对的代码是这样写的,remove之后的位都向前移动,这样会好一些吗 g_bindlist.size--;
for (int j = i; j < g_bindlist.size; j++) { g_bindlist.data[j].initiator_attribute = g_bindlist.data[j + 1].initiator_attribute; memcpy(g_bindlist.data[j].mac, g_bindlist.data[j + 1].mac, 6); } g_bindlist.data[g_bindlist.size].initiator_attribute = 0; memset(g_bindlist.data[g_bindlist.size].mac, 0, 6);
Sorry, something went wrong.
是的,应该和取消配对的代码一样处理。修复好了会合并进去。谢谢!
No branches or pull requests
Checklist
Issue or Suggestion Description
这里的移除函数的处理是否有问题呢?在control组件中,有一个esp_err_t espnow_ctrl_responder_remove_bindlist(const espnow_ctrl_bind_info_t *info)函数,是这样的
esp_err_t espnow_ctrl_responder_remove_bindlist(const espnow_ctrl_bind_info_t *info)
{
espnow_load_bindlist();
for (int i = 0; i < g_bindlist.size; ++i)
{
if (!memcmp(g_bindlist.data + i, info, sizeof(espnow_ctrl_bind_info_t)))
{
g_bindlist.size--;
}
return ESP_OK;
}
其中 if (g_bindlist.size > 0)
{
g_bindlist.data[g_bindlist.size].initiator_attribute = info->initiator_attribute;
memcpy(g_bindlist.data[g_bindlist.size].mac, info->mac, 6);
}
是不是不太对,这里是将最后一位的值改变为移除的值,感觉不太对,应该是把移除位置的值改变为最后一位的值,是这样吗? memcpy(g_bindlist.data + i, g_bindlist.data + g_bindlist.size, sizeof(espnow_ctrl_bind_info_t));这里一直想不太懂,希望能解答一下
The text was updated successfully, but these errors were encountered: