Another one mistake in official documentation:
https://docs.espressif.com/projects/esp ... t8uint16_t
Just read explanation this func and previous.
Blutooth example.
-
- Posts: 364
- Joined: Mon Jan 04, 2021 2:06 pm
Re: Blutooth example.
Hi,
Thank you for your feedback!
You can also provide feedback directly on the docs page, by the link "Provide feedback about this document" in the bottom of the page. This is the best way to do it!
Thank you for your feedback!
You can also provide feedback directly on the docs page, by the link "Provide feedback about this document" in the bottom of the page. This is the best way to do it!
Re: Blutooth example.
Thank you for reply.
I must say, the documentation is in a pure state. I found many of inaccuracies and mistakes. It is also nice to fix the documentation when it is generally okay and there is only a few bugs. But when there are many mistakes, the desire to correct disappears.
To be honest, it is possible to independently understand what is meant, but it takes experience, effort and time. Several times I had to Google about code on GitHub to see how it works in other projects. In the end, I did what I needed, but it cost me a lot of effort. I would understand this situation if it was the documentation of some student project, produced in dozens of pieces on order. But such a situation should not be in the case of the official documentation of the project, which is produced in a million copies and is sold for money by an honest company.
It is very strange that a company that was able to make its own microcontroller (which is very, very difficult) cannot write the documentation properly. Much is simply not written in the documentation. For example, it is very important to know which function triggers which event. And it should be written both on the function description page and on the event description page. Look at the android documentation, everything is written very well there.
Separately, I would like to touch on code examples. It is written very untidy. I ran into the example from the official documentation, wich is not compiling (it was an example of using PWM to control the brightness of LEDs). The reason was that a deprecated function was used in the example. Of course, I found the problem and run the example, but it cost me some effort and time.
Most of the examples are written as if they were written by a person without much programming experience. In the modern world, writing code so that it does run is not enough for the official documentation. We also need to worry about the readability of the code and the convenience of modification. I had a lot of questions about: "Why is this piece of code located in this place, although it would be much more convenient to place it in a different place. This is just an example that is not neatly written or there is some good reason why it does not work elsewhere". Simple example: why, in the example GATT server, the services table is filled in the process of code execution in different places, when it would be easier to fill the table in one place. This contradicts the requirement for scalability of the code, where adding a new service requires changing the code in different places.
Summing up: the idea of placing a controller and a bluetooth adapter in one chip is very interesting. It is especially pleasant that the controller is dual-core, and one of the cores is dedicated to bluetooth. This is what prompted me to choose your solution. But I really regretted it. If I knew how much work I would have to do in order to understand how this controller works, if I knew the state of the technical documentation and examples, I would choose a different solution. It is too late for me now and I will use this controller. It's not bad, just poorly documented. But to all my acquaintances in real life and on the Internet, I will categorically recommend other solutions.
I must say, the documentation is in a pure state. I found many of inaccuracies and mistakes. It is also nice to fix the documentation when it is generally okay and there is only a few bugs. But when there are many mistakes, the desire to correct disappears.
To be honest, it is possible to independently understand what is meant, but it takes experience, effort and time. Several times I had to Google about code on GitHub to see how it works in other projects. In the end, I did what I needed, but it cost me a lot of effort. I would understand this situation if it was the documentation of some student project, produced in dozens of pieces on order. But such a situation should not be in the case of the official documentation of the project, which is produced in a million copies and is sold for money by an honest company.
It is very strange that a company that was able to make its own microcontroller (which is very, very difficult) cannot write the documentation properly. Much is simply not written in the documentation. For example, it is very important to know which function triggers which event. And it should be written both on the function description page and on the event description page. Look at the android documentation, everything is written very well there.
Separately, I would like to touch on code examples. It is written very untidy. I ran into the example from the official documentation, wich is not compiling (it was an example of using PWM to control the brightness of LEDs). The reason was that a deprecated function was used in the example. Of course, I found the problem and run the example, but it cost me some effort and time.
Most of the examples are written as if they were written by a person without much programming experience. In the modern world, writing code so that it does run is not enough for the official documentation. We also need to worry about the readability of the code and the convenience of modification. I had a lot of questions about: "Why is this piece of code located in this place, although it would be much more convenient to place it in a different place. This is just an example that is not neatly written or there is some good reason why it does not work elsewhere". Simple example: why, in the example GATT server, the services table is filled in the process of code execution in different places, when it would be easier to fill the table in one place. This contradicts the requirement for scalability of the code, where adding a new service requires changing the code in different places.
Summing up: the idea of placing a controller and a bluetooth adapter in one chip is very interesting. It is especially pleasant that the controller is dual-core, and one of the cores is dedicated to bluetooth. This is what prompted me to choose your solution. But I really regretted it. If I knew how much work I would have to do in order to understand how this controller works, if I knew the state of the technical documentation and examples, I would choose a different solution. It is too late for me now and I will use this controller. It's not bad, just poorly documented. But to all my acquaintances in real life and on the Internet, I will categorically recommend other solutions.
-
- Posts: 364
- Joined: Mon Jan 04, 2021 2:06 pm
Re: Blutooth example.
Hi,
Thank you for your valuable feedback.
We are actively working hard to get the documentation better and intended for all levels of developers. It takes time and a lot of internal efforts.
Regarding the example not working: You are probably trying to run an example from the latest version of IDF on a different local version. We run several tests to guarantee that all the code and example run flawlessly.
Some functions are deprecated depending on the version you are working, but all the deprecated functions are documented with warnings if you try to use it.
We are reviewing the documentation and the examples to fix any possible mistakes or lack of information. This does take some time to be done but we are actively working to improve it.
Thank you for your valuable feedback.
We are actively working hard to get the documentation better and intended for all levels of developers. It takes time and a lot of internal efforts.
Regarding the example not working: You are probably trying to run an example from the latest version of IDF on a different local version. We run several tests to guarantee that all the code and example run flawlessly.
Some functions are deprecated depending on the version you are working, but all the deprecated functions are documented with warnings if you try to use it.
We are reviewing the documentation and the examples to fix any possible mistakes or lack of information. This does take some time to be done but we are actively working to improve it.
Re: Blutooth example.
In this case, send a notify or indicate message to the client.User4356 wrote: ↑Fri Feb 26, 2021 10:26 pmI finished server tutorial, but there is some code not explained. Can you tell me, what this code do?
Code: Select all
case ESP_GATTS_WRITE_EVT: { ESP_LOGI(GATTS_TAG, "GATT_WRITE_EVT, conn_id %d, trans_id %d, handle %d", param->write.conn_id, param->write.trans_id, param->write.handle); if (!param->write.is_prep){ ESP_LOGI(GATTS_TAG, "GATT_WRITE_EVT, value len %d, value :", param->write.len); esp_log_buffer_hex(GATTS_TAG, param->write.value, param->write.len); if (gl_profile_tab[PROFILE_A_APP_ID].descr_handle == param->write.handle && param->write.len == 2){ uint16_t descr_value = param->write.value[1]<<8 | param->write.value[0]; if (descr_value == 0x0001){ if (a_property & ESP_GATT_CHAR_PROP_BIT_NOTIFY){ ESP_LOGI(GATTS_TAG, "notify enable"); uint8_t notify_data[15]; for (int i = 0; i < sizeof(notify_data); ++i) { notify_data[i] = i%0xff; } //the size of notify_data[] need less than MTU size esp_ble_gatts_send_indicate(gatts_if, param->write.conn_id, gl_profile_tab[PROFILE_A_APP_ID].char_handle, sizeof(notify_data), notify_data, false); } }else if (descr_value == 0x0002){ if (a_property & ESP_GATT_CHAR_PROP_BIT_INDICATE){ ESP_LOGI(GATTS_TAG, "indicate enable"); uint8_t indicate_data[15]; for (int i = 0; i < sizeof(indicate_data); ++i) { indicate_data[i] = i%0xff; } //the size of indicate_data[] need less than MTU size esp_ble_gatts_send_indicate(gatts_if, param->write.conn_id, gl_profile_tab[PROFILE_A_APP_ID].char_handle, sizeof(indicate_data), indicate_data, true); } } else if (descr_value == 0x0000){ ESP_LOGI(GATTS_TAG, "notify/indicate disable "); }else{ ESP_LOGE(GATTS_TAG, "unknown descr value"); esp_log_buffer_hex(GATTS_TAG, param->write.value, param->write.len); } } } example_write_event_env(gatts_if, &a_prepare_write_env, param); break; }
Who is online
Users browsing this forum: Bing [Bot] and 379 guests