espressif / esp-now

A connectionless Wi-Fi communication protocol
Apache License 2.0
506 stars 93 forks source link

Bind by RSSI example (AEGHB-261) #3

Closed poky closed 2 years ago

poky commented 2 years ago

Hi, thank you for the library! In the promote video shows that the bind is set to within the 4cm RSSI range, could you show where I can find the example of it? I'm testing the control example with 3 C3 dev boards, but doesn't show this feature.

Thanks!

Screen Shot 2021-09-25 at 11 46 15 PM

zhanzhaocheng commented 2 years ago

Currently, the RSSI between the two devices is used as the filter condition for the distance.

You can modify the filtered data frame through the following configuration (frame_head.filter_weak_signal)


                espnow_frame_head_t frame_head = {
                    .retransmit_count = 15,
                    .broadcast        = true,
                    .channel          = ESPNOW_CHANNEL_ALL,
                    .filter_weak_signal = -20,
                };

                espnow_ctrl_data_t data = {
                    .initiator_attribute = ESPNOW_ATTRIBUTE_KEY_1,
                    .responder_attribute = ESPNOW_ATTRIBUTE_POWER,
                    .responder_value_i   = status,
                };

                espnow_ctrl_data_t data = {
                    .initiator_attribute = ESPNOW_ATTRIBUTE_KEY_1,
                    .responder_attribute = ESPNOW_ATTRIBUTE_POWER,
                    .responder_value_i   = status,
                };

                espnow_ctrl_send(ESPNOW_ADDR_BROADCAST, &data, &frame_head, pdMS_TO_TICKS(1000));
poky commented 2 years ago

Thanks! Will take look for it!

poky commented 2 years ago

Hi, when I check the espnow_frame_head_t struct, the data type of filter_weak_signal is boolean?

https://github.com/espressif/esp-now/blob/9db0e7ff03abda6427d5be517d2a4f44eba340d1/components/espnow/include/espnow.h#L127

zhanzhaocheng commented 2 years ago

You need to enable filter_weak_signal and set .forward_rssi image

pryhmez commented 1 year ago

hey zhanahaocheng, please you leave a link to an example on how to use this properly