Pi install

From: CHYRON (DSMITHHFX)22 Aug 2018 14:04
To: ANT_THOMAS 19 of 92
 :-&
From: Chris (CHRISSS)22 Aug 2018 17:06
To: ALL20 of 92
Sounds like a really good project. I look forward to seeing the results of it all.
From: CHYRON (DSMITHHFX)22 Aug 2018 17:29
To: Chris (CHRISSS) 21 of 92
Here's a preview:

From: graphitone22 Aug 2018 18:45
To: CHYRON (DSMITHHFX) 22 of 92
(fail)
From: graphitone22 Aug 2018 19:44
To: All 23 of 92
Ok, this portion of the script works really well, (thank you PB!)
 
Code: 
GPIO.setup(5, GPIO.IN, pull_up_down = GPIO.PUD_UP)


oldButtonState1 = True


while True:

    #grab the current button state
    buttonState1 = GPIO.input(5)


    # check to see if button has been pushed

    if buttonState1 != oldButtonState1 and buttonState1 == False:

        subprocess.call("echo 1 > /sys/class/backlight/rpi_backlight/bl_power && shutdown -h now", shell=True,

            stdout=subprocess.PIPE, stderr=subprocess.PIPE)

        oldButtonState1 = buttonState1



        time.sleep(.1)

On a click of the button it turns off the backlight and shuts the Pi down. I only need that one line as it automatically turns the backlight back on on a power up. However, although it was working initially on a rebuild, the sound's dropped off again. :C
From: CHYRON (DSMITHHFX)22 Aug 2018 20:05
To: graphitone 24 of 92
No? How about this:

From: graphitone22 Aug 2018 20:13
To: CHYRON (DSMITHHFX) 25 of 92
What you doing taking pictures of Throb's living room?
From: Peter (BOUGHTONP)22 Aug 2018 21:10
To: graphitone 26 of 92
"Somehow I've lost all sound"

My sound broke in Arch by doing something that buggered around with PulseAudio, which then fucked up ALSA, because PulseAudio is a buggy bloated piece of shit that nobody actually needs.

So maybe you installed/upgraded (possibly automatically) something that did fiddled with PA?

From: Peter (BOUGHTONP)22 Aug 2018 21:45
To: graphitone 27 of 92
You're still using the "Are we there yet? Are we there yet? ..." method instead of the "Tell me when we're there" one.

If you do really want to do it this way, since you only care about shutdown, you don't need to store/check oldButtonState and can simplify it to:

GPIO.setup(5, GPIO.IN, pull_up_down = GPIO.PUD_UP)

# endless loop until button is pressed
while GPIO.input(5):
	time.sleep(.1)

# verify button state before switching off
if not GPIO.input(5):
	subprocess.call("echo 1 > /sys/class/backlight/rpi_backlight/bl_power && shutdown -h now",
		shell=True,stdout=subprocess.PIPE, stderr=subprocess.PIPE)

The if verification is probably not necessary (depending on how Python works), but even so it acts as both a safety against unwanted shutdown (incase something goes wrong), and clarifies the intent slightly. (The event-driven/callback method would make it even clearer.)

From: Chris (CHRISSS)22 Aug 2018 21:54
To: CHYRON (DSMITHHFX) 28 of 92
:D
From: CHYRON (DSMITHHFX)23 Aug 2018 00:17
To: graphitone 29 of 92
Has he really got a 70s stereo system?
From: graphitone23 Aug 2018 08:33
To: Peter (BOUGHTONP) 30 of 92
Could well be.

IQaudIO produce this document (a pdf download) which seems to be wrriten in multiple styles and changes between being helpful and downright confusing.

I'll check the onboard audio is properly disabled and might go back to a vanilla image, and test the sound after every change made.

 
From: graphitone23 Aug 2018 08:36
To: Peter (BOUGHTONP) 31 of 92
Quote: 
You're still using the "Are we there yet? Are we there yet? ..." method instead of the "Tell me when we're there"



Other than being more optimised (and I appreciate the arguments for non-bloated code) does that have a knock on effect on real world performance or not?

Thanks for the suggestions though, I'll try that once I get the sound working again!.

 

From: CHYRON (DSMITHHFX)23 Aug 2018 09:13
To: graphitone 32 of 92
"changes between being helpful and downright confusing"

So standard documentation.
From: graphitone23 Aug 2018 11:48
To: CHYRON (DSMITHHFX) 33 of 92
(nod)

Pretty much. There's an indepth walkthrough of how to build a case with diagrams, then when it comes to installing a rotary encoder as a volume knob it's referencing external libraries and assumes ones knows how to call seperate processes as part of the code.

As a linux luddite, I'm able to fumble my way through most of it with online guides and PB's assistance, but it's not something I use everyday, so whatever I learn soon leaves my brain to be replaced with ingratiating one line lyrics from songs that seem to be on a permanent repeat. 
From: CHYRON (DSMITHHFX)23 Aug 2018 15:26
To: graphitone 34 of 92
I think many/most engineers who write their own documentation fail to appreciate the ambiguities of language, and assume users will be able to infer WTF they are talking about, and if they can't, tough shit you lose. I suppose we should be grateful even for that.  :C
From: Peter (BOUGHTONP)23 Aug 2018 19:58
To: graphitone 35 of 92
How does a sound card require 48 pages of documentation? :/

And what's wrong with the onboard sound that made you opt for this route?

From: graphitone23 Aug 2018 20:16
To: Peter (BOUGHTONP) 36 of 92
The onboard sound is crap. I've got a DAC setup on another Pi attached to my drawing desk and it really makes a difference, the audio is clean and sounds brilliant, way way better than the awful quality through the 3.5mm jack on the Pi.

 
From: Peter (BOUGHTONP)23 Aug 2018 20:30
To: graphitone 37 of 92
> does that have a knock on effect on real world performance or not?

Dunno - it has the potential to, but I suspect one instance isn't going to have much impact - but if you do get symptoms of the CPU being congested (e.g. stuttering audio or sluggish response), I'd check that first.

From: Peter (BOUGHTONP)23 Aug 2018 20:52
To: graphitone 38 of 92
Is that music-snob awful or actually bad? :/

The cards in that documentation look chunky - presumably mixing Pi extension cards can quickly give rise to compatibility/connectivity issues.