Skip to content

docs: Update webcam and docs #14

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

Open
wants to merge 12 commits into
base: master
Choose a base branch
from
Open
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
46 changes: 46 additions & 0 deletions contributing.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
---
layout: default
title: Contributing
parent:
nav_order:
has_children: false
permalink: /contributing/
redirect_from:
description: >-
How to contribute to Mainsail by submitting pull requests or updating documentation.
---
# {{ page.title }}
{{ page.description }}

# Contributing

Pull requests and documentation updates are always welcome! Here are some guidelines for how to contribute:

* Find an issue that you are interested in improving or a feature that you would like to add.
* In GitHub, fork the repository by clicking the `Fork` button in the upper right hand of the project's Github page.
* Clone the repository to your local machine using `git clone https://github.com/github-username/repository-name.git`.
* Create a new branch for your fix using `git checkout -b branch-name-here`.
* Make the appropriate changes for the issue you are trying to address or the feature that you want to add.
* Use `git add insert-paths-of-changed-files-here` to add the file contents of the changed files to git.
* Use `git commit` and on the first line `"Insert a short message of the changes made here"` to add a descriptive
* message. Insert a line break and on the third line sign off on your commit with your name and email
* address: `Signed-off-by: Your Name <your-email-address>`.
* Push the changes to your remote repository using `git push origin branch-name-here`.
* Visit the Mainsail repository and click the `Pull requests` tab. Click `New pull request`.
* Title the pull request with a short description of the changes made and the issue or bug number associated
with your change. For example, you can title an issue like so "Added more log outputting to resolve #4352".
* In the description of the pull request, explain the changes that you made, any issues you think exist with the
pull request you made, and any questions you have for the maintainer.
* Wait for the pull request to be reviewed by a maintainer. The reviewer may ask for changes before merging. Please
* be open to feedback.

# Development
Please review Mainsail's [Coding Standards](/code-standards) before submitting a pull request. For more information,
including setting up your environment or helping with translations, see the [Mainsail Development page](/development).


# How can I get help?

If you need help or have questions, please ask! The [Mainsail Discord](https://discord.gg/skWTwTD) is the
best way to ask for help.

63 changes: 38 additions & 25 deletions features/webcams.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,35 +2,46 @@
layout: default
title: Webcams
parent: Features
nav_order: 50
has_children: false
permalink: /features/webcams
redirect_from:
- /quicktips/multicam
description: >-
How to setup multiple Webcams with MainsailOS.
How to set up multiple webcams with MainsailOS.
---

# {{ page.title }}
{{ page.description }}

__Disclaimer__
Thank you to [Charlie_Powell](https://community.octoprint.org/u/Charlie_Powell) for letting us adapt his guide for MainsailOS!
__Disclaimer__
Thank you to [Charlie_Powell](https://community.octoprint.org/u/Charlie_Powell) for letting us adapt his guide for MainsailOS!
The original guide can be found [here](https://community.octoprint.org/t/setting-up-multiple-webcams-in-octopi-the-right-way/32669).
{: .info}

## Prerequisites
## Webcam Setup

MainsailOS supports an infinite number of `webcam*.txt` style configuration files. They should be placed in `/home/pi/klipper_config`. As of MainsailOS 2.1, you may need to re-enable your webcam. To enable your webcam, go to `Settings > Interface` in Mainsail. Uncomment the following lines by removing the `#` symbol:

```
# camera="usb"

# camera_usb_options="-r 640x480 -f 10"
```

The `webcam.txt` file includes additional instructions of variables you can change depending on the type of webcam you are using.

## Multicam Setup

### Prerequisites
For multicam to work, you will need:

- MainsailOS v0.5.0 or higher
- SSH access
- Two or more cameras

__WARNING__
__WARNING__
**If you are working with an existing installation, make a backup!**
{: .warning}

## Creating the configuration files
### Creating the configuration files
MainsailOS supports an infinite number of `webcam*.txt` style configuration files. They should be placed in
`/home/pi/klipper_config`.

Expand All @@ -42,7 +53,7 @@ You should now have two identical files with different names:
1. `/home/pi/klipper_config/webcam.txt`
2. `/home/pi/klipper_config/webcam2.txt`

## Edit the original configuration file for a specific camera
### Edit the original configuration file for a specific camera
Find the path to the camera by its ID. This makes it easier to stop `dev/video0` and `/dev/video1` from being switched in the future.

In a terminal, run the command `ls /dev/v4l/by-id`, copy your camera id and paste it into the editor in Mainsail. For example:
Expand All @@ -59,7 +70,7 @@ usb-046d_0825_88C56B60-video-index0 usb-046d_0825_88C56B60-video-index1
This example will use the first one: `usb-046d_0825_88C56B60-video-index0`


__Note__
__Note__
Not sure which device is which? You can run `lsusb` to match a camera name to an ID.
{: .info}

Expand All @@ -74,14 +85,16 @@ camera_usb_options="-r 640x480 -f 10 -d /dev/v4l/by-id/<device long id>"

The `device long id` should match the camera name from running `lsusb`.

__Note__
If you are using a Raspberry Pi branded camera, set `camera="raspi"` at the top of the file and you do not have to reference the cameras by device ID.{: .info}
__Note__
If you are using a Raspberry Pi branded camera, set camera="raspi" at the top of the file and you do not have to reference the cameras by device ID.

{: .info}

## 3. Editing the second configuration file
### 3. Editing the second configuration file
When using a second camera, you must add the port `mjpg_streamer` runs under and the device.

__Note__
If you are using one Raspberry Pi branded camera and a different USB camera you don't need to reference them by ID, as `camera="raspi"` and `camera="usb"` is enough.
__Note__
If you are using one Raspberry Pi branded camera and a different USB camera you don't need to reference them by ID, as camera="raspi" and camera="usb" is enough.
{: .info}

Similar to finding the first camera, run `ls` and copy the ID of the second camera:
Expand Down Expand Up @@ -109,23 +122,23 @@ webcam2.txt => -p 8082
webcam3.txt => -p 8083
```

__INFO__
MainsailOS comes setup with four NGINX reverse proxies for port 8080 through 8083, so you can configure 4 webcams with this guide.
For more webcams you will need to edit the NGINX configuration, which is not recommended. It can be easy to make a mistake when editing NGINX, which will also cause Mainsail to stop working.
__INFO__
MainsailOS comes setup with four nginx reverse proxies for port 8080 through 8083, so you can configure 4 webcams with this guide.
For more webcams you will need to edit the nginx configuration, which is not recommended. It can be easy to make a mistake when editing nginx, which will also cause Mainsail to stop working.
If you need more than four webcams, visit us on [Discord](https://discord.gg/skWTwTD){:target="_blank"} and we will help you.
{: .warning}

## 4. Test that it works
Restart `webcamd` by clicking the power button icon in the upper right corner of Mainsail and click `Webcamd` to restart it.
### 4. Test that it works
Restart `webcamd` by clicking the power button icon in the upper right corner of Mainsail and click `Webcamd` to restart it.
Find your second camera under `http://<your-ip>/webcam2/`.
If it doesn't work, check in the webcam log in the file manager log section for details.
If it doesn't work, check in the webcam log in the filemanager log section for details.

If it works, you can use the URLs in Mainsail:

Stream: `http://<your-ip>/webcam2/`

__DONE__
Congratulations, you set up multi webcam with Mainsail!
If you want to add more, follow the guide again and increment the `webcam*.txt` number, i.e. `webcam**3**.txt` and so on.
__DONE__
Congratulations, you set up multi webcam with Mainsail!
If you want to add more, follow the guide again and increment the `webcam*.txt` number, i.e. `webcam**3**.txt` and so on.
The webcams are accessible through your `http://<your-ip>/webcam`, `http://<your-ip>/webcam2`, etc.
{: .success}
2 changes: 1 addition & 1 deletion setup-guide/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ has_toc: false
# Setup Guides

## Local installation
You will need to choose which way you want to install Mainsail on a Raspberry Pi:
You will need to choose how you want to install Mainsail on a Raspberry Pi:

- [MainsailOS](mainsail-os.md) <span class="label label-red">recommended</span>
A prebuilt image for your Raspberry Pi. Preconfigured and requires the least amount of setup.
Expand Down
2 changes: 1 addition & 1 deletion setup-guide/mainsail-hosted.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ permalink: /setup/mainsail-hosted
Mainsail and MainsailOS respect [Data Privacy](../data-privacy).
{: .info}

The hosted version of Mainsail can be used on the same local network with your printer or on a different remote to network and requires you to setup [remote access](../quicktips/remote-access).
The hosted version of Mainsail can be used on the same local network with your printer or on a different remote network and requires you to setup [remote access](../quicktips/remote-access).

## Requirements

Expand Down
8 changes: 4 additions & 4 deletions setup-guide/mainsail-os.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,13 +10,13 @@ permalink: /setup/mainsail-os

# Installing MainsailOS

MainsailOS builds upon Raspberry Pi OS Lite by including Klipper, Moonraker, and Mainsail into the disc image, making setup quick and Mainsail easier to use with Klipper and Moonraker.
MainsailOS builds upon Raspberry Pi OS Lite by including Klipper, Moonraker, and Mainsail in the disc image, making setup quick and Mainsail easier to use with Klipper and Moonraker.

Advanced users may want more complex and custom configurations and Mainsail can be [manually installed](manual-setup/index.md).
For more advanced users, Mainsail can be [manually installed](manual-setup/index.md) for more complex and custom configurations.

If you are familiar with process to flash the firmware, then please use your preferred method as you normally would.
If you are familiar with the process to flash the firmware, please use your preferred method as you normally would.

If however you are unfamiliar with the flashing process we have documented two methods to flash MainsailOS to your SD card:
If you are unfamiliar with the flashing process we have documented two methods to flash MainsailOS to your SD card:

* [Raspberry Pi Imager](mainsailos/pi-imager) (cross-platform, easiest) <span class="label label-red">recommended</span>
* [balenaEtcher](mainsailos/balena-etcher) (requires manual setup)
2 changes: 1 addition & 1 deletion setup-guide/pre-flight.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ permalink: /setup/pre-flight

# Preflight Checklist

You may wish to review the list below to make sure you have not missed any important steps during the setup process.
Please review the list below to make sure you have not missed any important steps during the setup process.

| Installed software components: | Configured: | Completed: |
| :-- | :-- | :-- |
Expand Down