Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[FEATURE] Support for TVG Mode #19

Open
prodestrian opened this issue Jun 25, 2023 · 2 comments
Open

[FEATURE] Support for TVG Mode #19

prodestrian opened this issue Jun 25, 2023 · 2 comments
Assignees

Comments

@prodestrian
Copy link
Collaborator

(Moving this from #10 so it doesn't get too confusing)

After reading the soundboard documentation PDF I can see the following:

The sound board also has a couple of configuration switches on the board to select
between four main modes of operation:

  1. Movie Pack Sounds
  2. Movie Pack sounds with Interactive Features
  3. TVG Pack sounds, cycle through 8 different TVG pack sounds
  4. TVG Proton Pack Only sounds timed to match R2DEVO

OK, so I had no idea what "R2DEVO" was, looks like it's an old pack light kit from 10+ years ago and isn't applicable to this project, so we can ignore it.

Firing

Mode 1 (Movie Pack Sounds) and Mode 2 (Movie Pack Sounds with Interactive Features) appear to be exactly the same, except that Mode 2 plays clips from the movie (ie "Nice Shooting, Tex!") after firing finishes.
As far as I can tell there's no difference in the signals that the Soundboard sends to the wand lights in these modes (it will send STATE_FIRE_MOVIE either way).

Mode 3 (TVG Pack Sounds) is the more complicated one here.
Firing documentation:

a. Press and hold for continuous firing sounds, like the Proton Stream

Super simple. In Movie mode this will send STATE_FIRE_MOVIE until the button is let go. In TVG Mode it will send STATE_FIRE_TVG regardless of current TVG setting (ie Proton/Slime/Stasis/Meson).

b. Press, hold and release for single shot sounds, like the Boson Darts in either TVG sounds configuration

Looks like this also will just send STATE_FIRE_TVG for quick bursts, so we already support this, and the pack lights don't currently have to behave differently for these. It could be something we add on later (if firing was only for a fraction of a second we display different animations), but that's out of scope.

c. Quickly tap to switch between different TVG packs in TVG Pack Sounds configuration

Each time the TVG pack is changed, it looks like this just notifies the pack lights to change Cyclotron color via:

STATE_RED_CYCLOTRON, // 2: Red Cyclotron Color
STATE_GREEN_CYCLOTRON, // 3: Green Cyclotron Color
STATE_BLUE_CYCLOTRON, // 4: Blue Cyclotron Color
STATE_ORANGE_CYCLOTRON, // 5: Orange Cyclotron Color

Venting

The TVG Pack sounds mode also keeps track of the pack's "temperature" and will start beeping when overheating and will auto-vent the pack when it gets too hot. You can also manually vent the pack to cool it down sooner.
Usually plays the full TVG vent sound in all configurations. In the TVG Pack Sounds configuration, this may make a “dry
vent” sound if the pack is already cool. You must fire something for a while to heat the pack up and then the full vent sound will play.

So, venting exists in both Movie and TVG mode.
We have the following vent states documented from the soundboard:

STATE_AUTOMATIC_VENTING, // 6: Automatic Venting Mode
STATE_VENT_STROBE, // 9: Venting Strobe Only
STATE_VENTING_ACTION, // 11: Venting Action with Interaction (both modes)

I have no idea what STATE_VENT_STROBE is supposed to do here, there's nothing documented about this as far as I can see.
So, can we assume that STATE_VENTING_ACTION refers to a manual vent action, and STATE_AUTOMATIC_VENTING refers to an automatic one (ie triggered by a full overheat)?
As far as the pack lights go I don't think there's any difference, venting is venting.

So we should be able to treat both the same, via something like:

    else if (
            controls.isState(STATE_VENTING_ACTION) ||
            controls.isState(STATE_AUTOMATIC_VENTING)
    ) {
        // Venting, either manually or automatically
        lights.setState(PACK_VENTING);
    }

I've implemented the above into my demo Arduino Nano sketch, with the difference that my second pushbutton is used to toggle TVG modes instead of manually venting. This should be enough for me to proceed.

@prodestrian prodestrian self-assigned this Jun 25, 2023
@prodestrian
Copy link
Collaborator Author

Progress Update

This is now partially working. I can change the mode on the wand and the Cyclotron changes color:
https://www.youtube.com/watch?v=txV1NEvnyz0

The configuration looks like this:

    "modes": {
        "proton": {
            "color": {
                "powercell": "0x0000FF",
                "cyclotron": "0xFF0000",
                "nfilter": "0xFFFFFF"
            }
        },
        "slime": {
            "color": {
                "powercell": "0x0000FF",
                "cyclotron": "0x00FF00",
                "nfilter": "0xFFFFFF"
            }
        },
        "stasis": {
            "color": {
                "powercell": "0x0000FF",
                "cyclotron": "0x0000FF",
                "nfilter": "0xFFFFFF"
            }
        },
        "meson": {
            "color": {
                "powercell": "0x0000FF",
                "cyclotron": "0xFFA500",
                "nfilter": "0xFFFFFF"
            }
        }
    }

(NOTE: The Powercell is always Blue for all modes, and the N-Filter is always White, but it would be possible for someone to make these different colors if they wanted).

Until now we haven't supported Venting at all, I am only half way through implementing this instead of Overheating (which is why the Powercell currently cuts out during venting).

Next I will be focusing on refactoring the JSON config/preset file so that it loads correctly, then complete venting support.

@prodestrian
Copy link
Collaborator Author

prodestrian commented Jun 25, 2023

Progress Update

This is now fully completed as far as I can tell.

Changes have been pushed to the feature/implement-tvg-modes branch.

I have converted all hard-coded animation configuration into JSON and included it in config.json:
https://github.com/gbfans/afterlife-lightkit/blob/8477b6ccc43ae261ad7c45176a82cae04a3466ff/SOFTWARE/AfterlifeLightKit/data/config.json

As you can see, all of the animations come from the JSON file, giving full control to the users:
2023-06-25_18-22

Note that this config.json file will eventually be removed in favor of hardcoded presets, this one represents the Afterlife preset.

Also note that I have removed "Overheating" for now from the main sketch. As far as I know the soundboard doesn't support overheating, only "venting". So if we want to support this, we will need to allow users to customize the overheat duration, and perform our own "temperature check" calculation based on this so that it (hopefully) syncs up with the soundboard. This is complicated and so I believe it's worth leaving out for now.

This demo video shows how this works currently:
https://www.youtube.com/watch?v=W8sg6sNQnik

Proton Mode

        "proton": {
                "powercell": "0x0000FF",
                "cyclotron": "0xFF0000",
                "nfilter": "0xFFFFFF"
        },

2023-06-25_18-28

Slime Mode

        "slime": {
                "powercell": "0x0000FF",
                "cyclotron": "0x00FF00",
                "nfilter": "0xFFFFFF"
        },

2023-06-25_18-29

Stasis Mode

        "stasis": {
                "powercell": "0x0000FF",
                "cyclotron": "0x0000FF",
                "nfilter": "0xFFFFFF"
        },

2023-06-25_18-30

Meson Mode

        "meson": {
                "powercell": "0x0000FF",
                "cyclotron": "0xFFA500",
                "nfilter": "0xFFFFFF"
        }

2023-06-25_18-30_1

Testing

  1. Upload the data to the filesystem:
pio run --target uploadfs
  1. Upload the firmware:
pio run --target upload

As far as I can tell this should work with the soundboard, based on what I'm seeing in the documentation.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant