Skip to content

Commit

Permalink
v9.4
Browse files Browse the repository at this point in the history
- DietPi-Set_hardware | Reset all LCD settings before applying a new one, so that changes from one to another, without selecting "none" in between, works cleanly. For this, assure that all "Disable" functions are skipped on unsupported SBCs. Also hard fail when calling the "lcdpanel" command or giving an invalid/unsupported LCD name, or if an error-handled command fails.
  • Loading branch information
MichaIng committed May 11, 2024
1 parent fd8b25d commit 1cb5631
Showing 1 changed file with 28 additions and 25 deletions.
53 changes: 28 additions & 25 deletions dietpi/func/dietpi-set_hardware
Original file line number Diff line number Diff line change
Expand Up @@ -639,25 +639,25 @@ _EOF_
#/////////////////////////////////////////////////////////////////////////////////////
Lcd_Panel_Main()
{
(( $G_HW_MODEL > 19 )) && { Unsupported_Input_Name; return 1; } # Exit path for non-RPi/non-Odroid

# Reset all LCDs
Lcd_Panel_Waveshare32_Disable
Lcd_Panel_Odroidcloudshell_Disable
Lcd_Panel_Odroidcloudshell2_Disable
Lcd_Panel_OdroidLCD35_Disable
Lcd_Panel_ESP01215E_Disable
OLED_Allo_Boss2_Disable

case $INPUT_DEVICE_VALUE in
'odroid-lcd35') Lcd_Panel_OdroidLCD35_Enable;;
'waveshare32') Lcd_Panel_Waveshare32_Enable;;
'odroid-cloudshell') Lcd_Panel_Odroidcloudshell_Enable;;
'odroid-cloudshell2') Lcd_Panel_Odroidcloudshell2_Enable;;
'esp01215e') Lcd_Panel_ESP01215E_Enable;;
'allo-boss2-oled') OLED_Allo_Boss2_Enable;;
'none')
Lcd_Panel_Waveshare32_Disable
Lcd_Panel_Odroidcloudshell_Disable
Lcd_Panel_Odroidcloudshell2_Disable
Lcd_Panel_OdroidLCD35_Disable
Lcd_Panel_ESP01215E_Disable
OLED_Allo_Boss2_Disable
;;
*)
Unknown_Input_Mode
return 1
;;
'odroid-lcd35') Lcd_Panel_OdroidLCD35_Enable || return 1;;
'waveshare32') Lcd_Panel_Waveshare32_Enable || return 1;;
'odroid-cloudshell') Lcd_Panel_Odroidcloudshell_Enable || return 1;;
'odroid-cloudshell2') Lcd_Panel_Odroidcloudshell2_Enable || return 1;;
'esp01215e') Lcd_Panel_ESP01215E_Enable || return 1;;
'allo-boss2-oled') OLED_Allo_Boss2_Enable || return 1;;
'none') :;;
*) Unknown_Input_Mode; return 1;;
esac

# Update dietpi.txt entry
Expand All @@ -666,6 +666,8 @@ _EOF_

Lcd_Panel_ESP01215E_Enable(){

(( $G_HW_MODEL > 9 )) && { Unsupported_Input_Mode; return 1; } # Exit path for non-RPi

G_CONFIG_INJECT 'framebuffer_width=' 'framebuffer_width=1024' /boot/config.txt
G_CONFIG_INJECT 'framebuffer_height=' 'framebuffer_height=600' /boot/config.txt
G_CONFIG_INJECT 'SOFTWARE_CHROMIUM_RES_X=' "SOFTWARE_CHROMIUM_RES_X=1024" /boot/dietpi.txt
Expand Down Expand Up @@ -715,8 +717,6 @@ _EOF_

Lcd_Panel_Waveshare32_Enable(){

(( $G_HW_MODEL > 19 )) && { Unsupported_Input_Mode; return 1; } # Exit path for non-RPi/non-Odroid

# Disable 1st to reset any existing installations
Lcd_Panel_Waveshare32_Disable

Expand Down Expand Up @@ -836,11 +836,13 @@ _EOF_
# Odroid CloudShell: ToDo: Broken after fbtft_device kernel module does not exist anymore with Linux 5.4/6.1/6.6...
Lcd_Panel_Odroidcloudshell_Enable()
{
(( $G_HW_MODEL == 11 )) || { Unsupported_Input_Mode; return 1; } # Odroid XU4 only
G_CONFIG_INJECT 'spi_s3c64xx' 'spi_s3c64xx' /etc/modules
}

Lcd_Panel_Odroidcloudshell_Disable()
{
(( $G_HW_MODEL == 11 )) || return 0
G_EXEC sed --follow-symlinks -i '/^[[:blank:]]*spi_s3c64xx[[:blank:]]*/d' /etc/modules
}

Expand All @@ -856,7 +858,7 @@ _EOF_

Lcd_Panel_Odroidcloudshell2_Disable()
{
(( $G_HW_MODEL == 11 )) || { Unsupported_Input_Mode; return 1; } # Odroid XU4 only
(( $G_HW_MODEL == 11 )) || return 0
# udev rule to enable backlight power
[[ -f '/etc/udev/rules.d/dietpi-odroid-cloudshell2.rules' ]] && G_EXEC rm /etc/udev/rules.d/dietpi-odroid-cloudshell2.rules
# Device tree overlay
Expand All @@ -866,7 +868,7 @@ _EOF_
# Odroid LCD 3.5
Lcd_Panel_OdroidLCD35_Enable(){

(( $G_HW_MODEL > 9 && $G_HW_MODEL < 20 )) || { Unsupported_Input_Mode; return 1; } # Exit path for non-Odroid
(( $G_HW_MODEL > 9 )) || { Unsupported_Input_Mode; return 1; } # Exit path for non-Odroid

# Reset to disabled
Lcd_Panel_OdroidLCD35_Disable
Expand Down Expand Up @@ -970,7 +972,9 @@ EndSection
_EOF_
}

Lcd_Panel_OdroidLCD35_Disable(){
Lcd_Panel_OdroidLCD35_Disable()
{
(( $G_HW_MODEL > 9 )) || return 0 # Skip on non-Odroid

[[ -f '/etc/X11/xorg.conf.d/99-calibration.conf' ]] && G_EXEC rm /etc/X11/xorg.conf.d/99-calibration.conf
[[ -f '/etc/modprobe.d/odroid-lcd35.conf' ]] && G_EXEC rm /etc/modprobe.d/odroid-lcd35.conf
Expand All @@ -981,7 +985,6 @@ _EOF_
fi
[[ -d '/etc/systemd/system/odroid-lcd35.service.d' ]] && G_EXEC rm -R /etc/systemd/system/odroid-lcd35.service.d
[[ -f '/etc/X11/xorg.conf.d/99-odroid-lcd35.conf' ]] && G_EXEC rm /etc/X11/xorg.conf.d/99-odroid-lcd35.conf

}

OLED_Allo_Boss2_Enable(){
Expand Down Expand Up @@ -2384,7 +2387,7 @@ _EOF_
'wificountrycode') Wifi_Countrycode_Main;;
'i2c') I2c_Main;;
'spi') SPI_Main;;
'lcdpanel') Lcd_Panel_Main;;
'lcdpanel') Lcd_Panel_Main || EXIT_CODE=1;;
'rpi-opengl') RPi_OpenGL_Main;;
'eth-forcespeed') Eth_Force_Speed_Main;;
'remoteir') RemoteIR_Main;;
Expand Down

0 comments on commit 1cb5631

Please sign in to comment.