diff --git a/.gitignore b/.gitignore index 25ee046..d8dd753 100644 --- a/.gitignore +++ b/.gitignore @@ -1 +1 @@ -.wav +*.wav diff --git a/README.md b/README.md index 8d61f4c..0095b6e 100644 --- a/README.md +++ b/README.md @@ -16,7 +16,7 @@ - Install Armbian Bionic. https://www.armbian.com/orange-pi-zero-plus-2-h3/ - Then SSH into the device. ```bash -$ sudo apt install -y git xtightvncserver +$ sudo apt install -y git tightvncserver # Install Node.js $ git clone https://github.com/tj/n /tmp/n && cd /tmp/n && sudo make install @@ -27,6 +27,11 @@ $ cd ~/ $ git clone https://github.com/xpertsavenue/WiringOP-Zero ## Please refer to https://github.com/xpertsavenue/WiringOP-Zero +# Enable spi interface +$ sudo vi /boot/armbianEnv.txt # or use armbian-config +! overlays=spi-spidev analog-codec usbhost2 usbhost3 ++ param_spidev_spi_bus=1 + # Setup vncserver $ mkdir ~/.vnc $ vncpasswd ~/.vnc/passwd @@ -37,10 +42,12 @@ $ cd ~/macmini $ sudo ./install.sh # copy ypur assests -$ cp /path/to/vmac.rom ~/macmini/minivmac/vmac.rom # Mini vMac ROM file +$ cp /path/to/vmac.rom ~/macmini/minivmac/vMac.ROM # Mini vMac ROM file $ cp /path/to/vmac.dsk ~/macmini/minivmac/system.dsk # Mini vMac disk file $ cp /path/to/.basilisk_ii_prefs ~/.basilisk_ii_prefs # Basilisk II config file $ cp /path/to/macboot.wav ~/macmini/macboot.wav # Boot sound (optional) + +$ sudo reboot now ``` - [Tips]: Here is my working [.basilisk_ii_prefs](basilisk_ii_prefs.md). @@ -70,9 +77,9 @@ $ cp /path/to/macboot.wav ~/macmini/macboot.wav # Boot sound (optional) 5. `~/macmini/switcher/gpio-reader.js` watchs the push SW at GPIO7(PA06) and send a request to `localhost:5501/`. ### How does the low-res LCD(320x240) handle 512x384 resolution? -Internally `xthighvncserver` and `ssvncviewer` are used to scale the display. +Internally `tightvncserver` and `ssvncviewer` are used to scale the display. - e.g. [`1_large_minimac.sh`]((./switcher/sh.d/1_large_minimac.sh)) launches: - - `xthighvncserver` to create a virtual display (512x384) at `DISPLAY=:1` (`:5901`) + - `tightvncserver` to create a virtual display (512x384) at `DISPLAY=:1` (`:5901`) - `minivmac` in `DISPLAY:1` - `ssvncviewer -scale 0.625` in `DISPLAY:0` (By the `-scale` option, low-res LED get upscaled) ## Gallery diff --git a/config/.xsession b/config/.xsession new file mode 100755 index 0000000..a4b1502 --- /dev/null +++ b/config/.xsession @@ -0,0 +1,3 @@ +#!/bin/bash +. ~/.profile +. ~/.xinitrc diff --git a/install.sh b/install.sh index 9c59fb4..2a0c869 100755 --- a/install.sh +++ b/install.sh @@ -1,10 +1,10 @@ #! /bin/bash -[ $(id -u) -gt 0 ] && echo Please run as root! && exit 1 +[ $(id -u) -gt 0 ] && echo Please run with sudo && exit 1 -set +x +set -x -apt install -y -q \ +apt update && apt install -y -q \ bluez \ tightvncserver \ ssvnc \ @@ -14,19 +14,30 @@ apt install -y -q \ matchbox-window-manager \ nodm \ xserver-xorg-input-libinput \ + xserver-xorg-video-fbdev \ + x11-apps \ + xinit \ + xfonts-base \ xloadimage \ + tmux \ + sl \ pulseaudio \ pulseaudio-esound-compat \ pulseaudio-utils \ pavucontrol +fc-cache -fv # just in case + cp -a config/.xinitrc ~/.xinitrc +cp -a config/.xsession ~/.xsession cp -a config/xstartup ~/.vnc/ cp config/99-fbdev.conf /etc/X11/xorg.conf.d/ cp config/fbtft.conf /etc/modprobe.d/ +echo fbtft_device > /etc/modules-load.d/fbtft.conf cp config/asound.conf /etc/ cp config/rc.local /etc/ +sed -i.orig -e "s/NODM_USER=root/NODM_USER=${USER}/" /etc/default/nodm -cd switcher && npm install +sudo -u $SUDO_USER sh -c "cd switcher && npm i --production" echo Done! diff --git a/switcher/package-lock.json b/switcher/package-lock.json index f017fc2..d91dbc1 100644 --- a/switcher/package-lock.json +++ b/switcher/package-lock.json @@ -1,5 +1,5 @@ { - "name": "switcher", + "name": "mm-switcher", "version": "1.0.0", "lockfileVersion": 1, "requires": true, @@ -895,6 +895,11 @@ "integrity": "sha512-1nh45deeb5olNY7eX82BkPO7SSxR5SSYJiPTrTdFUVYwAl8CKMA5N9PjTYkHiRjisVcxcQ1HXdLhx2qxxJzLNQ==", "dev": true }, + "node-fetch": { + "version": "2.6.0", + "resolved": "https://registry.npmjs.org/node-fetch/-/node-fetch-2.6.0.tgz", + "integrity": "sha512-8dG4H5ujfvFiqDmVu9fQ5bOHUC15JMjMY/Zumv26oOvvVJjM67KF8koCWIabKQ1GJIa9r2mMZscBq/TbdOcmNA==" + }, "on-finished": { "version": "2.3.0", "resolved": "https://registry.npmjs.org/on-finished/-/on-finished-2.3.0.tgz", @@ -935,6 +940,11 @@ "wordwrap": "~1.0.0" } }, + "orange-pi-gpio": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/orange-pi-gpio/-/orange-pi-gpio-1.0.2.tgz", + "integrity": "sha1-NL9Yr1K36Nujz17MVbJS3MYnMow=" + }, "os-tmpdir": { "version": "1.0.2", "resolved": "https://registry.npmjs.org/os-tmpdir/-/os-tmpdir-1.0.2.tgz", diff --git a/switcher/package.json b/switcher/package.json index 1fc842c..6939feb 100644 --- a/switcher/package.json +++ b/switcher/package.json @@ -12,7 +12,9 @@ "author": "", "license": "ISC", "dependencies": { - "express": "^4.16.3" + "express": "^4.16.3", + "node-fetch": "^2.6.0", + "orange-pi-gpio": "^1.0.2" }, "devDependencies": { "eslint": "^6.5.1", @@ -20,4 +22,4 @@ "eslint-plugin-prettier": "^3.1.1", "prettier": "^1.18.2" } -} \ No newline at end of file +} diff --git a/switcher/sh.d/1_large_minimac.sh b/switcher/sh.d/1_large_minimac.sh index c687c46..9079c40 100755 --- a/switcher/sh.d/1_large_minimac.sh +++ b/switcher/sh.d/1_large_minimac.sh @@ -5,4 +5,5 @@ vncserver -geometry 512x384 ssvncviewer -scale 0.625 :1 -fullscreen -passwd ~/.vnc/passwd & DISPLAY=:1 cd ~/macmini/minivmac -./minivmac.512 vmac.rom system.dsk +DISKS=$(ls *dsk | grep -v system.dsk | xargs) +./minivmac.512 system.dsk ${DISKS} diff --git a/switcher/sh.d/2_minimac.sh b/switcher/sh.d/2_minimac.sh index b7d163d..7fd474f 100755 --- a/switcher/sh.d/2_minimac.sh +++ b/switcher/sh.d/2_minimac.sh @@ -5,4 +5,5 @@ vncserver -geometry 320x240 ssvncviewer -scale 1 :1 -fullscreen -passwd ~/.vnc/passwd & DISPLAY=:1 cd ~/macmini/minivmac -./minivmac.320 vmac.rom system.dsk +DISKS=$(ls *dsk | grep -v system.dsk | xargs) +./minivmac.320 system.dsk ${DISKS}