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

Add esp wifi to monorepo with history #1582

Merged
merged 194 commits into from
May 24, 2024

Conversation

bjoernQ
Copy link
Contributor

@bjoernQ bjoernQ commented May 23, 2024

I also kept all the commits because

  • the original authors should be mentioned
  • the history might be useful

This is not just a copy from esp-wifi since some changes were needed to get it working with current main - however most changes should be straight forward

@bjoernQ bjoernQ added the skip-changelog No changelog modification needed label May 23, 2024
@jessebraham
Copy link
Member

All our PRs get squashed by the merge queue FYI, if you're not aware.

@bjoernQ
Copy link
Contributor Author

bjoernQ commented May 23, 2024

All our PRs get squashed by the merge queue FYI, if you're not aware.

Ah true ... but at least the contributors will be added to that commit

@MabezDev
Copy link
Member

Hmm, so I guess the fun here will be that we need to make esp-wifi (and its examples) run on stable :D.

Other than that this is looking good so far.

jessebraham and others added 26 commits May 24, 2024 13:52
* switch to heapless for SimpleQueue

* Merge Network into WifiStack

- Merge the Network and Wifi structs into WifiStack
- Get it building & running with just TCP socket for now

* get dhcp example building with changes and no warnings

* fixup error checking

* Fix other examples

* fmt

* Remove redundant comment

* fix unused results

* bump BT_INTERNAL_QUEUE to 10

* add back static ip configuration in work()
* Async WiFi with embassy

- Add embassy_net::Driver impl for WifiDevice
- Add embassy_dhcp example
- Update README with embassy_dhcp running instruction

Notes:

TCP connection may fail a few times until the esp gets an IP address, it
seems there is no way to await dhcp completion in embassy_net yet.

* Put embassy-net behind feature

- Whilst other embassy crates can be used behind the async feature,
  embassy-net should be put behind its own feature

* wait for dhcp to complete in example

* fmt

* Simplify embedded-io import

* Update README, use new bleps
Regardless of whether we can do anything with the incoming packets, we
*must* ensure the drivers packet memory is free.
* Add async scan_n()

* WifiFuture and async connect

- Don't compile the blocking `WifiStack` when using the embassy-net
  feature
- Improve WifiEventFuture to have a waker for each WifiEvent
- Stub out async versions of embedded-svc trait

* Add async start/stop/connect

- All works first time
  - Fails on reconnect, but this is a bug in the svc implementation
- Implements `IntoFuture` for `WifiEvent`
  - Is it possible to await the event in two seperate futures? or will
    one overwrite the other?

* Async connect/disconnect

- Now working in fully async fashion
- Improved embedded-svc `Wifi` trait impl
  - is_started etc still needs work
- spotted memory leak when not transmitting anything

* Fix async start

Can now succesfully reconnect to a network

* Fix `is_started`

Closes esp-rs/esp-wifi-sys#126

* link state waker

* Only wake the transmit waker if we have something to send

* Correct WifiEventFuture

Instead of relying on the current state, it now tracks events and clears
the event before trying to listen.

* wifi: split into device and controller

- Split the wifi into two parts, the device part which is used within the
network stack and the controller, which handles the wifi connection
parts

- Remove the uneeded `Wifi` impl now that the two parts are separate

* undo cfg of blocking stack

* small fixups

* controller: add `wait_for_event`

- This solves the waker overwrite issue, as the function takes `&mut
  self`, meaning its only possible to await for the same event once.
- Sadly this means we have to remove the really clean `into_future` impl
  :(, but atleast we don't have to bump MSRV.

* Fix examples

* fmt

* make globals pub(crate)

* make all events awaitable

- Add wakers for all events
- Add some docs
- Make WifiEventFuture pub(crate)

* fix esp-now
* Add basic AP support

* Remove IS_AP global static
* Adjust for latest HAL

* ESP32-S3 adjustments needed after update

* Use ESP32-C2 HAL 0.5.1
* ESP32-C6 WiFi support

* Explain the `run_after_initialze_hack` function
* Move some boilerplate code into own examples-util crate

* Have an `examples-esp32XXX` folder for each target

* Cleanup dependencies

* Use workspace dependencies

* Adjust CI workflow

* `cd` into the right directories

* Don't pass chip selection features for examples

* Fix ESP32-C6 CI
* Use RADIO singletons

- Uses the RADIO singletons when creating wifi/ble/esp_now
- Updates all examples to use the singletons
- Simplfy esp_now::ReceiveFuture

* Fixup examples

* fmt

* fix examples
* Add set_mode

* Revert unnecessary changes

* Review changes

* Removed unecessary change

* Review changes, merge conflict fix
* Add missing ROM functions for ESP32-S3/ESP32-S2

* Cut down nocoex + big-heap heap-size
* Async BLE HCI

* Add async-ble example

* Use nightly-2023-03-09 for CI (for now)
@bjoernQ bjoernQ force-pushed the add-esp-wifi-to-monorepo-with-history branch from 4f0cfde to 6ab404b Compare May 24, 2024 11:52
@bjoernQ bjoernQ marked this pull request as ready for review May 24, 2024 14:34
Copy link
Member

@jessebraham jessebraham left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So, for what I hope are obvious reasons, I am not going to review the source code for any of the added packages here 😁 I trust that things are in order, as that's all I can do here.

However, I have reviewed the changes, and think we're in good shape. I have left a few comments, but nothing here is urgent. Frankly this is probably fine to merge as-is.

One small request, could you please also add EspWifi to the Package enum in the xtask package? I keep forgetting to do this when I add packages, so trying to build the habit for myself and others 😅

(Thank you for your work here, really excited to have most of our packages in a single monorepo moving forward!)

Cargo.toml Show resolved Hide resolved
esp-hal/src/soc/esp32/mod.rs Show resolved Hide resolved
extras/bench-server/.gitignore Outdated Show resolved Hide resolved
extras/esp-wifishark/.gitignore Outdated Show resolved Hide resolved
@bjoernQ
Copy link
Contributor Author

bjoernQ commented May 24, 2024

One small request, could you please also add EspWifi to the Package enum in the xtask package? I keep forgetting to do this when I add packages, so trying to build the habit for myself and others 😅

Thanks for the hint .... I totally forgot about that 👍

Copy link
Member

@MabezDev MabezDev left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks! Excited to see this merged :D

@MabezDev MabezDev added this pull request to the merge queue May 24, 2024
Merged via the queue into esp-rs:main with commit 06315b8 May 24, 2024
21 checks passed
@maxwen
Copy link
Contributor

maxwen commented May 28, 2024

Thx! Reducing the dependency hell using main :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
skip-changelog No changelog modification needed
Projects
None yet
Development

Successfully merging this pull request may close these issues.