Skip to content
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
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ and the [release notes](https://github.com/paxx12/SnapmakerU1/releases/latest).

All basic firmware features plus:

- [Extended Configuration](docs/extended_config.md) - Customize firmware behavior via config file
- [Camera Support](docs/camera_support.md) - Hardware-accelerated camera stack (Rockchip MPP/VPU)
- [USB Camera Support](docs/camera_support.md) - Support for external USB cameras
- [Klipper and Moonraker Custom Includes](docs/klipper_includes.md) - Add custom configuration files via Fluidd
Expand All @@ -43,6 +44,7 @@ Known issues:
- [Installation Guide](docs/install.md) - How to install custom firmware
- [Building from Source](docs/development.md) - Development guide for building custom firmware
- [SSH Access](docs/ssh_access.md) - How to access the printer via SSH
- [Extended Configuration](docs/extended_config.md) - Customize firmware behavior via config file
- [Camera Support](docs/camera_support.md) - Camera features and WebRTC streaming
- [Klipper and Moonraker Custom Includes](docs/klipper_includes.md) - Add custom configuration files via Fluidd
- [RFID Filament Tag Support](docs/rfid_support.md) - RFID filament tag usage and programming
Expand Down
29 changes: 18 additions & 11 deletions docs/camera_support.md
Original file line number Diff line number Diff line change
Expand Up @@ -34,24 +34,31 @@ settings for the best performance:

## Switch to Snapmaker's Original Camera Stack

By default, the extended firmware uses a custom hardware-accelerated camera stack.
If you prefer to use Snapmaker's original camera stack instead, create:

```bash
touch /oem/.camera-native
By default, the extended firmware uses a custom hardware-accelerated camera stack (paxx12).
If you prefer to use Snapmaker's original camera stack instead, edit `/home/lava/printer_data/config/extended/extended.cfg`:

```ini
[camera]
# stack: paxx12
stack: snapmaker
logs: syslog
```

Note: Only one camera stack can be operational at a time.
Then reboot the printer.

Note: Only one camera stack can be operational at a time. See [Extended Configuration](extended_config.md) for details.

## Enable Camera Logging
## Camera Logging

To enable syslog logging for camera services (useful for debugging), create:
Camera service logging to syslog is controlled by the `logs` setting in `/home/lava/printer_data/config/extended/extended.cfg`:

```bash
touch /oem/.camera-log
```ini
[camera]
stack: paxx12
logs: syslog
```

This will enable the `--syslog` flag for all camera-related services. Logs will then be available in `/var/log/messages`.
This enables the `--syslog` flag for all camera-related services. Logs are available in `/var/log/messages`. See [Extended Configuration](extended_config.md) for details.

## Timelapse Support

Expand Down
87 changes: 87 additions & 0 deletions docs/extended_config.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,87 @@
# Extended Configuration

**Available in: Extended firmware**

The extended configuration file `/home/lava/printer_data/config/extended/extended.cfg` allows you to customize firmware behavior.

## Configuration File Location

```
/home/lava/printer_data/config/extended/extended.cfg
```

## Editing the Configuration File

The `extended.cfg` file is automatically created by the firmware.

### Via Fluidd/Mainsail

1. On the printer, go to **Settings > Maintenance > Advanced Mode** and enable it
2. Open Fluidd or Mainsail in your web browser (`http://<printer-ip>`)
3. Go to the **Configuration** tab
4. Navigate to the root directory and open `extended.cfg`
5. Add or modify your configuration options (see below)
6. Save the file
7. Reboot the printer

### Via SSH

```bash
ssh lava@<printer-ip>
vi /home/lava/printer_data/config/extended/extended.cfg
```

After saving, reboot the printer.

## Configuration Options

### [camera]

* `stack` - Camera stack selection (only one can be active)

* `paxx12` - Hardware-accelerated v4l2-mpp camera stack (WebRTC, timelapse)
* `snapmaker` - Native Snapmaker camera service

* `logs` - Camera service logging destination

* `syslog` - Enable logging to syslog (/var/log/messages)

## Example Configuration

```ini
[camera]
stack: paxx12
# stack: snapmaker
logs: syslog
```

## Important Notes

- After making changes to `extended.cfg`, reboot the printer
- The file uses INI-style format with sections `[camera]` and `[web]`
- Lines starting with `#` are comments and ignored
- Only one camera stack can be active at a time

## Revert back to defaults

If you decide to go back to default extended configuration,
simply remove or rename `extended` folder in Fluidd/Mainsail.

## Recovery from Extended Configuration issue

If you break Moonraker with an invalid configuration, the printer will not connect to WiFi on next boot.

To recover:

1. Create an empty file named `extended-recover.txt` on a USB stick
2. Insert the USB stick into the printer
3. Restart the printer
4. The extended configuration folder will be backed up to `extended.bak`
5. The printer will start with a fresh configuration
6. Remove the USB stick and the `extended-recover.txt` file will be automatically deleted

## Related Documentation

- [Camera Support](camera_support.md) - Camera features and WebRTC streaming
- [Klipper and Moonraker Custom Includes](klipper_includes.md) - Add custom configuration files
- [Data Persistence](data_persistence.md) - Understanding persistent storage
27 changes: 13 additions & 14 deletions docs/klipper_includes.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@ The `enable-klipper-includes` overlay adds support for custom Klipper and Moonra

This overlay modifies the default Klipper and Moonraker configurations to include user-defined configuration files from specific directories:

- Klipper includes from: `klipper/*.cfg`
- Moonraker includes from: `moonraker/*.cfg`
- Klipper includes from: `extended/klipper/*.cfg`
- Moonraker includes from: `extended/moonraker/*.cfg`

## Usage

Expand Down Expand Up @@ -51,23 +51,22 @@ aspect_ratio: 16:9

## Important Notes

- All `.cfg` files in the `klipper/` folder are automatically included.
- All `.cfg` files in the `moonraker/` folder are automatically included.
- Configuration files persist across reboots.
- Placeholder files (`00_keep.cfg`) are automatically created in both folders with helpful comments.
- Do not modify or remove the `00_keep.cfg` placeholder files.
- Test changes carefully to avoid breaking the printer configuration.
- Invalid configuration will prevent Klipper/Moonraker from starting.
- All `.cfg` files in the `extended/klipper/` folder are automatically included
- All `.cfg` files in the `extended/moonraker/` folder are automatically included
- Configuration files persist across reboots
- Do not modify or remove the `00_keep.cfg` placeholder files
- Test changes carefully to avoid breaking the printer configuration
- Invalid configuration will prevent Klipper/Moonraker from starting

## Recovery from Moonraker Issues
## Recovery from Extended Firmware Configuration Issues

If you break Moonraker with an invalid configuration, the printer will not connect to WiFi on next boot.

To recover:

1. Create an empty file named `moonraker-recover.txt` on a USB stick
1. Create an empty file named `extended-recover.txt` on a USB stick
2. Insert the USB stick into the printer
3. Restart the printer
4. The Moonraker configuration folder will be backed up to `moonraker.bak`
5. Moonraker will start with a fresh configuration
6. Remove the USB stick and the `moonraker-recover.txt` file will be automatically deleted
4. The configuration folder will be backed up to `extended.bak`
5. The printer will start with a fresh configuration
6. Remove the USB stick and the `extended-recover.txt` file will be automatically deleted
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
#!/bin/sh

start() {
if [ -f /mnt/udisk/extended-recover.txt ]; then
if [ -d /home/lava/printer_data/config/extended ]; then
mkdir -p /home/lava/printer_data/config/extended.bak
mv -r /home/lava/printer_data/config/extended/. /home/lava/printer_data/config/extended.bak
fi
rm -f /mnt/udisk/extended-recover.txt
fi

mkdir -p /home/lava/printer_data/config
cp -rn /home/lava/default-config/. /home/lava/printer_data/config/
chown -R lava:lava /home/lava/printer_data/config
}

case "$1" in
start)
start
;;
stop)
;;
restart|reload)
start
;;
*)
echo "Usage: $0 {start|stop|restart}"
exit 1
;;
esac

exit 0
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
# DO NOT REMOVE THIS FILE

[camera]
stack: paxx12
# stack: snapmaker
# logs: syslog
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
#!/usr/bin/env python3

import sys
import configparser

cfg_file, section, key, default = sys.argv[1:5]

cfg = configparser.ConfigParser()
cfg.read(cfg_file)

value = (
cfg.get(section, key, fallback=default).strip()
if cfg.has_section(section)
else default
)

print(value if value else default)
Original file line number Diff line number Diff line change
@@ -1,13 +1,12 @@
diff -uNr rootfs.original/home/lava/origin_printer_data/config/printer.cfg rootfs/home/lava/origin_printer_data/config/printer.cfg
--- rootfs.original/home/lava/origin_printer_data/config/printer.cfg 2025-11-06 05:01:19.000000000 +0100
+++ rootfs/home/lava/origin_printer_data/config/printer.cfg 2025-12-04 10:31:52.832922872 +0100
@@ -1258,4 +1258,7 @@
@@ -1258,4 +1258,6 @@
#*# max_x = 240.0
#*# min_y = 20.0
#*# max_y = 240.0
-#*#
\ No newline at end of file
+#*#
+
+[include /home/lava/klipper-config/*.cfg]
+[include klipper/*.cfg]
+[include extended/klipper/*.cfg]
Original file line number Diff line number Diff line change
@@ -1,10 +1,9 @@
diff -uNr rootfs.original/home/lava/origin_printer_data/config/moonraker.conf rootfs/home/lava/origin_printer_data/config/moonraker.conf
--- rootfs.original/home/lava/origin_printer_data/config/moonraker.conf 2025-11-06 05:00:27.000000000 +0100
+++ rootfs/home/lava/origin_printer_data/config/moonraker.conf 2025-12-04 10:32:47.613494428 +0100
@@ -46,3 +46,6 @@
@@ -46,3 +46,5 @@
mqtt_protocol: v5
status_interval: 2
default_qos: 1
+
+[include /home/lava/moonraker-config/*.cfg]
+[include moonraker/*.cfg]
+[include extended/moonraker/*.cfg]

This file was deleted.

This file was deleted.

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,10 +1,12 @@
--- a/etc/init.d/S99camera_service
+++ b/etc/init.d/S99camera_service
@@ -3,6 +3,8 @@
@@ -3,6 +3,10 @@
# Start/stop camera_service process
#

+[ -e /oem/.camera-native ] || exit 0

+EXTENDED_CFG="/home/lava/printer_data/config/extended/extended.cfg"
+CAMERA_STACK=$(/usr/local/bin/extended-config.py "$EXTENDED_CFG" camera stack paxx12)
+[ "$CAMERA_STACK" = "snapmaker" ] || exit 0
+
log()
{
Expand Down
Original file line number Diff line number Diff line change
@@ -1,15 +1,18 @@
#!/bin/sh

[ ! -e /oem/.camera-native ] || exit 0
EXTENDED_CFG="/home/lava/printer_data/config/extended/extended.cfg"
CAMERA_STACK=$(/usr/local/bin/extended-config.py "$EXTENDED_CFG" camera stack paxx12)

[ "$CAMERA_STACK" != "snapmaker" ] || exit 0

# Create temporary directory for timelapse files
umask 0022
mkdir -p /userdata/.tmp_timelapse
chown -R lava:lava /userdata/.tmp_timelapse

CMD_FAKE_SERVICE=/usr/local/bin/fake-service
CMD_FAKE_SERVICE_ARGS="--retry 3"
if [ -e /oem/.camera-log ]; then
CAMERA_LOGS=$(/usr/local/bin/extended-config.py "$EXTENDED_CFG" camera logs "")
if [ "$CAMERA_LOGS" = "syslog" ]; then
CMD_FAKE_SERVICE_ARGS="$CMD_FAKE_SERVICE_ARGS --syslog"
fi

Expand Down
Loading