I had 2 major problems, the first was that after loading up OctoPi and fixing the network settings, it would not automatically launch TouchUI. TouchUI is the plugin for the touchscreen that I was using. The second was getting the webcam to show up in OctoPrint. I did not come up with most of this myself, but I found bits and pieces which got it working - pretty sure much of it was from https://github.com/BillyBlaze/OctoPrint-TouchUI
Problem 1: TouchUI was not auto-starting, it was stuck at the RPI login prompt (black screen with just the RPI boot stuff and a login prompt). I did not see anything about TouchUI loading or even trying to. Running "chromium-browser" when logged in to the Raspberry Pi did not launch anything.
The problem I found was that the directories for TouchUI were missing:
pi@octopi:~ $ sudo xinit ~/TouchUI-autostart/chromium.xinit
X.Org X Server 1.18.4
Release Date: 2016-07-19
X Protocol Version 11, Revision 0
Build Operating System: Linux 4.4.26-v7+ armv7l Raspbian
Current Operating System: Linux octopi 4.14.31-v7+ #1104 SMP Thu Mar 29 16:52:18 BST 2018 armv7l
Kernel command line: 8250.nr_uarts=0 bcm2708_fb.fbwidth=800 bcm2708_fb.fbheight=480 bcm2708_fb.fbswap=1 vc_mem.mem_base=0x3ec00000 vc_mem.mem_size=0x40000000 dwc_otg.lpm_enable=0 console=ttyS0,115200 console=tty1 root=PARTUUID=6d1620bc-02 rootfstype=ext4 elevator=deadline fsck.repair=yes rootwait
Build Date: 11 November 2016 11:59:59AM
xorg-server 2:1.18.4-2+rpi1 (https://www.debian.org/support)
Current version of pixman: 0.33.3
Before reporting problems, check http://wiki.x.org
to make sure that you have the latest version.
Markers: (--) probed, (**) from config file, (==) default setting,
(++) from command line, (!!) notice, (II) informational,
(WW) warning, (EE) error, (NI) not implemented, (??) unknown.
(==) Log file: "/var/log/Xorg.0.log", Time: Fri Mar 30 15:44:15 2018
(==) Using system config directory "/usr/share/X11/xorg.conf.d"
xinit: Unable to run program "/home/pi/TouchUI-autostart/chromium.xinit": No such file or directory <<<<<<<<<<<<
Specify a program on the command line or make sure that /usr/bin
is in your path.
xinit: connection to X server lost
waiting for X server to shut down (II) Server terminated successfully (0). Closing log file.
pi@octopi:~ $ more /home/pi/TouchUI-autostart/chromium.xinit << confirmed
/home/pi/TouchUI-autostart/chromium.xinit: No such file or directory
In fact there was no "/home/pi/TouchUI-autostart" directory:
pi@octopi:~ $ cd /home/pi/
pi@octopi:~ $ ls
mjpg-streamer OctoPrint oprint scripts
To fix, I re-ran steps 7-10 here:
github.com/BillyBlaze/OctoPrint-TouchUI/wiki/Setup:-Boot-to-Browser-(OctoPi-or-Jessie-Light)
That is:
git clone https://github.com/BillyBlaze/OctoPrint-TouchUI-autostart.git ~/TouchUI-autostart/
sudo cp ~/TouchUI-autostart/touchui.init /etc/init.d/touchui
sudo chmod +x /etc/init.d/touchui
sudo cp ~/TouchUI-autostart/touchui.default /etc/default/touchui
sudo update-rc.d touchui defaults
then ran:
chromium-browser
(got errors below - which per the how-to from BillyBlaze are OK):
pi@octopi:~ $ chromium-browser
bootstrap_helper: /usr/lib/chromium-browser/nacl_helper: Cannot open ELF file! errno=2
[1:1:0330/154102.649795:ERROR:nacl_fork_delegate_linux.cc(315)] Bad NaCl helper startup ack (0 bytes)
[928:928:0330/154102.722478:ERROR:browser_main_loop.cc(495)] Failed to put Xlib into threaded mode.
[928:928:0330/154102.805867:ERROR:browser_main_loop.cc(272)] Gtk: cannot open display:
rebooted and it worked - that is it loaded TouchUI after booting up:
reboot
----------------------------------------------------------------------------------------------
Problem 2: The webcam was not showing up in OctoPrint under the "control" tab. I confirmed it was working using VLC. I am using a older model Freetalk camera (http://freetalk.me/skype-camera/freetalkr-everyman-hd.html) so it will likely be different for other cameras with other resolutions.
First I set up the camera settings in the octopi.txt file:
su root
root@octopi:/home/pi# sudo nano /boot/octopi.txt
Uncomment (remove the #) for the box for:
camera="auto"
Uncomment (remove the #) for the box for the following and change the setting for the camera resolution:
camera_usb_options="-r 1280x720 -f 25"
After that, the webcam still had issues, was not showing up in TouchUI unless I set the IP of the Octopi as the URL for the stream. Problem was, I was using DHCP so the IP would change and I would prefer not to hard code it. I tried using the loopback or localhost but that did not work either. Decided the simplest thing to do was to run it with a static IP outside my routers DHCP pool or addresses.
To set a static IP for the WiFi on the OctoPi:
su root
nano /boot/octopi-network.txt
was:
## WPA/WPA2 secured
iface wlan0-octopi inet manual
wpa-ssid "Bananas-are-fun-fruit"
wpa-psk "haha-not-gonna-put-it-here"
Changed to:
## WPA/WPA2 secured
iface wlan0-octopi inet static
wpa-ssid "Bananas-are-fun-fruit"
wpa-psk "haha-not-gonna-put-it-here"
address 192.168.1.123
netmask 255.255.255.0
broadcast 192.168.1.255
gateway 192.168.1.1
And set the address for the webcam stream in the GUI for OctoPrint (settings > Webcam and Timelapse) as follows:
http://192.168.1.123:8080/?action=stream
and used 16:9 as the aspect ratio. Now it works and I can view the camera under the control tab in OctoPrint, and also from TouchUI's camera screen.