99 lines
2.4 KiB
Markdown
99 lines
2.4 KiB
Markdown
# MainsailOS install
|
|
|
|
## Image
|
|
|
|
Start with MainsailOS from Raspberry Pi Imager install
|
|
|
|
## Driver update
|
|
|
|
Run `rpi-upate` to get at least kernel 6.6 and update camera driver
|
|
|
|
## Configuration files
|
|
|
|
Copy over configuration files from this repo to `~/printer_data/config/`
|
|
|
|
## Set up Klipper firmware
|
|
|
|
Check `~/printer_data/config/printer.cfg`, `[mcu]` section:
|
|
|
|
```ini
|
|
[mcu]
|
|
serial: /dev/serial/by-id/usb-1a86_USB2.0-Serial-if00-port0
|
|
baud: 250000
|
|
```
|
|
|
|
`250000` is fastest transfer supported by Ender 3 board. It needs to match baud setting in `make menuconfig` low-level settings:
|
|
|
|
```
|
|
[*] Enable extra low-level configuration options
|
|
Micro-controller Architecture (Atmega AVR) --->
|
|
Processor model (atmega1284p) --->
|
|
Processor speed (16Mhz) --->
|
|
Communication interface (UART0) --->
|
|
[ ] Compile for simulavr software emulation
|
|
(250000) Baud rate for serial port
|
|
() GPIO pins to set at micro-controller startup
|
|
```
|
|
|
|
```bash
|
|
cd ~/klipper
|
|
make clean
|
|
make menuconfig
|
|
make
|
|
make flash FLASH_DEVICE=/dev/ttyUSB0
|
|
```
|
|
|
|
(seems to work better than `make flash FLASH_DEVICE=/dev/serial/by-id/usb-1a86_USB2.0-Serial-if00-port0`)
|
|
|
|
Flashing fails sometimes. Possible workarounds:
|
|
|
|
- Klipper app is still talking to device? Shutdown firmware and app first?
|
|
- `/dev/ttypUSB0` and `/dev/serial/by-id/usb-1a86_USB2.0-Serial-if00-port0` are links to same device, but one works and other doesn't?
|
|
- Try rebooting Pi
|
|
|
|
## /boot
|
|
|
|
Copy `config.txt` and `cmdline.txt` from this repo.
|
|
|
|
## Zabbix agent
|
|
|
|
```bash
|
|
cd
|
|
wget https://repo.zabbix.com/zabbix/7.0/raspbian/pool/main/z/zabbix-release/zabbix-release_7.0-1+debian11_all.deb
|
|
sudo dpkg -i zabbix-release_7.0-1+debian11_all.deb
|
|
sudo apt update
|
|
sudo apt install zabbix-agent2
|
|
```
|
|
|
|
Update `/etc/zabbix/zabbix_agent2.conf` from `zabbix/zabbix_agent2.conf` in this repo.
|
|
|
|
Confirm `/etc/zabbix/*` files are owned by `zabbix:zabbix`.
|
|
|
|
```bash
|
|
sudo systemctl restart zabbix-agent2
|
|
sudo systemctl status zabbix-agent2
|
|
```
|
|
|
|
Copy current version of `bcmstat.sh` from [https://github.com/MilhouseVH/bcmstat] to `/usr/local/bin/bcmstat.sh`
|
|
|
|
Make zabbix dir:
|
|
|
|
```bash
|
|
mkdir /var/lib/zabbix
|
|
```
|
|
|
|
Add to root crontab:
|
|
|
|
```cron
|
|
* * * * * sh -c '/usr/local/bin/bcmstat.sh J1mH0Yqprg | tail -2 | head -1 >/var/lib/zabbix/bcmstat-from-host'
|
|
```
|
|
|
|
TODO: Set up Zabbix to retrieve and parse `/var/lib/zabbix/bcmstat-from-host`
|
|
|
|
## Fault finding
|
|
|
|
`vcgencmd measure_temp`
|
|
|
|
`vcgencmd commands`
|
|
|
|
`cd ~/crowsnest/bin/camera-streamer/tools/` |