November 24, 2024, 08:45:23 AM

News:

Got VSA?  Want to use your Prop-SX?  Now you can!  See the VSA section of the Library forum for Prop-SX code that works with VSA.


AP-16+ relay

Started by JackMan, March 20, 2011, 12:07:05 PM

Previous topic - Next topic

JackMan

Jon,
   Would it be possible with a firmware change to have the AP-16+ activate the relay with only AUX files and not SFX files? Even better would be the ability to choose specific AUX files. I have a need for this feature on the prop I'm currently building. I could do it by adding more relays but thought I'd run the idea by ya.

JonnyMac

It's *possible* but that would be a big chunk of custom coding that I don't think would get widespread use. Let me suggest, for the time being, anyway, that you use a Prop-1 to command the AP-16+ and relay.  Even when "NORELAY.TXT" is on the SD card, the Prop-1 can activate it with the "R" command.
Jon McPhalen
EFX-TEK Hollywood Office

JackMan

No problem, I can do what I need with a couple more relays. This is a MIB project that will be controlled via a 4Ch remote as I don't want the Beast to "attack" if anyone is too close to the crate. My setup for now doesn't require a Prop-1.

JonnyMac

March 22, 2011, 12:28:11 PM #3 Last Edit: March 22, 2011, 12:52:40 PM by JonnyMac
Being human, I reserve the right to change my mind!  ;D

It is my habit to do "programming for fun" while having morning coffee and lunch. This helps break up the work day and sharpen my programming skills. To that end I looked into Jack's request and, to my happy surprise, I was able to implement this feature request in less time than I expected. It helped that a few days ago I was looking into parsing the raw data output from an animation program.

So, here you go.

WARNING: THIS IS BETA CODE AND HAS NOT BEEN APPROVED FOR PRODUCTION

For those that are willing to give it a try, here are the guidelines (which will be added to the documentation once fully vetted).

  • For individual relay control per file you must remove "NORELAY.TXT" from the SD card (if present) -- the "no relay" option gets priority

  • Create a text file called "CFGRELAY.TXT" that describes which files will use the relay; the relay usage is described as a binary mask

The program looks for three sections in the control file

  • SFX=
  • AUX=
  • RWP=

The last of the group (Remote Wav Play) affects the relay when using external control.  For selective relay control under remote control the "R" command may be used.

In order to keep the code very efficient it reads each line in the file and looks at the first character. The the first character is an apostrophe (') then the line is a comment and ignored. If the first character is "s" or "S" it will parse the binary mask from the line.  The process is identical for "a" and "A" for AUX file control, and "r" and "R" for remote wav control.  Thie key is to use ' at the beginning of the line if you want to make notes to yourself in the file. That said, the AP-16+ reads every line in the file so keep it as short as you can.

Example: Let's say you wanted the relay to operate for SFX00 - SFX07, but NOT operate for SFX08 - SFX15; the control line in the file would look like this:

SFX=0000_0000_1111_1111

Note that the code allows you to use the underscore character to break-up the mask and make it easier to count bits (I tend to use groups of four).  As this is a binary mask the first 0 in the string represents SFX15, the "1" at the end of the string is for SFX00.  This graphic should clarify.




For AUX files which are numbered AUX01 to AUX08 the mask looks like this:




For WAV files played through the serial link with the "PW" command there control line requires only one bit ("0" for off, "1" for on). To disable the relay for remotely-played files the control line would be:

RWP=0


I have attached the beta code (copy to SD card and rename "AP16.PGM") and a demo configuration file that shows the configuration lines as well as commenting in the file. JB and I have a lot of work to do post Transwold so any feedback you have will help me in the test and documentation of this new feature.

Jon McPhalen
EFX-TEK Hollywood Office

JonnyMac

By the way, for those that are wondering what happens if neither "NORELAY.TXT" or "CFGRELAY.TXT" are present: the program works as before with the relay activating for every file.
Jon McPhalen
EFX-TEK Hollywood Office

JackMan

So far works perfect for me, nice feature. Great job Jon!  ;D