From befde37c4b1097f2cd4110eec415f01fc9a7e1de Mon Sep 17 00:00:00 2001 From: openoms Date: Mon, 20 May 2019 12:35:47 +0100 Subject: [PATCH] refactor --- alternative.platforms/display.alternatives.sh | 269 ++++++------------ 1 file changed, 81 insertions(+), 188 deletions(-) diff --git a/alternative.platforms/display.alternatives.sh b/alternative.platforms/display.alternatives.sh index ebe352d..474df8c 100644 --- a/alternative.platforms/display.alternatives.sh +++ b/alternative.platforms/display.alternatives.sh @@ -28,121 +28,33 @@ else echo "OK running ${baseImage}" fi -if [ "${baseImage}" = "raspbian" ]; then - OPTIONS=(GPIO "Install the default display available from Amazon" \ - HDMI "Install the 3.5\" HDMI display from Aliexpress" \ - SWISS "Install the Swiss version from play-zone.ch" - ) - - CHOICE=$(dialog --backtitle "RaspiBlitz - Display Install" --clear --title "Display Install" --menu "Choose a your diplay:" 10 70 6 "${OPTIONS[@]}" 2>&1 >/dev/tty) - - if [ "${CHOICE}" = "GPIO" ]; then - - # *** RASPIBLITZ / LCD (at last - because makes a reboot) *** - # based on https://www.elegoo.com/tutorial/Elegoo%203.5%20inch%20Touch%20Screen%20User%20Manual%20V1.00.2017.10.09.zip - +OPTIONS=(GPIO "Install the default display available from Amazon" \ + HDMI "Install the 3.5\" HDMI display from Aliexpress" \ + SWISS "Install the Swiss version from play-zone.ch" +) +CHOICE=$(dialog --backtitle "RaspiBlitz - Display Install" --clear --title "Display Install" --menu "Choose a your diplay:" 10 70 6 "${OPTIONS[@]}" 2>&1 >/dev/tty) + +if [ "${CHOICE}" = "GPIO" ]; then + # *** RASPIBLITZ / LCD (at last - because makes a reboot) *** + # based on https://www.elegoo.com/tutorial/Elegoo%203.5%20inch%20Touch%20Screen%20User%20Manual%20V1.00.2017.10.09.zip + # revert font change + # based on https://www.raspberrypi-spy.co.uk/2014/04/how-to-change-the-command-line-font-size/ + sudo sed -i 's/FONTFACE="TerminusBold"/FONTFACE="Fixed"/' /etc/default/console-setup + sudo sed -i 's/FONTSIZE="12x24"/FONTSIZE="8x16"/' /etc/default/console-setup + + cd /home/admin/ + rm -r LCD-show + git clone https://github.com/goodtft/LCD-show.git + sudo chmod -R 755 LCD-show + sudo chown -R admin:admin LCD-show + cd LCD-show/ + + if [ "${baseImage}" != "dietpi" ]; then echo "--> LCD DEFAULT" - cd /home/admin/ sudo apt-mark hold raspberrypi-bootloader - rm -r LCD-show - git clone https://github.com/goodtft/LCD-show.git - sudo chmod -R 755 LCD-show - sudo chown -R admin:admin LCD-show - cd LCD-show/ sudo ./LCD35-show - - elif [ "${CHOICE}" = "HDMI" ]; then - echo "Installing the 3.5\" HDMI display from Aliexpress" - - # based on http://www.lcdwiki.com/3.5inch_HDMI_Display-B - rm -r LCD-show - git clone https://github.com/goodtft/LCD-show.git - sudo chmod -R 755 LCD-show - cd LCD-show/ - #sudo ./MPI3508-show - sudo rm -rf /etc/X11/xorg.conf.d/40-libinput.conf - sudo cp -rf ./boot/config-35-480X320.txt /boot/config.txt - sudo cp ./usr/cmdline.txt /boot/ - sudo cp ./usr/inittab /etc/ - sudo cp -rf ./usr/99-fbturbo.conf-HDMI /usr/share/X11/xorg.conf.d/99-fbturbo.conf - sudo mkdir -p /etc/X11/xorg.conf.d - sudo cp -rf ./usr/99-calibration.conf-3508 /etc/X11/xorg.conf.d/99-calibration.conf - - # based on https://www.raspberrypi-spy.co.uk/2014/04/how-to-change-the-command-line-font-size/ - # sudo sed -i 's/FONTFACE="Fixed"/FONTFACE="TerminusBold"/' /etc/default/console-setup - # sudo sed -i 's/FONTSIZE="8x16"/FONTSIZE="12x24"/' /etc/default/console-setup - - echo "***" - echo "reboot with \`sudo reboot\` to make the LCD work" - echo "***" - - exit - - elif [ "${CHOICE}" = "SWISS" ]; then - - # Download and install the driver - # based on http://www.raspberrypiwiki.com/index.php/3.5_inch_TFT_800x480@60fps - - echo "--> LCD ALTERNATIVE" - cd /boot - sudo wget http://www.raspberrypiwiki.com/download/RPI-HD-35-INCH-TFT/dt-blob-For-3B-plus.bin - sudo mv dt-blob-For-3B-plus.bin dt-blob.bin - cat <> config.txt - - dtparam=spi=off - dtparam=i2c_arm=off - - # Set screen size and any overscan required - overscan_left=0 - overscan_right=0 - overscan_top=0 - overscan_bottom=0 - framebuffer_width=800 - framebuffer_height=480 - - - enable_dpi_lcd=1 - display_default_lcd=1 - dpi_group=2 - dpi_mode=87 - dpi_output_format=0x6f015 - - # set up the size to 800x480 - hdmi_timings=480 0 16 16 24 800 0 4 2 2 0 0 0 60 0 32000000 6 - - #rotate screen - display_rotate=3 - - dtoverlay=i2c-gpio,i2c_gpio_scl=24,i2c_gpio_sda=23 - fi -EOF - init 6 - fi -fi - - -if [ "${baseImage}" = "dietpi" ]; then - - OPTIONS=(GPIO "Install the default display available from Amazon" \ - HDMI "Install the 3.5\" HDMI display from Aliexpress" \ - SWISS "Install the Swiss version from play-zone.ch" - ) - - CHOICE=$(dialog --backtitle "RaspiBlitz - Display Install" --clear --title "Display Install" --menu "Choose a your diplay:" 10 70 6 "${OPTIONS[@]}" 2>&1 >/dev/tty) - - if [ "${CHOICE}" = "GPIO" ]; then - echo "Installing the default display available from Amazon" - - # based on https://www.elegoo.com/tutorial/Elegoo%203.5%20inch%20Touch%20Screen%20User%20Manual%20V1.00.2017.10.09.zip - cd /home/admin/ - #sudo apt-mark hold raspberrypi-bootloader - rm -r LCD-show - git clone https://github.com/goodtft/LCD-show.git - sudo chmod -R 755 LCD-show - sudo chown -R admin:admin LCD-show - cd LCD-show/ - # sudo ./LCD35-show + else sudo rm -rf /etc/X11/xorg.conf.d/40-libinput.conf sudo mkdir /etc/X11/xorg.conf.d sudo cp ./usr/tft35a-overlay.dtb /boot/overlays/ @@ -152,93 +64,74 @@ if [ "${baseImage}" = "dietpi" ]; then sudo cp ./usr/cmdline.txt /DietPi/ sudo cp ./usr/inittab /etc/ sudo cp ./boot/config-35.txt /DietPi/config.txt - - # revert font change - # based on https://www.raspberrypi-spy.co.uk/2014/04/how-to-change-the-command-line-font-size/ - sudo sed -i 's/FONTFACE="TerminusBold"/FONTFACE="Fixed"/' /etc/default/console-setup - sudo sed -i 's/FONTSIZE="12x24"/FONTSIZE="8x16"/' /etc/default/console-setup - echo "***" echo "reboot with \`sudo reboot\` to make the LCD work" echo "***" - exit + fi - elif [ "${CHOICE}" = "HDMI" ]; then - echo "Installing the 3.5\" HDMI display from Aliexpress" - - # based on http://www.lcdwiki.com/3.5inch_HDMI_Display-B - rm -r LCD-show - git clone https://github.com/goodtft/LCD-show.git - sudo chmod -R 755 LCD-show - cd LCD-show/ - #sudo ./MPI3508-show - sudo rm -rf /etc/X11/xorg.conf.d/40-libinput.conf +elif [ "${CHOICE}" = "HDMI" ]; then + echo "Installing the 3.5\" HDMI display from Aliexpress" + + # based on http://www.lcdwiki.com/3.5inch_HDMI_Display-B + rm -r LCD-show + git clone https://github.com/goodtft/LCD-show.git + sudo chmod -R 755 LCD-show + cd LCD-show/ + #sudo ./MPI3508-show + sudo rm -rf /etc/X11/xorg.conf.d/40-libinput.conf + + if [ "${baseImage}" != "dietpi" ]; then + sudo cp -rf ./boot/config-35-480X320.txt /boot/config.txt + sudo cp ./usr/cmdline.txt /boot/ + else sudo cp -rf ./boot/config-35-480X320.txt /DietPi/config.txt sudo cp ./usr/cmdline.txt /DietPi/ - sudo cp ./usr/inittab /etc/ - sudo cp -rf ./usr/99-fbturbo.conf-HDMI /usr/share/X11/xorg.conf.d/99-fbturbo.conf - sudo mkdir -p /etc/X11/xorg.conf.d - sudo cp -rf ./usr/99-calibration.conf-3508 /etc/X11/xorg.conf.d/99-calibration.conf - - # based on https://www.raspberrypi-spy.co.uk/2014/04/how-to-change-the-command-line-font-size/ - sudo sed -i 's/FONTFACE="Fixed"/FONTFACE="TerminusBold"/' /etc/default/console-setup - sudo sed -i 's/FONTSIZE="8x16"/FONTSIZE="12x24"/' /etc/default/console-setup - - echo "***" - echo "reboot with \`sudo reboot\` to make the LCD work" - echo "***" - - exit - - elif [ "${CHOICE}" = "SWISS" ]; then - - # Download and install the driver - # based on http://www.raspberrypiwiki.com/index.php/3.5_inch_TFT_800x480@60fps + fi + sudo cp ./usr/inittab /etc/ + sudo cp -rf ./usr/99-fbturbo.conf-HDMI /usr/share/X11/xorg.conf.d/99-fbturbo.conf + sudo mkdir -p /etc/X11/xorg.conf.d + sudo cp -rf ./usr/99-calibration.conf-3508 /etc/X11/xorg.conf.d/99-calibration.conf + # based on https://www.raspberrypi-spy.co.uk/2014/04/how-to-change-the-command-line-font-size/ + sudo sed -i 's/FONTFACE="Fixed"/FONTFACE="TerminusBold"/' /etc/default/console-setup + sudo sed -i 's/FONTSIZE="8x16"/FONTSIZE="12x24"/' /etc/default/console-setup + echo "***" + echo "reboot with \`sudo reboot\` to make the LCD work" + echo "***" + exit - echo "--> LCD ALTERNATIVE" - - # revert font change - # based on https://www.raspberrypi-spy.co.uk/2014/04/how-to-change-the-command-line-font-size/ - sudo sed -i 's/FONTFACE="TerminusBold"/FONTFACE="Fixed"/' /etc/default/console-setup - sudo sed -i 's/FONTSIZE="12x24"/FONTSIZE="8x16"/' /etc/default/console-setup - +elif [ "${CHOICE}" = "SWISS" ]; then + # Download and install the driver + # based on http://www.raspberrypiwiki.com/index.php/3.5_inch_TFT_800x480@60fps + echo "--> LCD ALTERNATIVE" + if [ "${baseImage}" != "dietpi" ]; then + cd /boot + else cd /DietPi - sudo wget http://www.raspberrypiwiki.com/download/RPI-HD-35-INCH-TFT/dt-blob-For-3B-plus.bin - sudo mv dt-blob-For-3B-plus.bin dt-blob.bin - cat <> config.txt - - dtparam=spi=off - dtparam=i2c_arm=off - - # Set screen size and any overscan required - overscan_left=0 - overscan_right=0 - overscan_top=0 - overscan_bottom=0 - framebuffer_width=800 - framebuffer_height=480 - - - enable_dpi_lcd=1 - display_default_lcd=1 - dpi_group=2 - dpi_mode=87 - dpi_output_format=0x6f015 - - # set up the size to 800x480 - hdmi_timings=480 0 16 16 24 800 0 4 2 2 0 0 0 60 0 32000000 6 - - #rotate screen - display_rotate=3 - - dtoverlay=i2c-gpio,i2c_gpio_scl=24,i2c_gpio_sda=23 fi + sudo wget http://www.raspberrypiwiki.com/download/RPI-HD-35-INCH-TFT/dt-blob-For-3B-plus.bin + sudo mv dt-blob-For-3B-plus.bin dt-blob.bin + cat <> config.txt +dtparam=spi=off +dtparam=i2c_arm=off +# Set screen size and any overscan required +overscan_left=0 +overscan_right=0 +overscan_top=0 +overscan_bottom=0 +framebuffer_width=800 +framebuffer_height=480 +enable_dpi_lcd=1 +display_default_lcd=1 +dpi_group=2 +dpi_mode=87 +dpi_output_format=0x6f015 +# set up the size to 800x480 +hdmi_timings=480 0 16 16 24 800 0 4 2 2 0 0 0 60 0 32000000 6 +#rotate screen +display_rotate=3 +dtoverlay=i2c-gpio,i2c_gpio_scl=24,i2c_gpio_sda=23 +fi EOF init 6 - fi - -else - echo "CANCEL" - exit fi \ No newline at end of file