Skip to content

Commit

Permalink
Add more plumbing for BB64 platform
Browse files Browse the repository at this point in the history
  • Loading branch information
dkulp committed Nov 26, 2024
1 parent a6cdcce commit 7a6ba68
Show file tree
Hide file tree
Showing 22 changed files with 196 additions and 146 deletions.
3 changes: 3 additions & 0 deletions docs/ControlProtocol.txt
Original file line number Diff line number Diff line change
Expand Up @@ -107,13 +107,16 @@ buf[9] = App/Hardware Type
- 0x11 - Pi ZeroW
- 0x12 - Pi 3 A+
- 0x13 - Pi 4
- 0x14 - Pi 5
- 0x15 - Pi Zero 2W
- 0x40 - BeagleBone Black Rev B
- 0x41 - BeagleBone Black Rev C
- 0x42 - BeagleBone Black Wireless
- 0x43 - BeagleBone Green
- 0x44 - BeagleBone Green Wireless
- 0x45 - PocketBeagle
- 0x46 - SanCloud Beaglebone Enhanced
- 0x47 - PocketBeagle2/BeaglePlay
- 0x60 - Armbian
- 0x70 - MacOS
- 0x80-0x8F = Falcon Hardware
Expand Down
7 changes: 6 additions & 1 deletion src/MultiSync.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -368,6 +368,9 @@ MultiSyncSystemType MultiSync::ModelStringToType(std::string model) {
}
return kSysTypeFPPBeagleBoneGreen;
}
if (contains(model, "PocketBeagle2") || contains(model, "BeaglePlay")) {
return kSysTypeFPPPocketBeagle2;
}
if (contains(model, "PocketBeagle")) {
return kSysTypeFPPPocketBeagle;
}
Expand Down Expand Up @@ -646,6 +649,8 @@ std::string MultiSync::GetTypeString(MultiSyncSystemType type, bool local) {
return "BeagleBone Green Wireless";
case kSysTypeFPPPocketBeagle:
return "PocketBeagle";
case kSysTypeFPPPocketBeagle2:
return "PocketBeagle2";
case kSysTypeFPPSanCloudBeagleBoneEnhanced:
return "SanCloud BeagleBone Enhanced";

Expand Down Expand Up @@ -777,7 +782,7 @@ void MultiSync::Discover() {

void MultiSync::PerformHTTPDiscovery() {
std::string subnetsStr = getSetting("MultiSyncHTTPSubnets");

if (FileExists(FPP_DIR_CONFIG("/co-universes.json"))) {
Json::Value outputs = LoadJsonFromFile(FPP_DIR_CONFIG("/co-universes.json"));
if (outputs.isMember("channelOutputs")) {
Expand Down
1 change: 1 addition & 0 deletions src/MultiSync.h
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,7 @@ typedef enum systemType {
kSysTypeFPPBeagleBoneGreenWireless = 0x44,
kSysTypeFPPPocketBeagle = 0x45,
kSysTypeFPPSanCloudBeagleBoneEnhanced = 0x46,
kSysTypeFPPPocketBeagle2 = 0x47,
kSysTypeFPPArmbian = 0x60,
kSysTypeMacOS = 0x70,
// Values under 0x80 are "FPP based" and run full FPP
Expand Down
52 changes: 28 additions & 24 deletions src/OutputMonitor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -732,38 +732,42 @@ void OutputMonitor::GetCurrentPortStatusJson(Json::Value& result) {
}

void OutputMonitor::addEFuseWarning(PortPinInfo* pi, int rec) {
std::string name = pi->name;
if (pi->isSmartReceiver) {
name += std::string(1, 'A' + rec);
}
std::string warn = "eFUSE Triggered for " + name;

if (!pi->receivers[rec].warning.starts_with(warn)) {
if (sequence->IsSequenceRunning()) {
std::string seq = sequence->m_seqFilename;
int sTime = sequence->m_seqMSElapsed / 1000;
warn += " (" + seq + "/" + std::to_string(sTime / 60) + ":" + std::to_string(sTime % 60) + ")";
}
if (pi && rec < 6) {
std::string name = pi->name;
if (pi->isSmartReceiver) {
name += std::string(1, 'A' + rec);
}
std::string warn = "eFUSE Triggered for " + name;

if (!pi->receivers[rec].warning.starts_with(warn)) {
if (sequence->IsSequenceRunning()) {
std::string seq = sequence->m_seqFilename;
int sTime = sequence->m_seqMSElapsed / 1000;
warn += " (" + seq + "/" + std::to_string(sTime / 60) + ":" + std::to_string(sTime % 60) + ")";
}

LogWarn(VB_CHANNELOUT, warn + "\n");
// Output SHOULD be on, but the fuse triggered. That's a warning.
WarningHolder::AddWarning(warn);
pi->receivers[rec].warning = warn;
LogWarn(VB_CHANNELOUT, warn + "\n");
// Output SHOULD be on, but the fuse triggered. That's a warning.
WarningHolder::AddWarning(warn);
pi->receivers[rec].warning = warn;

std::map<std::string, std::string> keywords;
keywords["PORT"] = name;
CommandManager::INSTANCE.TriggerPreset("EFUSE_TRIGGERED", keywords);
std::map<std::string, std::string> keywords;
keywords["PORT"] = name;
CommandManager::INSTANCE.TriggerPreset("EFUSE_TRIGGERED", keywords);
}
}
}
void OutputMonitor::clearEFuseWarning(PortPinInfo* port, int rec) {
if (!port->receivers[rec].warning.empty()) {
WarningHolder::RemoveWarning(port->receivers[rec].warning);
port->receivers[rec].warning.clear();
if (port && rec < 6) {
if (!port->receivers[rec].warning.empty()) {
WarningHolder::RemoveWarning(port->receivers[rec].warning);
port->receivers[rec].warning.clear();
}
port->receivers[rec].retryCount = 0;
}
port->receivers[rec].retryCount = 0;
}
bool OutputMonitor::checkEFuseRetry(PortPinInfo* port) {
if (port->receivers[0].retryCount < eFuseRetryCount) {
if (port && port->receivers[0].retryCount < eFuseRetryCount) {
LogDebug(VB_CHANNELOUT, "eFuse triggered for %s. Attempting reset retry #%d\n", port->name.c_str(), port->receivers[0].retryCount + 1);
if (std::find(eFuseRetries.begin(), eFuseRetries.end(), port) == eFuseRetries.end()) {
eFuseRetries.push_back(port);
Expand Down
4 changes: 2 additions & 2 deletions src/makefiles/libfpp-co-BBB48String.mk
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# BeagleBone Black
ifeq '$(ARCH)' 'BeagleBone Black'
# BeagleBone
ifeq ($(ISBEAGLEBONE), 1)

OBJECTS_fpp_co_BBB48String_so += non-gpl/BBB48String/BBB48String.o
LIBS_fpp_co_BBB48String_so += -L. -lfpp -ljsoncpp -lfpp_capeutils -Wl,-rpath=$(SRCDIR):.
Expand Down
4 changes: 2 additions & 2 deletions src/makefiles/libfpp-co-BBBMatrix.mk
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# BeagleBone Black
ifeq '$(ARCH)' 'BeagleBone Black'
# BeagleBone
ifeq ($(ISBEAGLEBONE), 1)

# The subtype for the BBB matrices is "LEDscapeMatrix" as
# it was based off of the LEDscape code a long long time ago. That
Expand Down
4 changes: 2 additions & 2 deletions src/makefiles/libfpp-co-BBBSerial.mk
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# BeagleBone Black
ifeq '$(ARCH)' 'BeagleBone Black'
# BeagleBone
ifeq ($(ISBEAGLEBONE), 1)

OBJECTS_fpp_co_BBBSerial_so += channeloutput/BBBSerial.o
LIBS_fpp_co_BBBSerial_so += -L. -lfpp -ljsoncpp -lfpp_capeutils
Expand Down
4 changes: 2 additions & 2 deletions src/makefiles/libfpp-co-BBShiftString.mk
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# BeagleBone Black
ifeq '$(ARCH)' 'BeagleBone Black'
# BeagleBone
ifeq ($(ISBEAGLEBONE), 1)

OBJECTS_fpp_co_BBShiftString_so += non-gpl/BBShiftString/BBShiftString.o
LIBS_fpp_co_BBShiftString_so += -L. -lfpp -ljsoncpp -lfpp_capeutils -lfpp-FalconV5Support -Wl,-rpath=$(SRCDIR):.
Expand Down
4 changes: 2 additions & 2 deletions src/makefiles/libfpp-co-FalconV5Support.mk
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# BeagleBone Black
ifeq '$(ARCH)' 'BeagleBone Black'
# BeagleBone
ifeq ($(ISBEAGLEBONE), 1)

OBJECTS_fpp_FalconV5Support_so += non-gpl/FalconV5Support/FalconV5Support.o
LIBS_fpp_FalconV5Support_so += -L. -lfpp -ljsoncpp -lFalconV5 -Wl,-rpath=$(SRCDIR):.
Expand Down
9 changes: 9 additions & 0 deletions src/makefiles/platform/bb.mk
Original file line number Diff line number Diff line change
@@ -1,5 +1,14 @@
# BeagleBone Black
ifeq '$(ARCH)' 'BeagleBone Black'
ISBEAGLEBONE=1
endif

ifeq '$(ARCH)' 'BeagleBone 64'
ISBEAGLEBONE=1
endif


ifeq ($(ISBEAGLEBONE), 1)

LIBS_GPIO_ADDITIONS=
OBJECTS_GPIO_ADDITIONS+=util/BBBUtils.o
Expand Down
10 changes: 6 additions & 4 deletions www/api/controllers/cape.php
Original file line number Diff line number Diff line change
Expand Up @@ -50,12 +50,12 @@ function GetEEPROMFilename()
}
if (!file_exists($eepromFile) && startsWith($eepromFile, "/sys/bus/i2c/devices/")) {
$target = "/sys/bus/i2c/devices/i2c-1/new_device";
if ($settings['Platform'] == "BeagleBone Black") {
if ($settings['BeaglePlatform']) {
$target = "/sys/bus/i2c/devices/i2c-2/new_device";
}
system("sudo bash -c \"echo '24c256 0x50' > $target\"");
}

if (!file_exists($eepromFile) && file_exists("/home/fpp/media/config/cape-eeprom.bin")) {
$eepromFile = "/home/fpp/media/config/cape-eeprom.bin";
}
Expand Down Expand Up @@ -330,11 +330,13 @@ function RedeemVoucher()

$data = json_decode($postJSON, true);

if ((!isset($data['voucher'])) ||
if (
(!isset($data['voucher'])) ||
(!isset($data['first_name'])) ||
(!isset($data['last_name'])) ||
(!isset($data['email'])) ||
(!isset($data['password']))) {
(!isset($data['password']))
) {
$result = array();
$result['Status'] = 'ERROR';
$result['Message'] = 'Missing input data. Must include voucher, first_name, last_name, email, password';
Expand Down
16 changes: 11 additions & 5 deletions www/api/controllers/settings.php
Original file line number Diff line number Diff line change
Expand Up @@ -51,24 +51,30 @@ function PutSetting()
SendCommand("LogLevel,$setting,$value,");
} else if ($setting == "HostName") {
$value = preg_replace("/[^-a-zA-Z0-9]/", "", $value);
exec($SUDO . " sed -i 's/^.*\$/$value/' /etc/hostname ; " .
exec(
$SUDO . " sed -i 's/^.*\$/$value/' /etc/hostname ; " .
$SUDO . " sed -i '/^127.0.1.1[^0-9]/d' /etc/hosts ; " .
$SUDO . " sed -i '\$a127.0.1.1 $value' /etc/hosts ; " .
$SUDO . " hostname $value ; " .
$SUDO . " /etc/init.d/avahi-daemon restart ;" .
$SUDO . " systemctl restart avahi-daemon.service",
$output, $return_val);
$output,
$return_val
);
sleep(1); // Give Avahi time to restart before we return
} else if ($setting == "EnableRouting") {
if ($value != "1") {
$value = "0";
}
exec($SUDO . " sed -i '/net.ipv4.ip_forward/d' /etc/sysctl.conf; " .
exec(
$SUDO . " sed -i '/net.ipv4.ip_forward/d' /etc/sysctl.conf; " .
$SUDO . " sed -i '\$anet.ipv4.ip_forward = $value' /etc/sysctl.conf ; " .
$SUDO . " sysctl --system",
$output, $return_val);
$output,
$return_val
);
} else if ($setting == "storageDevice") {
if ($settings['Platform'] == "BeagleBone Black") {
if ($settings['BeaglePlatform']) {
exec('findmnt -n -o SOURCE / | colrm 1 5', $output, $return_val);
$rootDevice = $output[0];
unset($output);
Expand Down
2 changes: 1 addition & 1 deletion www/backup.php
Original file line number Diff line number Diff line change
Expand Up @@ -190,7 +190,7 @@ function checkDirectScriptExecution()
$known_ini_config_files = array('settings', 'system_settings', 'network', 'wired', 'wifi');

//Remove BBB Strings from the system areas if we're on a Pi or any other platform that isn't a BBB
if ($settings['Platform'] != "BeagleBone Black") {
if (!$settings['BeaglePlatform']) {
unset($system_config_areas['channelOutputs']['file']['bbb_strings']);
}

Expand Down
22 changes: 13 additions & 9 deletions www/cape-info.php
Original file line number Diff line number Diff line change
Expand Up @@ -274,6 +274,10 @@ function eepromVendorListChanged() {
if (!plat.includes(settings["Variant"])) {
valid = false;
}
} else if (settings["Platform"] == "BeagleBone 64") {
if (!plat.includes(settings["Variant"])) {
valid = false;
}
} else {
if (!plat.includes(settings["Platform"])
&& !plat.includes(settings["Variant"])) {
Expand Down Expand Up @@ -749,12 +753,11 @@ function TestInternet() {
<h2>About <?= $capeHardwareType ?> </h2>
<div class="container-fluid">
<div class="row">
<div
class='<? if (isset($currentCapeInfo['vendor'])) {
echo "aboutLeft col-md";
} else {
echo "aboutAll";
} ?> '>
<div class='<? if (isset($currentCapeInfo['vendor'])) {
echo "aboutLeft col-md";
} else {
echo "aboutAll";
} ?> '>
<table class='tblAbout'>
<tr>
<td><b>Name:</b></td>
Expand Down Expand Up @@ -951,7 +954,7 @@ class='<? if (isset($currentCapeInfo['vendor'])) {
echo "class='internetOnly' style='display: none;'";
}
?>>
<tr>
<tr>
<td><b>Order Number:</b></td>
<td><input id='orderNumber' type='password' size=12
maxlength=10 value=''>
Expand Down Expand Up @@ -1041,7 +1044,8 @@ class='<? if (isset($currentCapeInfo['vendor'])) {
</tr>
</table>
Clicking the download button will prompt you to save a file called
'cape-signing-<?= $settings['HostName'] ?>.bin'. Some browsers may be
'cape-signing-<?= $settings['HostName'] ?>.bin'. Some browsers may
be
setup to automatically save downloaded files. If you are not
prompted to save the file, check your Download directory for the
file.
Expand Down Expand Up @@ -1258,4 +1262,4 @@ class='<? if (isset($currentCapeInfo['vendor'])) {
</div>
</body>

</html>
</html>
13 changes: 6 additions & 7 deletions www/channeloutputs.php
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@
}

<?
if ($settings['Platform'] == "BeagleBone Black") {
if ($settings['BeaglePlatform']) {
// BBB only supports ws2811 at this point
?>
#PixelString tr>th:nth-of-type(2),
Expand All @@ -99,8 +99,7 @@
// don't support virtual strings
?>
#PixelString tr>th:nth-of-type(3),
div[aria-labelledby="PixelString"] .floatThead-table tr>th:nth-of-type(3)
#PixelString tr>td:nth-of-type(3) {
div[aria-labelledby="PixelString"] .floatThead-table tr>th:nth-of-type(3) #PixelString tr>td:nth-of-type(3) {
display: none;
}

Expand Down Expand Up @@ -342,7 +341,7 @@ function pageSpecific_PageLoad_PostDOMLoad_ActionsSetup() {
<?

if (
$settings['Platform'] == "BeagleBone Black" || $settings['Platform'] == "Raspberry Pi" ||
$settings['BeaglePlatform'] || $settings['Platform'] == "Raspberry Pi" ||
((file_exists('/usr/include/X11/Xlib.h')) && ($settings['Platform'] == "Linux"))
) {
$stringTabText = "Pixel Strings";
Expand Down Expand Up @@ -385,7 +384,7 @@ function pageSpecific_PageLoad_PostDOMLoad_ActionsSetup() {
$pwmTabText = "PWM";
if (isset($currentCapeInfo["labels"]) && isset($currentCapeInfo["labels"]["pwm"])) {
$pwmTabText = $currentCapeInfo["labels"]["pwm"];
}
}
?>
<li class="nav-item">
<a class="nav-link" id="tab-pwm-tab" type="button" tabType='PWM' data-bs-toggle="pill"
Expand Down Expand Up @@ -444,7 +443,7 @@ function pageSpecific_PageLoad_PostDOMLoad_ActionsSetup() {
<?

if (
$settings['Platform'] == "BeagleBone Black" || $settings['Platform'] == "Raspberry Pi" ||
$settings['BeaglePlatform'] || $settings['Platform'] == "Raspberry Pi" ||
((file_exists('/usr/include/X11/Xlib.h')) && ($settings['Platform'] == "Linux"))
) {
?>
Expand Down Expand Up @@ -500,4 +499,4 @@ function pageSpecific_PageLoad_PostDOMLoad_ActionsSetup() {
</div>
</body>

</html>
</html>
17 changes: 16 additions & 1 deletion www/config.php
Original file line number Diff line number Diff line change
Expand Up @@ -221,7 +221,7 @@ function ApprovedCape($v)
if (file_exists("/etc/fpp/desktop")) {
$settings["IsDesktop"] = true;
}

$settings['BeaglePlatform'] = false;
if ($settings['Platform'] == "Raspberry Pi") {
$settings['OSImagePrefix'] = "Pi";
$settings['LogoLink'] = "http://raspberrypi.org/";
Expand Down Expand Up @@ -274,11 +274,26 @@ function ApprovedCape($v)
$settings['Variant'] = "UNKNOWN";
$settings['Logo'] = "Raspberry_Pi_Logo.png";
}
} else if ($settings['Platform'] == "BeagleBone 64") {
$settings['OSImagePrefix'] = "BB64";
$settings['LogoLink'] = "http://beagleboard.org/";
$settings['BBB_Tethering'] = "1";
$settings['SubPlatform'] = trim(file_get_contents("/proc/device-tree/model"));
$settings['BeaglePlatform'] = true;
if (preg_match('/PocketBeagle2/', $settings['SubPlatform'])) {
$settings['Variant'] = "PocketBeagle2";
$settings['Logo'] = "beagle_pocket.png";
} else {
// for now, eventually support others?
$settings['Variant'] = "PocketBeagle2";
$settings['Logo'] = "beagle_pocket.png";
}
} else if ($settings['Platform'] == "BeagleBone Black") {
$settings['OSImagePrefix'] = "BBB";
$settings['LogoLink'] = "http://beagleboard.org/";
$settings['BBB_Tethering'] = "1";
$settings['SubPlatform'] = trim(file_get_contents("/proc/device-tree/model"));
$settings['BeaglePlatform'] = true;
if (preg_match('/PocketBeagle/', $settings['SubPlatform'])) {
$settings['Variant'] = "PocketBeagle";
$settings['Logo'] = "beagle_pocket.png";
Expand Down
Loading

0 comments on commit 7a6ba68

Please sign in to comment.