ESP-Now

Hi
I am trying to use ESP-Now in a C++ program. Unfortunately it seems that even though the required header file is present, the lib (.a) is not:
"/app/src/main.cpp:96: undefined reference to `esp_now_init'"
I suspected this to be a problem with the makefile, but I cannot find out how to fix it, as I don't see where the libs are stored. Are they inside the docker container?
Thanks, Sean

Comments

  • atmegaatmega Schweiz

    Also, adding libespnow.a to the src path doesn't help either (which it should, because libpaths contains /src...)

  • rojerrojer Dublin, Ireland

    yes, libs are inside the docker container. we do not link with espnow as we had no luck getting it to work before (it seems to have a memory corruption bug which is exposed by our allocator).

  • atmegaatmega Schweiz

    Damn it :(
    I already tried with sending raw packets, and I get crashes all the time (when switching to promiscuous mode) So it seems I'll have to use WiFi, or build using Arduino for this project (I don't like it, and now that I know mongoose I hate it :smiley: )?

  • rojerrojer Dublin, Ireland

    i have never tried sending raw packets, but i don't see why that wouldn't work. can you share the code? maybe i can help.

    not much to be done about espnow unfortunately, it just fails to initialize with what looks like a double-free memory error. and since it's a binary blob - good luck fixing it...

  • atmegaatmega Schweiz

    When I use the following code:
    Callback:
    static void ICACHE_FLASH_ATTR
    promisc_cb(uint8 *buf, uint16 len)
    {
    printf("got packet!");
    }

    Init:
    wifi_set_opmode(STATION_MODE);
    wifi_set_promiscuous_rx_cb(promisc_cb);
    wifi_promiscuous_enable(1);
    uint8 mac[6] = {1,2,3,4,5,6};
    wifi_promiscuous_set_mac(mac);
    wifi_set_opmode(0x1);
    wifi_set_channel(11);

    It only works when I either comment out wifi_promiscuous_enable (nothing happens) or I set a MAC address which isn't present anywhere. If I set no MAC, or one which receives traffic on channel 11, I get about 20 "got packet!" and then a core dump. Looks like a memory leak, too. Maybe callbacks work differently? Shouldn't be the case though.

  • rojerrojer Dublin, Ireland

    ok, i'll take a look a bit later.

  • atmegaatmega Schweiz

    Thank you very much!

Sign In or Register to comment.