8000 Pigg 616 by andrewdavidmackenzie · Pull Request #627 · andrewdavidmackenzie/pigg · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

Pigg 616 #627

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

Merged
merged 6 commits into from
Nov 18, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions BUILDING.md
Original file line number Diff line number Diff line change
Expand Up @@ -86,3 +86,8 @@ Example: `PI_TARGET=pizero2w0.local PI_USER=andrew make copy-armv7`

- [`copy-armv7` | `copy-aarch64`] to copy the built binaries to your Raspberry Pi
- `make ssh` to ssh into your Pi to be able to run the binaries.

## Building `porky`

For more details on building and running `porky` on a Raspberry Pi Pico W device,
see [porky/BUILDING.md](porky/BUILDING.md).
21 changes: 20 additions & 1 deletion INSTALLING.md
Original file line number Diff line number Diff line change
Expand Up @@ -76,4 +76,23 @@ cargo install pigg
- On a macOS/Windows/Linux host you will get a version of `piggui` and `piglet` with a fake hardware backend,
not real Pi GPIO hardware, but you can play with the GUI.
- On a Pi you will get a version of `piggui` and `piglet` with a real GPIO hardware backend enabling you
to interact with real Pi GPIO hardware.
to interact with real Pi GPIO hardware.

### Piglet as a system service

You can install `piglet` as a system service that runs in the background and is restarted at boot, so it is always
available.

- Find where the `piglet` binary is. This could be in `target/debug` or `target/release`
- To install as a system service: `piglet --install`
- To uninstall an existing service: `piglet --uninstall`

Most OS require you to run this as admin/su using `sudo` or equivalent.
This has caused me some problems as `cargo` was not in `su` user's path. This problem should be reduced when we
produce pre-built binaries for you to use.

As mentioned above, `piglet` will output information to help connect to it, but when running as a background
system service this will be in logs, and not simple for users to find.
To facilitate getting these values you can run `piglet` from the command line and it will
detect there is always another instance running, find the values associated with that instance and echo them to
the terminal. You can copy these and use them with `piggui` on the same, or a remote, machine.
43 changes: 33 additions & 10 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -38,16 +38,34 @@ hardware remotely.
</tr>
</table>

## Latest NEW Feature - pre-built images and installers

We have added pre-built images for different OS and CPU architecture, along with installers, to the automated
release process using `cargo dist`. See [INSTALLING.md](INSTALLING.md) for details.

Up-to-date instructions for installing are also be in the release notes of the
[latest release](https://github.com/andrewdavidmackenzie/pigg/releases/latest)
## What's new in this release - Pi Pico W Support!

Raspberry Pi Pico W support!!! Including:

- Embedded application `porky` for running on the Pi Pico W
- UF2 Image provided as part of release to aid programming Pi Pico W devices with `porky`
- Ability to build `porky` yourself with default SSID information so all devices with built binary connect
automatically to Wi-Fi
- USB direct connection between `piggui` and `porky` that allows you to:
- Discover USB connected `porky` devices
- View information about the device
- Determine if it is connected to the Wi-Fi network and if it is, get it's IP and Port for remote GUI use
- Program an "override" Wi-Fi network it will use to connect to, instead of the default one as part of the build.
This
is persisted in Flash memory so it is used again on restart/reboot.
- Reset the "override" Wi-Fi (removing it) so that on restart the device will connect to the default one if it
exists.
If not, it will restart, connect to USB and wait to be programmed with a Wi-Fi network to connect to.
- Remote access to the (headless) Pico W's GPIO over the network, in the same user interface as remote access to Pi
GPIO hardware via `piglet`
- Pi Pico specific pin layout and numbering

NOTE: Support for Pi Pico (not W), Pi Pico 2 (not W) and Pi Pico 2 W is planned for next releases.

## Other Features

- Pre-built images for different OS and CPU architecture, along with installers. See [INSTALLING.md](INSTALLING.md) for
details.
- Visual representation of the GPIO pins in two layouts, a "Board Pin Layout" that mimics the
physical layout of the Pi's GPIO connector/header, or a "BCM Pin Layout" with only the programmable
GPIO pins, ordered by BCM pin number
Expand Down Expand Up @@ -102,6 +120,14 @@ It offers the ability to interact with the hardware from a remote `piggui`instan
It will print out connection info at startup and start listing for Iroh network connections from `piggui` instances,
then the user can interact with it and visualize inputs level changes from the `piggui` GUI.

## Porky

`porky` is an embedded application developer for the Raspberry Pi Pico (Pi Pico W only currently, but I plan to
add support for Pico, Pico 2 and Pico 2 W soon) for remote interaction with the Pi Pico's GPIO hardware. It can be
connected to remotely over TCP, just like to a `piglet` running on a Pi.

For more details see [porky's README.md](porky/README.md)

## Input from Raspberry Pi users wanted

We would like input from Raspberry Pi users to help us decide the order of things to work on in the future,
Expand All @@ -116,14 +142,11 @@ We have identified a number of areas we would like to work on after this initial
but would really appreciate your input on what could be most useful or just the coolest,
many have GH issues.

- Pre-built binaries for install on Raspberry Pi [Issue #112](https://github.com/andrewdavidmackenzie/pigg/issues/112)
and easier install [Issue #111](https://github.com/andrewdavidmackenzie/pigg/issues/111)
- Expand support beyond Inputs and Outputs ( e.g. Clocks, PWM, I2C, UART, SPI etc.).
Issue [#53](https://github.com/andrewdavidmackenzie/pigg/issues/53),
[#52](https://github.com/andrewdavidmackenzie/pigg/issues/52), [#5](https://github.com/andrewdavidmackenzie/pigg/issues/5)
- True logical layout, grouping pins by function [Issue #94](https://github.com/andrewdavidmackenzie/pigg/issues/94)
- Allow connections between pins [Issue #95](https://github.com/andrewdavidmackenzie/pigg/issues/95)
- Pico support for a headless hardware backend accessed over the network
- Trigger a script or WebAssembly plugin on an input event (edge, level, etc.)

## Installing
Expand Down
101 changes: 42 additions & 59 deletions RUNNING.md
Original file line number Diff line number Diff line change
@@ -1,84 +1,67 @@
# Running Piglet and Piggui
# Running Piggui, Piglet, Porky

`piglet` is the small command line utility that can be run to interact with the hardware.
`piggui` is the GUI for user interaction. It can be run natively on a macOS, Linux or Windows host to interact
remotely with GPIO hardware running on a Raspberry Pi (via `piglet`) or a Raspberry Pi Pico W (via `porky`).

`piggui` is the GUI for user interaction. `piggui` can be run natively on a raspberry
Pi and allow you to control the GPIO hardware directly from the UI.
`piglet` is a command line utility that can be run to interact with the hardware. This can
be run on a macOS, Linux or Windows host (for development or demo purposes, with simulated GPIO hardware) or on
a Raspberry Pi (not Pico) and connected to remotely.

Alternatively, you can run `piglet` to interact with the hardware (on a Pi...) and on the same machine or a remote
one run `piggui` for the GUI.
`porky` is an embedded application for the Raspberry Pi Pico W, and can be connected to remotely from `piggui`.

## Running Piglet

For now, while we need you to build from source:

- Use `make run-piglet` or `make run-release-piglet`

On macOS/linux/Windows this will build for the local machine, and start `piglet` with a fake hardware backend.

If you run that on a Raspberry Pi, it will detect that, and build for the Pi, with the real Pi GPIO hardware backend.

`piggui` takes an optional filename argument, to load a config from.

`piglet` will print to the terminal a series of values that you can use with `piggui` to connect remotely to that
`piglet` instance, notably `nodeid`.

### Piglet as a system service

You can install `piglet` as a system service that runs in the background and is restarted at boot, so it is always
available.
## Piggui

- Find where the `piglet` binary is. This could be in `target/debug` or `target/release`
- To install as a system service: `piglet --install`
- To uninstall an existing service: `piglet --uninstall`
`piggui` takes an optional filename argument, to load a config from. If there is an error
loading a config, the default config will be used.

Most OS require you to run this as admin/su using `sudo` or equivalent.
This has caused me some problems as `cargo` was not in `su` user's path. This problem should be reduced when we
produce pre-built binaries for you to use.
- `piggui <filename>`

As mentioned above, `piglet` will output information to help connect to it, but when running as a background
system service this will be in logs, and not simple for users to find.
To facilitate getting these values you can run `piglet` from the command line and it will
detect there is always another instance running, find the values associated with that instance and echo them to
the terminal. You can copy these and use them with `piggui` on the same, or a remote, machine.
## Running Piglet

## Piggui
If run on a macOS, Linux or Windows host `piglet` will start with a fake hardware backend, for demo purposes.

For now, while we need you to build from source:
If run that on a Raspberry Pi, it will start with the real Pi GPIO hardware backend.

- Use `make run`
- `piglet`

One macOS/linux/Windows this will build for the local machine
(using `cargo run --bin piggui --features "fake_hw"`), and start `piggui` with a fake hardware backend.
`piglet` will print to the terminal a series of values that you can use with `piggui` to connect remotely to that
`piglet` instance, such `nodeid` for an Iroh connection, or IP Address and Port for a TCP connection.

If you run that on a Raspberry Pi, it will detect that, and build for the Pi
(using `cargo run --bin piggui --features "pi_hw"`), with the real Pi GPIO hardware backend.
## Running Porky

`piggui` takes an optional filename argument, to load a config from. If there is an error
loading a config, the default config will be used.
For details on how to install the embedded `porky` application binary on your Raspberry Pi Pico W and run it, refer
to `porky`'s own [README.md](porky/README.md)

To do this you can use the equivalent of what `make run` does, adding the filename:
### Connecting Piggui to a remote Piglet - Command Line Options

On a Pi:
To connect to a remote `piglet` using the Iroh network method, get the `nodeid` value from the piglet instance (see
above)
and pass it to
`piggui` as a command line option.

- `cargo run --bin piggui --features "pi_hw" -- <filename>`
- `piggui --nodeid $nodeid`

On macOS/Linux/Window:
To connect to a remote `piglet` using TCP, get the `ip` value (ip address and port together as a string, seperated by a
':') from the piglet instance (see above) and pass it to `piggui` as a command line option.

- On macOS, linux or Windows: `cargo run --bin piggui --features "fake_hw" -- <filename>`
- `piggui --ip $ip`

### Connecting Piggui to a remove Piglet
### Connecting Piggui to a remote Piglet/Porky - Using the GUI

To connect to a remote piglet, get the `nodeid` value from the piglet instance (see above) and pass it to
`piggui` as a command line option.
To connect to a remote `piglet` using the Iroh network method, get the `nodeid` value from the piglet instance (see
above).
Open the "hardware" menu (bottom center), select the "Disconnect" menu item to disconnect from the current device
(this maybe the simulated GPIO hardware), then chose the "Connect to remote Pi..." menu.

When building from source, run `piggui` thus (where $nodeid is the value of the node id, quotes not required;
This will display the Conection Dialog. Enter the `nodeid` of the `piglet` you wish to connect to and hit "Connect".

On a Pi:
To connect to a remote `piglet` using TCP, get the `ip` value (ip address and port together as a string, seperated by a
':') from the piglet instance (see above), open the "Connection Dialog" as above, enter the IP Address and Port and
hit "Connect"

- `cargo run --bin piggui -- --nodeid $nodeid` (builds with no hardware backend)
- `cargo run --bin piggui --features "pi_hw" -- --nodeid $nodeid` (built with a Pi hardware backend)
### Configuring then connecting to a remote Porky Pi Pico W device

On macOS/Linux/Windows:
As the device has no display, interacting with it is slightly more complicated, but `piggui` has you covered with
the ability to detect and configure `porky` devices from its GUI.

- `cargo run --bin piggui -- --nodeid $nodeid`
For more details, refer to the [porky/README.md](porky/README.md)
2 changes: 1 addition & 1 deletion porky/BUILDING.md
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ Use `make uf2` Makefile target.

This uses the `elf2usb2` command which you can install using cargo.

This ill produce the file `target/thumbv6m-none-eabi/release/porky.uf2`
This will produce the file `target/thumbv6m-none-eabi/release/porky.uf2`

You can check its type using: `file target/thumbv6m-none-eabi/release/porky.uf2`:

Expand Down
11 changes: 9 additions & 2 deletions porky/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -80,13 +80,20 @@ IP address. It will be listening for TCP connections on that IP on the default p
For the `piggui` GUI application to connect to a networked `porky` device, it needs to know the device's
IP address.

You can find the IP Address and Port that `porky` is listening on via the `piggy` GUI by using the "hardware" menu
(bottom center)

```
hardware > Discovered devices > Pi Pico W ($serial_number$) on USB > Display Device Details...
```

## Connecting to `porky` over Wi-Fi

Once you have the IP address, in the "hardware" menu, disconnect from any other device
Once you have the IP address and Port, via the same "hardware" menu disconnect from current device
(including the fake local device on the host) and then select the "Connect to remote Pi..." option.

This will open the Connection dialog. Select the "Connect using TCP" tab. Then complete the fields with the IP Address
of the `porky` device and the port number 1234, and press "Connect".
and Port (1234 by default) of the `porky` device and press "Connect".

`piggui` should connect to the remote `porky` device and show the pins in the default layout. Now you may control and
view remotely the GPIO hardware of your Pi Pico W - without writing a line of code and from the comfort of your
Expand Down
Loading
0