Code Monkey home page Code Monkey logo

Comments (4)

yoursunny avatar yoursunny commented on September 22, 2024

The attached code has lots of unexecuted junk (everything starting from InitESPNow are unnecessary). Please follow [https://stackoverflow.com/help/mcve](MCVE guidelines) next time you report a bug (to this and any other project).

This snippet is problematic:

  unsigned long tim = millis() ;
  while((!flgMsgRecd) && ((tim-millis())<250)) ;
  flgMsgRecd = false ;
  int len = snprintf(s, sizeof(s), "%s with Mac Id %s at %lu %d",msg, WiFi.softAPmacAddress().c_str(), millis(),rstcnt++);
  WifiEspNow.send(PEER, reinterpret_cast<const uint8_t*>(s), sizeof(s));

  esp_sleep_enable_timer_wakeup(300000);
  esp_deep_sleep_start();
  1. Wait 250ms for an incoming message.
  2. Transmit a message.
  3. Sleep for 5 minutes.

Observations:

  • Nobody would transmit first. Even if two nodes wake up at almost but not exactly the same time, normally only one could receive a message.
  • ESP-NOW is best-effort delivery. It has acknowledgement WifiEspNow.getSendStatus() but not automated retransmission. The app is not doing retransmission.
  • Wake period is a lot shorter than sleep period. If sleep timer is a little bit off, the two node would never wake up at the same time, and thus no communication could happen.

The following paper may be related:

Oliver Hahm, Emmanuel Baccelli, Thomas Schmidt, Matthias Waehlisch, Cédric Adjih. A Named Data Network Approach to Energy Efficiency in IoT. IEEE GLOBECOM Workshop on Named Data Networking for Challenged Communication Environments, Dec 2016, Washington DC, United States.

from wifiespnow.

SrikanthBala avatar SrikanthBala commented on September 22, 2024

Thank you for your prompt reply.

  1. True. A lot of unnecessary junk was sent with the code. I was trying various things to get it to work and the junk was not trimmed off. And yes I have now gone through the MCVE guidelines. Thanks for that. I try to adhere to them in the future

  2. I went thru your comments and had in the meanwhile found errors in my code which I will correct. Hopefully I will get it right soon.

  3. I have yet to go through the reference paper you sent.

Will report back . Thanks again

from wifiespnow.

SrikanthBala avatar SrikanthBala commented on September 22, 2024

One question regarding the code :
Will the line :
ok = WifiEspNow.addPeer(PEER);

try to write the Mac ID and other details about the peer to EEPROM or Flash on every reset ?
That would markedly reduce life of the device as I am resetting every 300 ms

Is it required if the pairing has already been done once ? Should I check to see if pairing exists and only then do this ? If so how ?

Thanks

from wifiespnow.

yoursunny avatar yoursunny commented on September 22, 2024

Will the line ok = WifiEspNow.addPeer(PEER); try to write the Mac ID and other details about the peer to EEPROM or Flash on every reset ?

I believe no, because ESP-IDF docs does not mention persistence of the pairing.

from wifiespnow.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.