Skip to content
New issue

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

Beacon interval #41

Open
atom-smasher opened this issue Jun 15, 2022 · 3 comments
Open

Beacon interval #41

atom-smasher opened this issue Jun 15, 2022 · 3 comments

Comments

@atom-smasher
Copy link

I'm trying to understand this line:

  /* 32 - 33 */ 0xe8, 0x03,                         // Interval: 0x64, 0x00 => every 100ms - 0xe8, 0x03 => every 1s

As I understand the code, this does not set the actual interval of the beacons, but rather it sets an "expected" time, and within that expected time, a node should expect to see another beacon from this BSSID.

IIUC, the code is running as fast as the wifi chip can send beacons, and it could (presumably) be slowed down with some kind of sleep command (this code is not my first language).

Is that correct?

Maybe that should be documented in the comments of the code.

@atom-smasher
Copy link
Author

Going through it, is this line what's serving to keep it from running too fast?

  if (currentTime - attackTime > 100) {

IIUC, instead of just sleeping for a period, regardless of how long it takes to send out x beacons, it uses this to just make sure it's not running too fast, without delay that would make it run too slow.

When it's running "fast enough", I'm wondering if that test at the start of that loop function is consuming excessive resources, and might be more power efficient (with negligible loss of speed) as this:

  if (currentTime - attackTime < 100) {
    delay (10);
  } else {

@atom-smasher
Copy link
Author

atom-smasher commented Jun 15, 2022

I'm wondering if this might be the perfect throttle:

  if (currentTime - attackTime < 100) {
    delay ((100 - (currentTime - attackTime)) % 100);
  } else {

The way it was originally, with about 10-15 SSIDs, it would bang on the test/loop about 800 times per iteration. As above, it just sleeps until it's ready, once per iteration.

@atom-smasher
Copy link
Author

Perfectly throttled here - https://github.com/atom-smasher/esp8266_beaconSpam

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant