Skip to content

Commit

Permalink
Bugfix and add volume change hack for Vast-FMT 212R transmitters
Browse files Browse the repository at this point in the history
- Fix RDS for setups where FPP does not reinitialize the FM transmitter
- Add optional code to have the plugin bump the volume down and back
  up at every song change to work around the Vast-FMT 212R audio
  glitches.
  • Loading branch information
cpinkham committed Mar 26, 2020
1 parent ee4c4c8 commit 801cf64
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 1 deletion.
1 change: 1 addition & 0 deletions plugin_setup.php
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,7 @@ function OnConnectionChanged() {
At Start, the hardware is reset, FM settings initialized, will broadcast any audio played, and send static RDS messages (if enabled).</p>
<p>Stop at: <?php PrintSettingSelect("Stop", "Stop", 2, 0, "Never", Array("Playlist Stop"=>"PlaylistStop", "Never (default)"=>"Never"), "fpp-vastfmt", ""); ?><br />
At Stop, the hardware is reset. Listeners will hear static.</p>
<p>Enable Volume Change Hack for Vast-FMT 212R: <?php PrintSettingCheckbox("EnableVolumeChangeHack", "EnableVolumeChangeHack", 2, 0, "1", "0", "fpp-vastfmt", ""); ?></p>
</fieldset>
</div>

Expand Down
20 changes: 19 additions & 1 deletion src/FPPVastFM.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
#include <termios.h>

#include "mediadetails.h"
#include "commands/Commands.h"
#include "common.h"
#include "settings.h"
#include "Plugin.h"
Expand Down Expand Up @@ -120,7 +121,8 @@ class FPPVastFMPlugin : public FPPPlugin {
void startVastForRDS() {
if (si4713 == nullptr) {
if (initVast()) {
if (settings["EnableRDS"] == "True") {
rdsEnabled = settings["EnableRDS"] == "True";
if (rdsEnabled) {
initRDS();
} else {
LogErr(VB_PLUGIN, "Tried to setup for RDS, but RDS is not enabled\n");
Expand Down Expand Up @@ -221,6 +223,21 @@ class FPPVastFMPlugin : public FPPPlugin {
std::string album = mediaDetails.album;
int track = mediaDetails.track;
int length = mediaDetails.length;

// Bump the volume down and back up to work around Vast-FMT 212R issue
if (settings["EnableVolumeChangeHack"] == "1") {
Json::Value cmd;
Json::Value args(Json::arrayValue);

args.append("5");
cmd["args"] = args;

cmd["command"] = "Volume Decrease";
CommandManager::INSTANCE.run(cmd);

cmd["command"] = "Volume Increase";
CommandManager::INSTANCE.run(cmd);
}

std::string type = playlist["currentEntry"]["type"].asString();
if (type != "both" && type != "media") {
Expand All @@ -245,6 +262,7 @@ class FPPVastFMPlugin : public FPPPlugin {
setIfNotFound("Pty", "2");

setIfNotFound("Connection", "USB");
setIfNotFound("EnableVolumeChangeHack", "0");
#ifdef PLATFORM_BBB
setIfNotFound("ResetPin", "14");
#else
Expand Down

0 comments on commit 801cf64

Please sign in to comment.