161 lines
12 KiB
Plaintext
161 lines
12 KiB
Plaintext
|
|
Episode: 2963
|
|||
|
|
Title: HPR2963: A walk through my PifaceCAD Python code – Part 3
|
|||
|
|
Source: https://hub.hackerpublicradio.org/ccdn.php?filename=/eps/hpr2963/hpr2963.mp3
|
|||
|
|
Transcribed: 2025-10-24 13:56:52
|
|||
|
|
|
|||
|
|
---
|
|||
|
|
|
|||
|
|
This is HPR Episode 2963 for Wednesday 11th of December 2019.
|
|||
|
|
Today's show is entitled, A Walk Through My Pipe Faced Cat Cold Part 3.
|
|||
|
|
It's part of the series, a little bit of Python, and is hosted by MrX.
|
|||
|
|
It's about 15 minutes long and carries an explicit flag.
|
|||
|
|
The summary is, in this episode I cover functions,
|
|||
|
|
activates it when a button is pushed on the Pipe Faced Cat Board.
|
|||
|
|
This episode of HPR is brought to you by An Honesthost.com.
|
|||
|
|
Get 15% discount on all shared hosting with the offer code HPR15.
|
|||
|
|
That's HPR15.
|
|||
|
|
Better web hosting that's Honest and Fair at An Honesthost.com.
|
|||
|
|
And welcome Hacker Public Radio audience.
|
|||
|
|
My name is MrX, and welcome to this podcast.
|
|||
|
|
As usual, I'd like to start by thanking the people at HPR for making this service available
|
|||
|
|
to us all.
|
|||
|
|
It's Juliet and invaluable service and needs here into troops.
|
|||
|
|
HPR is a community-led podcast provided by the community for the community.
|
|||
|
|
That means you can contribute too.
|
|||
|
|
I'm sure you must have something interesting we'd love to hear.
|
|||
|
|
Well, I give it a go.
|
|||
|
|
You might even enjoy it.
|
|||
|
|
OK, in this episode, I'm continuing covering my Python script that I wrote for my PipeFace command
|
|||
|
|
and display add-on board for my Raspberry Pi.
|
|||
|
|
Hopefully this isn't boring you all to tears.
|
|||
|
|
In this episode, I cover the functions that are controlled basically by the buttons on
|
|||
|
|
the thing itself.
|
|||
|
|
It's got buttons.
|
|||
|
|
That's basically what I cover.
|
|||
|
|
Anyway, here we go.
|
|||
|
|
Sit back and enjoy.
|
|||
|
|
So finally, we get on to the buttons.
|
|||
|
|
Now, this is going to be a ridiculously long podcast, so I'm going to have to break this
|
|||
|
|
up, I think, which would delight Kenneth Fallon.
|
|||
|
|
So, def button zero, define button zero, button zero, that's a function, and that's the
|
|||
|
|
very first button, bottom left hand corner.
|
|||
|
|
If you push that, print, play slash pause button.
|
|||
|
|
This prints a message to the LCD and toggles between play and pause for podcasts.
|
|||
|
|
Then run it in it display to display available options.
|
|||
|
|
Yeah, so I'll do that for podcasts.
|
|||
|
|
I'll do a different thing for audiobooks and a different thing if you're on a system menu.
|
|||
|
|
I haven't actually explained what does it, if it's in these other menus, but oh well,
|
|||
|
|
there you go.
|
|||
|
|
So, I've just lost my place here.
|
|||
|
|
Button one, it's the track information button.
|
|||
|
|
This message to LCD, then displays current, also track information, but it's information
|
|||
|
|
about the current track that's playing.
|
|||
|
|
So print message to LCD, then display current mock track information, such as the state
|
|||
|
|
of mock p, current time, time left, so current time within the track, time left, current
|
|||
|
|
playlist number, of total playlist number.
|
|||
|
|
How many?
|
|||
|
|
So you're in track two of 100 or something like that, you know?
|
|||
|
|
And finally, track title, so yeah, so that's basically what that does.
|
|||
|
|
It's quite a long, convoluted thing to pull all that information together.
|
|||
|
|
I won't bore you with it.
|
|||
|
|
I've got a, below the function, I've got an example output from mock p, so when you
|
|||
|
|
do, I think it's mock p dash i, and it gives you information about the current track
|
|||
|
|
for the state of mock, the file, the title, the artist, the song title, the album, total
|
|||
|
|
time, time left, total set, current time, current set, bit rate, average bit rate, rate.
|
|||
|
|
So I don't use all of those things, but I grab a, a, a, a pass bits from that, it comes
|
|||
|
|
out of mock p, so yeah, that's, that's button, so my button one is it, yeah, which is actually
|
|||
|
|
second button, because it starts at zero, so that's the second button along, third button
|
|||
|
|
along, which is button two, just to confuse things, a previous track button, button is
|
|||
|
|
only active if button is pushed twice within 0.3 seconds, this was added to stop moving
|
|||
|
|
to new track by accidental pushing of button, if menu is 0 or 1, and value of variable time
|
|||
|
|
if is less than 0.3, then print message to LCD and move to previous track and playlist,
|
|||
|
|
if menu equals 2 and button pressed twice within 0.3 seconds, then display number of
|
|||
|
|
HPR shows in the queue. All right, so that just, that just basically, so if you're in a system
|
|||
|
|
menu and you, and you double tap this button, then it, it, it, it runs the command to show
|
|||
|
|
how many, shows there's an queue basically, and if you're in a menu one or menu, menu, zero
|
|||
|
|
or menu one, then it, it, it goes to the previous track, either in audio books or podcasts, so
|
|||
|
|
yeah, button three, well that does the same, but it goes to the next track rather than
|
|||
|
|
a previous track, and if you're in, if you're in a system menu, what does it do? Oh, but
|
|||
|
|
button currently has no function if menu equals 2, I feel an assistant menu, which is menu
|
|||
|
|
two, that does nothing. So menu zero is podcasts, menu one, it's audio books and menu two is system,
|
|||
|
|
yeah. All right, button four, toggle backlight button, if first time button is pushed since power on,
|
|||
|
|
then turn off Blinkstick and display main menu else, toggle LCD backlight between on and off,
|
|||
|
|
so what this does is, when you first turn the device on, it runs a thing to check how many
|
|||
|
|
shows are, how many shows are available in the HPR queue, and once it shows that, if you push this
|
|||
|
|
fourth button, it's the fourth button along, on the bottom, along the bottom, sorry, fifth button,
|
|||
|
|
it's button four, but it's a fifth button, because it goes zero, one, two, three, four, so fifth
|
|||
|
|
button, if you push that one, and it's the first time the thing's been switched on, then it clears
|
|||
|
|
the screen and takes you to the main menu, so it removes the number of shows and a queue message
|
|||
|
|
basically, but if, once that's happened once, then the button has a different function after that,
|
|||
|
|
what it does is it toggles the backlight on and off, so here that's that, so the next function,
|
|||
|
|
mock seek, used to seek backwards or forward and track being played in mock p, seek position as a
|
|||
|
|
global variable, when these terrible global variables, global variable used to store the current seek
|
|||
|
|
position, its value changes up and down when using button six and seven, so yeah, so yeah,
|
|||
|
|
it's just a function, but it isn't directly accessible from a button, it's just a function
|
|||
|
|
called mock seek, that's right, so next button, button five, there's a kind of jog wheel at the top
|
|||
|
|
of the device, and you can either push it to the left, it swings to the left, you can swing it to
|
|||
|
|
the right, or you can push it down, so pushing it down is what they call button five, which is
|
|||
|
|
actually the sixth button, remember, just to confuse things, so jog switch, this button is selected
|
|||
|
|
by momentally pushing in the left right toggle button, just as I said, a button located
|
|||
|
|
on top of unit, if menu equals zero or one has podcaster audio books, then if not in seek menu,
|
|||
|
|
then display seek menu, if in seek menu, then jump forward or backward and track by the amount
|
|||
|
|
currently displayed on the seek menu, this uses function mock seek, and if menu equals two,
|
|||
|
|
system menu, then get date and time information, clear the screen, turn on LCD backlight,
|
|||
|
|
print the shutdown message with the date and time info to LCD, and then issue the shutdown command,
|
|||
|
|
so yeah, that's what that one does, button six, live jog switch, decrements through menus,
|
|||
|
|
also used during seek, this button is selected by momentarily pushing the toggle switch to
|
|||
|
|
the left, button located on top of unit, button only active if more than 0.3 seconds has passed
|
|||
|
|
since it was last pushed, this was added to get around switch bounds, causing multiple jumps
|
|||
|
|
in menu, think left and right jog switch is a bit noisy, if in seek menu seek, just in decrements
|
|||
|
|
by one, until seek menu is reached and then returns to zero, each time the display is updated with
|
|||
|
|
the decremented value stored in a dictionary seek display, if not in seek menu, menu decrements
|
|||
|
|
down by one until menu min is reached, then rolls over to menu max, if in seek menu, session decrements
|
|||
|
|
by one, if not in seek menu, menu decrements, oh I, yes, so basically if you're in a seek menu,
|
|||
|
|
so you get into the seek menu by, right, let me explain how this works, so basically if you just
|
|||
|
|
get the unit running and you push it to the left, then or left or right, then it goes up and down
|
|||
|
|
the menus, you've got menu zero, menu one, menu two, as I said before, menu zero is audio is podcasts,
|
|||
|
|
menu one is audio works, menu two is system, all right, if you push that this toggle switch in,
|
|||
|
|
then it goes into seek menu, now if you use the left right toggle switch, rather than going through
|
|||
|
|
the menus, it increases, increments are decrements, the amount of seek time you're going to seek in the
|
|||
|
|
current track, and if you don't do anything to it and push it again, it comes out of that,
|
|||
|
|
but if you, if you increment it or decrement it, then push the select button, then it'll jump
|
|||
|
|
the track by that amount, basically, so that's how, how button six works, and button seven does
|
|||
|
|
opposite, increments are supposed to decrements, so I won't go through that, print IR code,
|
|||
|
|
use during debugging to get remote control working, came from pyface examples page,
|
|||
|
|
print IR code, that's soft explanatory, IR play, if the play button is pushed on the remote control
|
|||
|
|
twice within half a second, and if IR is active, then toggle backlight and toggle between play and pause,
|
|||
|
|
okay, so that was you, play and pause, basically, but only if you've activated the IR, then through
|
|||
|
|
the infrared sensor, which is somewhere else in here I suppose, IR info, if the info button
|
|||
|
|
pause is pushed on the remote control twice within half a second, and if the IR is active,
|
|||
|
|
then toggle backlight and display on the LCD information about the current track,
|
|||
|
|
like the other one, it toggles backlight just to give you a visual cue that the remote controls
|
|||
|
|
worked, basically, and you've got IR rewind, that rewind to track, IR forward, that forwards the track,
|
|||
|
|
IR stop that, if the stop button is pushed on the remote control, and if IR is active, then
|
|||
|
|
all right, the stop button just toggles backlight actually, and IR blue, right, so this is the thing that
|
|||
|
|
activates the infrared sensor, so activate and deactivate and deactivate IR buttons on the remote
|
|||
|
|
control, turns blinkstick on red when IR active, when blue button is pushed twice within half a
|
|||
|
|
second on remote control, toggles backlight and display momentarily and display momentarily
|
|||
|
|
message on LCD display, giving IR status, i.e. is the remote control buttons active or deactivate,
|
|||
|
|
all remote buttons bar this one are affected, this feature was added to remotely disable all the
|
|||
|
|
buttons, while using the TV remote control media buttons, these would sometimes fall so check
|
|||
|
|
our things, the double push of the blue button within half a second was added as sometimes a
|
|||
|
|
single push of it was acquired on my TV, and this would also force to activate things,
|
|||
|
|
yeah, I really need to remote controls, feature added to check if our first pass is set to true,
|
|||
|
|
i.e. backlight button 4 has not been pushed since boot, button 4 normally toggles backlight,
|
|||
|
|
but turns off HPR QLED first time is pushed after boot, that's the other thing that happens, so
|
|||
|
|
just to be a bit of a confusion there, that was an added feature,
|
|||
|
|
must do the same thing is pushing the light button i guess, but that way you can do using the remote
|
|||
|
|
control to clear the HPR Q screen, okay I think that's a convenient place to stop and hopefully
|
|||
|
|
you have an all form of sleep, so if you want to contact me, I can be contacted at mrx at
|
|||
|
|
hpr at googlemail.com, that's mrxathtpr theat symbol googlemail.com, so until next time thank you
|
|||
|
|
goodbye
|
|||
|
|
you've been listening to hecopobletgradio at hecopobletgradio.org
|
|||
|
|
we are a community podcast network that releases shows every weekday, Monday through Friday,
|
|||
|
|
today's show, like all our shows, was contributed by an hpr listener like yourself,
|
|||
|
|
if you ever thought of recording a podcast and click on our contributing to find out how easy it
|
|||
|
|
really is, hecopobletgradio was founded by the digital dog pound and the infonomicon computer club
|
|||
|
|
and is part of the binary revolution at binwreff.com, if you have comments on today's show,
|
|||
|
|
please email the host directly leave a comment on the website or record a follow-up episode yourself
|
|||
|
|
unless otherwise stated, today's show is released on the create of comments,
|
|||
|
|
attribution, share a light 3.0 license
|