{"id":16242672,"url":"https://github.com/brianmay/robotica-remote-rust","last_synced_at":"2025-03-19T17:31:49.780Z","repository":{"id":37787435,"uuid":"461080194","full_name":"brianmay/robotica-remote-rust","owner":"brianmay","description":"ESP32 remote control for robotica in rust","archived":false,"fork":false,"pushed_at":"2023-10-09T19:22:30.000Z","size":1037,"stargazers_count":3,"open_issues_count":6,"forks_count":2,"subscribers_count":3,"default_branch":"main","last_synced_at":"2024-10-11T14:11:44.186Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Rust","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/brianmay.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE-APACHE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2022-02-19T03:56:19.000Z","updated_at":"2024-08-25T06:02:31.000Z","dependencies_parsed_at":"2023-02-19T12:15:25.929Z","dependency_job_id":null,"html_url":"https://github.com/brianmay/robotica-remote-rust","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/brianmay%2Frobotica-remote-rust","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/brianmay%2Frobotica-remote-rust/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/brianmay%2Frobotica-remote-rust/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/brianmay%2Frobotica-remote-rust/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/brianmay","download_url":"https://codeload.github.com/brianmay/robotica-remote-rust/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":221729491,"owners_count":16871033,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-10-10T14:12:09.502Z","updated_at":"2024-10-27T20:27:15.879Z","avatar_url":"https://github.com/brianmay.png","language":"Rust","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Robotica Remote Rust\n\nCopied and adapted from https://github.com/ivmarkov/rust-esp32-std-hello.\n\n\nHighlights:\n\n* Pure Rust implementation.\n\nTodo:\n\n* Revise error handling. Anything unexpected will panic with limited debug\n  information.\n* Only one button controller implemented, and is specific to Robotica lights.\n* Button config is hardcoded.\n* Fix dodgy code to get topic from mqtt message. See https://github.com/ivmarkov/rust-esp32-std-demo/issues/64\n\nAssumptions:\n\n* Use with this board: http://www.openhardwareconf.org/wiki/SwagBadge2021\n* gpio16: 1st button, pulled high, action low.\n* gpio16: 2nd button, pulled high, action low.\n* 2 ssd1306 compatable displays on i2c, scl gpio4, sda gpio5, addr 0x3C and 0x3D.\n* slider controls not yet used.\n\n\n## Design\n\n```mermaid\ngraph TD\n    Main((Main))\n    Mqtt((Mqtt))\n    Mqtt --\u003e |event| Main\n    Main --\u003e |cmd| Mqtt\n    Button1((Button1)) --\u003e |event| Main\n    Button2((Button2)) --\u003e |event| Main\n    Main --\u003e |status| Display((Display))\n    Display --\u003e Display1\n    Display --\u003e Display2\n    button1 --\u003e Button1\n    button2 --\u003e Button2\n    mqtt --\u003e |event| Mqtt\n    Mqtt --\u003e |cmd| mqtt\n```\n\n### Main Process\n\n```mermaid\ngraph TD\n    Main((Main))\n    LightController((LC))\n    SwitchController((SC))\n    LightController --\u003e |status| Main\n    LightController --\u003e |cmd| Main\n    Main --\u003e |event| LightController\n    SwitchController --\u003e |status| Main\n    SwitchController --\u003e |cmd| Main\n    Main --\u003e |event| SwitchController\n```\n## Build\n\n- Install the [Rust Espressif compiler toolchain and the Espressif LLVM Clang toolchain](https://github.com/esp-rs/rust-build)\n  - This is necessary, because support for the Xtensa architecture (ESP32 / ESP32-S2 / ESP32-S3) is not upstreamed in LLVM yet\n- Switch to the `esp` toolchain from the pre-built binaries: `rustup default esp`\n  - (You can also skip this step and switch to the `esp` toolchain *for the demo crate only* by executing `rustup override set esp` inside the `rust-esp32-std-demo` directory once you have cloned the demo as per below)\n  - **NOTE** For ESP32-C3 - which runs a RiscV32 chip - you can just use the stock nightly Rust compiler, and a recent, stock Clang (as in Clang 11+)\n  - (You can do this by issuing `rustup install nightly` and then `rustup default nightly` instead of installing/building the Rust \u0026 Clang ESP forks and switching to their `esp` toolchain as advised above)\n- If using the custom Espressif Clang, make sure that you DON'T have a system Clang installed as well, because even if you have the Espressif one first on your `$PATH`, Bindgen will still pick the system one\n  - A workaround that does not require uninstalling the system Clang is to do `export LIBCLANG_PATH=\u003cpath to the Espressif Clang lib directory\u003e` prior to continuing the build process\n- `cargo install ldproxy`\n- Clone this repo: `git clone https://github.com/ivmarkov/rust-esp32-std-demo`\n- Enter it: `cd rust-esp32-std-demo`\n- Export two environment variables that would contain the SSID \u0026 password of your wireless network:\n  - `export WIFI_SSID=\u003cssid\u003e`\n  - `export WIFI_PASS=\u003cssid\u003e`\n  -  export MQTT_URL=mqtt://username:password@example.org:1883\n- To configure the demo for your particular board, please uncomment the relevant [Rust target for your board](https://github.com/ivmarkov/rust-esp32-std-demo/blob/main/.cargo/config.toml#L2) and comment the others. Alternatively, just append the `--target \u003ctarget\u003e` flag to all `cargo build` lines below.\n- Build: `cargo build` or `cargo build --release`\n\n## Flash\n\n- `cargo install espflash`\n- `espflash /dev/ttyUSB0 target/[xtensa-esp32-espidf|xtensa-esp32s2-espidf|riscv32imc-esp-espidf]/debug/rust-esp32-std-demo`\n- Replace `dev/ttyUSB0` above with the USB port where you've connected the board\n\n**NOTE**: The above commands do use [`espflash`](https://crates.io/crates/espflash) and NOT [`cargo espflash`](https://crates.io/crates/cargo-espflash), even though both can be installed via Cargo. `cargo espflash` is essentially `espflash` but it has some extra superpowers, like the capability to build the project before flashing, or to generate an ESP32 .BIN file from the built .ELF image.\n\n## Alternative flashing\n\n- You can also flash with the [esptool.py](https://github.com/espressif/esptool) utility which is part of the Espressif toolset\n- Use the instructions below **only** if you have flashed successfully with `espflash` at least once, or else you might not have a valid bootloader and partition table!\n- The instructions below only (re)flash the application image, as the (one and only) factory image starting from 0x10000 in the partition table!\n- Install esptool using Python: `pip install esptool`\n- (After each cargo build) Convert the elf image to binary: `esptool.py --chip [esp32|esp32s2|esp32c3] elf2image target/xtensa-esp32-espidf/debug/rust-esp32-std-demo`\n- (After each cargo build) Flash the resulting binary: `esptool.py --chip [esp32|esp32s2|esp32c3] -p /dev/ttyUSB0 -b 460800 --before=default_reset --after=hard_reset write_flash --flash_mode dio --flash_freq 40m --flash_size 4MB 0x10000 target/xtensa-esp32-espidf/debug/rust-esp32-std-demo.bin`\n\n## Monitor\n\n- Once flashed, the board can be connected with any suitable serial monitor, e.g.:\n  - ESPMonitor: `espmonitor /dev/ttyUSB0` (you need to `cargo install espmonitor` first)\n  - Cargo PIO (this one **decodes stack traces**!): `cargo pio espidf monitor /dev/ttyUSB0` (you need to `cargo install cargo-pio` first)\n    - Please run it from within the `rust-esp32-std-demo` project directory, or else the built ELF file will not be detected, and the stack traces will not be decoded!\n  - Built-in Linux/MacOS screen: `screen /dev/ttyUSB0 115200` (use `Ctrl+A` and then type `:quit` to stop it)\n  - Miniterm: `miniterm --raw /dev/ttyUSB0 115200`\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbrianmay%2Frobotica-remote-rust","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fbrianmay%2Frobotica-remote-rust","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbrianmay%2Frobotica-remote-rust/lists"}