fix up installer for all st7789's

This commit is contained in:
lady ada 2020-07-28 00:15:15 -04:00
parent 72596df87c
commit e2fe053c31

View file

@ -251,40 +251,22 @@ function update_configtxt() {
fi
if [ "${pitfttype}" == "st7789_240x320" ]; then
madctl=$(eval echo "\$MADCTL_$pitfttype$pitftrot")
if [ "${pitftrot}" == "90" ] || [ "${pitftrot}" == "270" ]; then
fbtftdevicerotate="rotate=90"
else
fbtftdevicerotate=""
fi
cat >> /etc/modprobe.d/fbtft.conf <<EOF
# --- added by adafruit-pitft-helper $date ---
options fbtft_device name=flexfb gpios=dc:25,cs:8,led:12 speed=40000000 bgr=1 fps=60 $fbtftdevicerotate
options flexfb setaddrwin=0 width=240 height=320 init=-1,0x11,-2,120,-1,$madctl,0x3A,0x05,-1,0x26,0x04,-1,0xBA,0x01,-1,0xB2,0x0C,0x0C,0x00,0x33,0x33,-1,0xB7,0x35,-1,0xBB,0x1A,-1,0xC0,0x2C,-1,0xC2,0x01,-1,0xC3,0x0B,-1,0xC4,0x20,-1,0xC6,0x0F,-1,0xD0,0xA4,0xA1,-1,0x21,-1,0xE0,0x00,0x19,0x1E,0x0A,0x09,0x15,0x3D,0x44,0x51,0x12,0x03,0x00,0x3F,0x3F,-1,0xE1,0x00,0x18,0x1E,0x0A,0x09,0x25,0x3F,0x43,0x52,0x33,0x03,0x00,0x3F,0x3F,-1,0x29,-3
# --- end adafruit-pitft-helper $date ---
EOF
echo "spi-bcm2835" >> /etc/modules
echo "flexfb" >> /etc/modules
echo "fbtft_device" >> /etc/modules
overlay=""
dtc -@ -I dts -O dtb -o /boot/overlays/drm-minipitft20.dtbo overlays/minipitft20-overlay.dts
overlay="dtoverlay=drm-minipitft20,rotation=${pitftrot}"
fi
if [ "${pitfttype}" == "st7789_240x240" ]; then
madctl=$(eval echo "\$MADCTL_$pitfttype$pitftrot")
cat >> /etc/modprobe.d/fbtft.conf <<EOF
# --- added by adafruit-pitft-helper $date ---
options fbtft_device name=flexfb gpios=dc:25,cs:8,led:26 speed=40000000 bgr=1 fps=60
options flexfb setaddrwin=0 width=240 height=240 init=-1,0x11,-2,120,-1,$madctl,0x3A,0x05,-1,0xB2,0x0C,0x0C,0x00,0x33,0x33,-1,0xB7,0x35,-1,0xBB,0x1A,-1,0xC0,0x2C,-1,0xC2,0x01,-1,0xC3,0x0B,-1,0xC4,0x20,-1,0xC6,0x0F,-1,0xD0,0xA4,0xA1,-1,0x21,-1,0xE0,0x00,0x19,0x1E,0x0A,0x09,0x15,0x3D,0x44,0x51,0x12,0x03,0x00,0x3F,0x3F,-1,0xE1,0x00,0x18,0x1E,0x0A,0x09,0x25,0x3F,0x43,0x52,0x33,0x03,0x00,0x3F,0x3F,-1,0x29,-3
# --- end adafruit-pitft-helper $date ---
EOF
echo "spi-bcm2835" >> /etc/modules
echo "flexfb" >> /etc/modules
echo "fbtft_device" >> /etc/modules
overlay=""
dtc -@ -I dts -O dtb -o /boot/overlays/drm-minipitft13.dtbo overlays/minipitft13-overlay.dts
overlay="dtoverlay=drm-minipitft13,rotation=${pitftrot}"
fi
if [ "${pitfttype}" == "st7789_240x135" ]; then
if [ "${pitfttype}" == "st7789_240x135" ]; then
dtc -@ -I dts -O dtb -o /boot/overlays/drm-minipitft114.dtbo overlays/minipitft114-overlay.dts
overlay="dtoverlay=drm-minipitft114,rotation=${pitftrot}"
fi
# any/all st7789's need their own kernel driver
if [ "${pitfttype}" == "st7789_240x240" ] || [ "${pitfttype}" == "st7789_240x320" ] || [ "${pitfttype}" == "st7789_240x135" ]; then
echo "############# UPGRADING KERNEL ###############"
sudo apt update || { warning "Apt failed to update itself!" && exit 1; }
sudo apt-get upgrade || { warning "Apt failed to install software!" && exit 1; }
@ -294,7 +276,6 @@ EOF
make -C /lib/modules/$(uname -r)/build M=$(pwd) modules || { warning "Apt failed to compile ST7789V driver!" && exit 1; }
mv /lib/modules/$(uname -r)/kernel/drivers/gpu/drm/tiny/mi0283qt.ko /lib/modules/$(uname -r)/kernel/drivers/gpu/drm/tiny/mi0283qt.BACK
mv st7789v_ada.ko /lib/modules/$(uname -r)/kernel/drivers/gpu/drm/tiny/mi0283qt.ko
overlay="dtoverlay=drm-minipitft114,rotation=${pitftrot}"
fi
date=`date`
@ -561,8 +542,8 @@ selectN "PiTFT 2.4\", 2.8\" or 3.2\" resistive (240x320)" \
"PiTFT 2.2\" no touch (240x320)" \
"PiTFT 2.8\" capacitive touch (240x320)" \
"PiTFT 3.5\" resistive touch (320x480)" \
"PiTFT Mini 1.3\" or 1.54\" display (240x240)" \
"MiniPiTFT 1.14\" display (240x135) - WARNING! CUTTING EDGE! WILL UPGRADE YOUR KERNEL TO LATEST" \
"PiTFT Mini 1.3\" or 1.54\" display (240x240) - WARNING! WILL UPGRADE YOUR KERNEL TO LATEST" \
"MiniPiTFT 1.14\" display (240x135) - WARNING! WILL UPGRADE YOUR KERNEL TO LATEST" \
"Uninstall PiTFT" \
"Quit without installing"
PITFT_SELECT=$?