1

A rPi3 B+ is Raspbian configured with a 3.5 Waveshare touch display HAT.

There are two commands that toggle between the HDMI output and the HDMI output.

git clone https://github.com/waveshare/LCD-show.git
cd LCD-show
./LCD35-show #reboots device and directs video to LCD
./LCD-hdmi   #reboots device and directs video to HDMI port 

The desired boot algorithm \ script is:

if LCD is detected
   if LCD-hdmi flag is true (Video currently configured for HDMI)
      set LCD-hdmi flag false
      set LCD35-show flag true
      execute ./LCD35-show  #reboot with LCD Driver
else if LCD is not Detected 
   if LCD35-show  flag is true (Video currently configure LCD display)
      set LCD35-show flag false
      set LCD-hdmi flag true
      execute ./LCD-hdmi    #reboot with HDMI driver

flags must be persistent (survive reboots).

How can the display be detected from the command line? Bonus round: complete the script.

  • (1) Do you mean to translate from python to bash? (2) Does this python statement work? "execute ./LCD-hdmi"? (3) WaveShare tells you how to toggle, but not to detect. Perhaps use SPI read to "ping" the ILI9486 LCD References: (a) Waveshare toggle between_LCD_and_HDMI_display waveshare.com/wiki/… (b) Artillery [ILI9341] 3.2" LCD Touch Screen White Display and Driver Problem raspberrypi.stackexchange.com/questions/104600/…. Cheers. – tlfong01 Feb 3 '20 at 2:54
  • Yes, if not using spi to ping the LCD, alternative is to Rpi GPIO command to write to GPIO pin of back lit to check the “white screen” (See my last reference above). Good luck. Cheers. – tlfong01 Feb 3 '20 at 3:10
  • @tlfong01 Good to hear from you again. I was able to manually toggle screen output between the HDMI and touch display using BASH commands described in the OP. It would probably be simpler to keep everything in a BASH script that starts at boot time (if Python is required to perfom the task then that is fine). The first key step is to interrogate the GPIO to determine if the display is / is NOT present. You may recall from my other posting, that I am interested in building a thermostat with relays – gatorback Feb 3 '20 at 3:10
  • @tlfong01 Can you write up an example in an Answer as to how you would ping the LCD? Thank you – gatorback Feb 3 '20 at 3:12
  • Ah let me suggest how your can do it. (1) Find the device datasheet, and the register of the config register, or any register you can read the default contents, (2) Read that register using PSI read. If you can read what you expect, then the device is working. (3) The LCD controller chip I played with in the reference above is ILI9341. Yours might be ILI9486. (4) Let me see if I can find an example program. – tlfong01 Feb 3 '20 at 4:06

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.