Author Topic: GPIO trigger for 2 elements / models?  (Read 279 times)

Offline sielbear

  • Full Member
  • ***
  • Join Date: Oct 2013
  • Location:
  • Posts: 104
  • Kudos: 0
GPIO trigger for 2 elements / models?
« on: March 20, 2017, 01:41:04 PM »
I've got GPIO working, but I'm running into an issue with my setup.  I'd love some assistance with how to accomplish what I'm wanting to do.  Ideally, I'd just play an FSEQ with the GPIO input, but that doesn't appear to be possible unless I'm missing something. 

I have a single line of RGB lights as 1 element in the display.  The second element is a DJ light.  I need only 2 DMX channels for it to run in an auto mode. 

I can play a full FSEQ perfectly.  What I'm running into issues with is playing an ESEQ (and really an event trigger).  It seems I either need 2 ESEQ files (1 for the strip light and 1 for the DJ light) and a way to play both ESEQ files simultaneously OR the ability to play an FSEQ file. 

Any ideas?

Offline CaptainMurdoch

  • Administrator
  • *****
  • Join Date: Sep 2013
  • Location: Washington
  • Posts: 7,851
  • Kudos: 138
Re: GPIO trigger for 2 elements / models?
« Reply #1 on: March 20, 2017, 01:59:21 PM »
You can play two ESEQ files at the same time, you just need to start them up. There are sample scripts in the script repository for starting and stopping effect sequences.  You can't run a FSEQ directly, you have to put it in a playlist and start the playlist from a script.
-
Chris

Offline David_AVD

  • Newbie
  • *
  • Join Date: Jul 2014
  • Location: Victoria Point (QLD - Australia)
  • Posts: 40
  • Kudos: 0
    • da-Share
Re: GPIO trigger for 2 elements / models?
« Reply #2 on: March 20, 2017, 03:26:03 PM »
That caught me up too.  The GPIO triggers an event, which starts a playlist that contains one or more sequences.  Once I knew that the GPIO triggers were easy to setup.
da-share.com - the home of da_E131, da_DMX and other handy stuff

Offline sielbear

  • Full Member
  • ***
  • Join Date: Oct 2013
  • Location:
  • Posts: 104
  • Kudos: 0
Re: GPIO trigger for 2 elements / models?
« Reply #3 on: March 23, 2017, 02:48:07 PM »
Ok - so I'm still struggling here.  I've downloaded the script StartPlaylist.sh.  I've modified the file and entered the playlist "switch-1".  When I try to play the file with the trigger or the GPIO, I get the following in the fppd log file.  Note - the playlist works perfectly fine from the status page. 

The first section of logs is from the status page - works fine.  The second set of logs is from the button or trigger.  I can't remember which - both generate the same error.

2017-03-23 20:38:34 (21622) Playlist.cpp:235:Opening File Now /home/fpp/media/playlists/switch-1
2017-03-23 20:38:34 (21622) Playlist.cpp:158:Playlist Starting
2017-03-23 20:38:34 (21622) Scheduler.cpp:403:NowSecs = 419914, CurrEndSecs = -1 (-419915 seconds away)
2017-03-23 20:38:35 (21622) Scheduler.cpp:403:NowSecs = 419915, CurrEndSecs = -1 (-419916 seconds away)
2017-03-23 20:38:36 (21622) Scheduler.cpp:403:NowSecs = 419916, CurrEndSecs = -1 (-419917 seconds away)
2017-03-23 20:38:37 (21622) Scheduler.cpp:403:NowSecs = 419917, CurrEndSecs = -1 (-419918 seconds away)
2017-03-23 20:38:38 (21622) Scheduler.cpp:403:NowSecs = 419918, CurrEndSecs = -1 (-419919 seconds away)
2017-03-23 20:38:39 (21622) Scheduler.cpp:403:NowSecs = 419919, CurrEndSecs = -1 (-419920 seconds away)
2017-03-23 20:38:40 (21622) Scheduler.cpp:403:NowSecs = 419920, CurrEndSecs = -1 (-419921 seconds away)
2017-03-23 20:38:41 (21622) Scheduler.cpp:403:NowSecs = 419921, CurrEndSecs = -1 (-419922 seconds away)
2017-03-23 20:38:42 (21622) Scheduler.cpp:403:NowSecs = 419922, CurrEndSecs = -1 (-419923 seconds away)
2017-03-23 20:38:43 (21622) Scheduler.cpp:403:NowSecs = 419923, CurrEndSecs = -1 (-419924 seconds away)
2017-03-23 20:38:44 (21622) Scheduler.cpp:403:NowSecs = 419924, CurrEndSecs = -1 (-419925 seconds away)
2017-03-23 20:38:44 (21622) Playlist.cpp:90:Stopping Gracefully
2017-03-23 20:38:44 (21622) Playlist.cpp:506:Stopping Playlist
2017-03-23 20:38:45 (21622) Scheduler.cpp:439:Loading Schedule from /home/fpp/media/schedule
2017-03-23 20:38:45 (21622) Scheduler.cpp:516:Current Schedule: (Status: '+' = Enabled, '-' = Disabled, '!' = Outside Date Range, '*' = Repeat)
2017-03-23 20:38:45 (21622) Scheduler.cpp:517:St  Start & End Dates       Days         Start & End Times   Playlist
2017-03-23 20:38:45 (21622) Scheduler.cpp:518:--- ----------------------- ------------ ------------------- ---------------------------------------------
2017-03-23 20:38:45 (21622) Scheduler.cpp:439:Loading Schedule from /home/fpp/media/schedule
2017-03-23 20:38:45 (21622) Scheduler.cpp:516:Current Schedule: (Status: '+' = Enabled, '-' = Disabled, '!' = Outside Date Range, '*' = Repeat)
2017-03-23 20:38:45 (21622) Scheduler.cpp:517:St  Start & End Dates       Days         Start & End Times   Playlist
2017-03-23 20:38:45 (21622) Scheduler.cpp:518:--- ----------------------- ------------ ------------------- ---------------------------------------------
2017-03-23 20:38:52 (21622) Playlist.cpp:235:Opening File Now /home/fpp/media/playlists/switch-1
2017-03-23 20:38:52 (21622) Playlist.cpp:239:Could not open playlist file switch-1
2017-03-23 20:38:52 (21622) Playlist.cpp:293:PlaylistCount = 0. Exiting PlayListPlayingLoop

Offline David_AVD

  • Newbie
  • *
  • Join Date: Jul 2014
  • Location: Victoria Point (QLD - Australia)
  • Posts: 40
  • Kudos: 0
    • da-Share
Re: GPIO trigger for 2 elements / models?
« Reply #4 on: March 23, 2017, 03:00:55 PM »
You don't always need a script to start a playlist.  Create an event and assign the playlist to that event.  Then go into GPIO inputs and choose the event for either the rising or falling edge of the GPIO you're using.

Offline sielbear

  • Full Member
  • ***
  • Join Date: Oct 2013
  • Location:
  • Posts: 104
  • Kudos: 0
Re: GPIO trigger for 2 elements / models?
« Reply #5 on: March 23, 2017, 03:37:12 PM »
I see where I can specify an effect name, but not a sequence name.  I have 2 elements - 1 is a DJ light that will get static DMX data (to turn the light on and play a random sequence) and the second element is a gutter outline. 

In a perfect world, I'd create an effect file in xlights with the 2 elements in 1 model, but I don't seem to be smart enough to make that happen.  It works perfectly if I play a regular sequence file, however, the only way to play a sequence file (from what I can see) is to use a script to play a playlist. 

That's how I got where I am. 

Offline sielbear

  • Full Member
  • ***
  • Join Date: Oct 2013
  • Location:
  • Posts: 104
  • Kudos: 0
Re: GPIO trigger for 2 elements / models?
« Reply #6 on: March 23, 2017, 04:02:50 PM »
Ok - I got the model export to work - I was placing the elements on the wrong layer.  Doh! 

However....  I forgot I have a sound effect I want to play too, which I think means I'm going to have to play a regular playlist / sequence file + media.  So back to my "could not open playlist" error. 

Offline David_AVD

  • Newbie
  • *
  • Join Date: Jul 2014
  • Location: Victoria Point (QLD - Australia)
  • Posts: 40
  • Kudos: 0
    • da-Share
Re: GPIO trigger for 2 elements / models?
« Reply #7 on: March 23, 2017, 06:01:00 PM »
Sorry, you're right (I was going from memory).  You still need to have the event run a script which in turn starts a playlist.

This is basically what I did in my script:
Code: [Select]
#!/bin/sh
STARTITEM=""
PLAYLISTNAME="playlist_name_goes_here"
fpp -c stop
fpp -p "${PLAYLISTNAME}" ${STARTITEM}

Offline sielbear

  • Full Member
  • ***
  • Join Date: Oct 2013
  • Location:
  • Posts: 104
  • Kudos: 0
Re: GPIO trigger for 2 elements / models?
« Reply #8 on: March 23, 2017, 07:42:00 PM »
I am using the standard script, but I'm confused by the log message indicating the playlist cannot be opened.  Again, the playlist works fine from the status page.  It's just the script that's throwing the error.

Offline CaptainMurdoch

  • Administrator
  • *****
  • Join Date: Sep 2013
  • Location: Washington
  • Posts: 7,851
  • Kudos: 138
Re: GPIO trigger for 2 elements / models?
« Reply #9 on: March 23, 2017, 11:55:44 PM »
I'm going to go out on a limb and guess that your hyphen in the playlist name in the script isn't really a hyphen or there is some other stray non-ASCII Windows character in  your script.  Maybe try erasing the playlist name from inside the script editor in FPP and retyping it and saving again.

Offline sielbear

  • Full Member
  • ***
  • Join Date: Oct 2013
  • Location:
  • Posts: 104
  • Kudos: 0
Re: GPIO trigger for 2 elements / models?
« Reply #10 on: March 23, 2017, 11:58:45 PM »
Yeah- I tried renaming to "button1" in an effort to eliminate a naming problem, but that did not help.

I'll try editing the script with notepad++ tomorrow.

Offline CaptainMurdoch

  • Administrator
  • *****
  • Join Date: Sep 2013
  • Location: Washington
  • Posts: 7,851
  • Kudos: 138
Re: GPIO trigger for 2 elements / models?
« Reply #11 on: March 24, 2017, 12:15:52 AM »
If you don't figure it out, post a copy of the script as an attachment.  You might need to rename it to have a txt extension to attach.

 

Back to top