Skip to content

Commit

Permalink
Improve documentation
Browse files Browse the repository at this point in the history
  • Loading branch information
krzmaz committed Dec 4, 2023
1 parent 63b11cd commit bf390f0
Show file tree
Hide file tree
Showing 4 changed files with 40 additions and 10 deletions.
2 changes: 1 addition & 1 deletion Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 2 additions & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
[package]
edition = "2021"
name = "pico-w-neopixel-server"
version = "0.1.0"
version = "0.2.0"
license = "MIT OR Apache-2.0"
default-run = "tcp"


[dependencies]
Expand Down
43 changes: 36 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,21 +1,50 @@
# pico-w-neopixel-server

# **!WIP!** Rust migration in progress!
Simple webserver aiming to be a thin remote controller for neopixel lights.

Developed to work with https://github.com/mrozycki/rustmas project.

## Setup
### Dependencies
You will need to use [picotool](https://github.com/raspberrypi/picotool) or [elf2uf2-rs](https://github.com/JoNil/elf2uf2-rs) to flash the compiled binary onto your pico.
Choose whichever you want and set the runner in `.cargo/config.toml` accordingly

We recommend using `picotool`, as it let's you read the binary information from a flashed pico as well.

On MacOS and Linux you can install it with [brew](https://brew.sh/):

```sh
brew install picotool
```
### WiFi credentials
You will need to make a copy of the `src/secret.rs.example` file and name it `src/secret.rs`.
In that file fill you the SSID and password of the WiFi network you want the pico to connect to.


## Flashing

This repo contains both TCP and UDP versions of the neopixel server. The TCP one is used by default.


To flash it to pico just put the pico in bootsel mode and run
```sh
cargo run --release
```

> [!TIP]
> [!NOTE]
> Some lights have their red and green colors swapped, if you don't want to compensate for that in each frame sent to pico, you can compensate in the firmware:
```sh
cargo run --release --features grb
```
### UDP
To use the UDP version you just need to add `--bin udp` to your flash command:
```sh
cargo run --release --bin udp
```
> [!IMPORTANT]
> Make sure that the UDP packets length doesn't exceed the MTU in your network.
> For a default MTU of 1500 bytes, you won't be able to drive 500 LEDs due to the protocol overhead.

Simple webserver aiming to be a thin remote controller for neopixel lights.

Developed to work with https://github.com/mrozycki/rustmas project.

The C++ SDK version using Pico SDK can be found here: https://github.com/krzmaz/pico-w-neopixel-server-cpp
---
The legacy version of this project using Pico C++ SDK can be found here: https://github.com/krzmaz/pico-w-neopixel-server-cpp
2 changes: 1 addition & 1 deletion src/ws2812.rs
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ impl<'d, P: Instance, const S: usize> Ws2812<'d, P, S> {
}

pub fn write(&mut self, r: u8, g: u8, b: u8) {
let word = convert_colors_to_word(r,g,b);
let word = convert_colors_to_word(r, g, b);
// we need to watch out not to overflow the FIFO, see:
// https://github.com/rp-rs/ws2812-pio-rs/blob/944494ca9dad73933f700408c3054c8f14c78998/src/lib.rs#L177-L179
while !self.sm.tx().try_push(word) {
Expand Down

0 comments on commit bf390f0

Please sign in to comment.