News:

LATEST RELEASE:  FPP 8.5.1 - Download from here - https://github.com/FalconChristmas/fpp/releases/tag/8.5

+-+-

+-User

Welcome, Guest.
Please login or register.
 
 
 
Forgot your password?

+-Site Stats

Members
Total Members: 16950
Latest: izpele
New This Month: 3
New This Week: 3
New Today: 2
Stats
Total Posts: 135659
Total Topics: 17027
Most Online Today: 143
Most Online Ever: 7634
(January 21, 2020, 02:14:03 AM)
Users Online
Members: 1
Guests: 115
Total: 116

Anyone with a PiFace?

Started by CaptainMurdoch, July 29, 2014, 09:44:58 AM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

CaptainMurdoch

Quote from: patdelaney on August 16, 2014, 08:07:11 PM
No it's still not working. I remember you saying that it had to be restarted.

OK, one more try...  The PiFace doesn't pull up the inputs automatically, so we have to explicitly turn on pull-up.  Either the Python code this for me or I may have done it from the command line in my testing yesterday. This isn't an issue with the resistor circuit we are using on the Pi's BCM GPIO inputs because the external circuit does the pull-up.

I just pushed a fix to enable pull-up on the PiFace GPIO lines that are configured and was able to use the PiFace inputs after a reboot without running any external commands.

If you run "gpio -p readall" from the command line after pulling in the new code, then you should see the 'Digital' column contains a '1' for any PiFace input you have enabled in the FPP UI.  When you push a PiFace button (and hold), and run "gpio -p readall" again while the button is pushed, you should see that line go low to 0 and the event should fire in FPP.
-
Chris

patdelaney

I am extremely happy to report that the latest fix for the pull up resistor works. I am able to use on-board buttons as well as an external n/o push button.  ;D


Feature request: (hopefully it's there already but not exposed yet)
Is there a way to individually program the inputs for n/c rather than n/o. I have an motion sensor that it's contacts are normally closed. When someone passes by the sensor and it triggers, it opens the contacts. Can we add the ability to toggle the mode of each input?

Pat

Thank you for this recent fix.  ;D

patdelaney

So after a little google searching, I believe that the Piface will support n/c contacts, but I think we may need a user definable toggle for the inputs so FPP treats them as n/c.  See link: http://www.element14.com/community/message/92110/l/quick-question-hopefully-on-piface-inputs#92110

The poster is trying to do the same thing I would like to do.

Pat

just a thought for the UI

[attachment deleted by admin]

CaptainMurdoch

Thanks for the confirmation of working status.

I have thought of the NC vs NO situation but wasn't planning on doing it until I worked on adding the GPIO output.  I think it would be relatively easy to add though so I will think about it today and see about making the addition before v0.4.0.
-
Chris

patdelaney


gadgetsmith

I have a simple sequence loaded on FPP, called 'sequence1.fseq'
I've created a script, called 'script1.sh' which I created in windows notepad and uploaded to FPP through file manager.
I've created an event called lightsON, which calls script1.sh
I've associated PiFace buttons 1 and 4 to trigger the event lightsON.

When attempting to run script1 from the FPP Status Control/Events screen, the FPPD always stops.  I'm pretty sure it's because I don't write scripts, and i've used pat's example and removed the path while substituting my own sequence name.  I know the PiFace is likely working as when I push button 1 or 4, it also causes the FPPD to stop, but not buttons 2 or 3.  :)

The contents of my script (script1.sh) are simply this:

#!/bin/sh
fpp -P sequence1

I did read somewhere about having to make the script file executable, but how would that be done if we are not working in the pi environment?  I was thinking maybe the upload in the file manger might do this automatically.

Any help appreciated.
Thanks.


MyKroFt

notepad does not create the correct line endings that unix/linux expects - nook for notepad+ or textpad.  when you save your script file, make sure to select the unix file type when you save.

Tony

Materdaddy

Quote from: MyKroFt on August 18, 2014, 10:48:45 AM
notepad does not create the correct line endings that unix/linux expects - nook for notepad+ or textpad.  when you save your script file, make sure to select the unix file type when you save.

Tony

I put code in (a while ago) that was attempting to fix this problem, but I don't know if it works... https://github.com/FalconChristmas/fpp/blob/stage/www/fppxml.php#L359

My Pi at home isn't currently booted, so I can't test this until tonight.

patdelaney

Quote from: gadgetsmith on August 18, 2014, 10:35:51 AM
I have a simple sequence loaded on FPP, called 'sequence1.fseq'
I've created a script, called 'script1.sh' which I created in windows notepad and uploaded to FPP through file manager.
I've created an event called lightsON, which calls script1.sh
I've associated PiFace buttons 1 and 4 to trigger the event lightsON.

When attempting to run script1 from the FPP Status Control/Events screen, the FPPD always stops.  I'm pretty sure it's because I don't write scripts, and i've used pat's example and removed the path while substituting my own sequence name.  I know the PiFace is likely working as when I push button 1 or 4, it also causes the FPPD to stop, but not buttons 2 or 3.  :)

The contents of my script (script1.sh) are simply this:

#!/bin/sh
fpp -P sequence1

I did read somewhere about having to make the script file executable, but how would that be done if we are not working in the pi environment?  I was thinking maybe the upload in the file manger might do this automatically.

Any help appreciated.
Thanks.

you can log into the pi either at the console or ssh into it.
go to the scripts directory
cd /home/pi/media/scripts

then edit the file on the pi using nano

nano /home/pi/media/scripts/script1.sh

even it the file Looks ok save it anyway to cleanaup any garbage.

can you run the script manually?  Does it cause the fppd to stop?

CaptainMurdoch

Quote from: MyKroFt on August 18, 2014, 10:48:45 AM
notepad does not create the correct line endings that unix/linux expects - nook for notepad+ or textpad.  when you save your script file, make sure to select the unix file type when you save.


As Mat mentioned, we have code in fppxml.php to convert these, but when I just tested, it wasn't working for me for some reason, so I replaced it with a patch that has been sitting in my TODO list and pushed to github after confirming the new code is working to strip the carriage returns from my test script.

Even before that change though, I could not get fppd to crash with a file with embedded carriage returns.  At most, I received a warning from bash about the extra characters in the script:

    /home/pi/media/scripts/Stop_Playlist.sh: line 2: $'\r': command not found

We do not parse the script directly in side fppd, so I don't know why fppd would be crashing when trying to run the script.  If you can test manually as Pat described, that would help.  If it still fails, I can give you some other commands to try which would help pinpoint the line of code where it is failing.
-
Chris

gadgetsmith

Quote from: MyKroFt on August 18, 2014, 10:48:45 AM
notepad does not create the correct line endings that unix/linux expects - nook for notepad+ or textpad.  when you save your script file, make sure to select the unix file type when you save.

Tony

That's was it.  Chose notepad++, did a "save as..." .sh (unix), and everything works.  Thanks!

@Pat - thanks for that info.  I was trying to avoid doing that as i'll be mostly using a Windows PC to sequence, access FPP, write scripts, etc. so this will save some time.  I can just create scripts and drag and drop them into the correct media folders now.  Simple.  Gonna mess around with PuTTY sometime too. Thanks!

@Matterdaddy - i'm no programmer, but if I wanted to be reckless, i'd basically take the modified fppxml.php file in your link, then copy it to the appropriate location on the SD card?  Reboot, and try again with my windows notepad script ?


CaptainMurdoch

Quote from: gadgetsmith on August 18, 2014, 12:33:17 PM
@Pat - thanks for that info.  I was trying to avoid doing that as i'll be mostly using a Windows PC to sequence, access FPP, write scripts, etc. so this will save some time.  I can just create scripts and drag and drop them into the correct media folders now.  Simple.  Gonna mess around with PuTTY sometime too. Thanks!

If you are copying the files over the network instead of uploading through the UI then that explains it.  We need to think of a way to correct the linefeeds in files that aren't uploaded via the web interface.
-
Chris

Materdaddy

Quote from: gadgetsmith on August 18, 2014, 12:33:17 PM
@Matterdaddy - i'm no programmer, but if I wanted to be reckless, i'd basically take the modified fppxml.php file in your link, then copy it to the appropriate location on the SD card?  Reboot, and try again with my windows notepad script ?

What I linked is(was) on your Pi.  It's old code that was meant to remove windows newlines for people writing scripts in Notepad (or other windows editors not configured to use unix line endings).  From Chris' reply, it didn't quite work anyways... I thought I tested it when I coded it, but vaguely remember some other point realizing something wasn't working (maybe I committed something slightly different than I tested with) but never went back.

Sounds like he's got a fix in now though, so hopefully we don't have to deal with this anymore.

That being said, it sounds as though there may still be something to look into.  You were having FPPD crash or stop when trying to run a script with windows newlines in it.  That shouldn't happen.  Can you upload logs for us to look at?

gadgetsmith

I'd be happy to attach log files.  Want them all in a zip file?  Log Level right now is 'Info', and the only check box is 'Most'.  Just tell me what you want.


I've dragged and dropped two script files to the FPP.  Both produced with Windows Notepad; but one contains exactly 1 extra carriage return (CR), the other does not.
When attempting to trigger an event with the CR script, FPPD stops.  I can restart FPPD without any trouble.
When attempting to trigger an event with the non-CR script, it runs just fine.  I can force stop the running sequence from the status page, re-trigger the event and it runs again with no problem.
This is the weird one:
IF I attempt to trigger the event for the CR script, AFTER having run the non-CR script, the sequence will actually begin, but it does not show as running in the player status on the status page.  I have used the 'stop FPPD' in order to stop the sequence from running, but after that, I am unable to re-start FPPD, until a reboot.  Just to note; the lights stop sequencing but remain ON when I 'stop FPPD', and go OFF when I hit 'start FPPD'.

If I use the Upload Manager on the FPP to upload the CR script, it will run without any problems at all.  :)  Looks like that bit of code is working for me.

The long and short of this whole thing is that if you use something like notepad to create a script with inadvertent CR's, and then use something like explorer to drag and drop files onto the FPP, this may cause the FPPD to stop when trying to run the script.

I'd be happy to provide further info if your interested.

Materdaddy

Change the level to "Debug" and leave "Most" checked.

Then, can you run the triggered event with the CR script.

After that, you can use the "Download ZIP" button on the logs tab of the upload manager.  This will create a zip of all the log files we'd be interested in looking at and prompt you to download them from the Pi.  If you can attach them here, that will hopefully give us enough to figure out why FPPD stops for you in this scenario.

Support FPP

+- Recent Topics

Help with migration to new controller by dkulp
June 02, 2025, 06:49:46 AM

Abnormal conditions, received bridging data while sequence is running by Paulanator
June 01, 2025, 05:07:39 PM

CycleRandomSequences by seaton road xmas lights
June 01, 2025, 03:30:58 AM

Can't connect through FPP Proxy by Poporacer
May 29, 2025, 12:28:05 PM

Is it possible to either output multiple overlay lines on LED Matrix? by bobbond000
May 28, 2025, 09:51:53 AM

Something changed when using FPP Connect by andywylde
May 27, 2025, 09:22:56 PM

PiCap V2 - newbie questions by jnealand
May 27, 2025, 07:17:39 AM

Can't get past Initial Setup by ukkeef
May 26, 2025, 12:25:02 PM

FPP 8.4 released! by Santacarl
May 22, 2025, 01:24:42 PM

possible interference: Solved by darylc
May 17, 2025, 10:28:48 PM

Powered by EzPortal
Powered by SMFPacks Menu Editor Mod