Skip to content

Commit

Permalink
Add a scanning tool to determine setup.
Browse files Browse the repository at this point in the history
  • Loading branch information
keithsw1111 committed Dec 16, 2020
1 parent 5301e8f commit 2ead5d0
Show file tree
Hide file tree
Showing 57 changed files with 3,108 additions and 75 deletions.
4 changes: 2 additions & 2 deletions xLights/SeqFileUtilities.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -158,7 +158,7 @@ void xLightsFrame::NewSequence()
memRequired *= max;
memRequired /= 1024; // ->kb
memRequired /= 1024; // ->mb
if (memRequired > (GetPhysicalMemorySizeMB() - 1024)) {
if (memRequired > (GetPhysicalMemorySizeMB() - 1024) && (_promptBatchRenderIssues || !_renderMode)) {
DisplayWarning(wxString::Format("The setup requires a large amount of memory (%lu MB) which could result in performance issues.", (unsigned long)memRequired), this);
}

Expand Down Expand Up @@ -499,7 +499,7 @@ void xLightsFrame::OpenSequence(const wxString passed_filename, ConvertLogDialog
memRequired *= numChan;
memRequired /= 1024; // ->kb
memRequired /= 1024; // ->mb
if (memRequired > (GetPhysicalMemorySizeMB() - 1024)) {
if (memRequired > (GetPhysicalMemorySizeMB() - 1024) && (_promptBatchRenderIssues || !_renderMode)) {
DisplayWarning(wxString::Format("The setup requires a large amount of memory (%lu MB) which could result in performance issues.", (unsigned long)memRequired), this);
}

Expand Down
2 changes: 2 additions & 0 deletions xLights/UtilFunctions.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1047,6 +1047,8 @@ bool IsInSameSubnet(const std::string& ip1, const std::string& ip2, const std::s
i2.Hostname(ip2);
m.Hostname(mask);

if (i1.GetAddressData() == nullptr || i2.GetAddressData() == nullptr || m.GetAddressData() == nullptr) return false;

return ((((sockaddr_in*)i1.GetAddressData())->sin_addr.s_addr & ((sockaddr_in*)m.GetAddressData())->sin_addr.s_addr) ==
(((sockaddr_in*)i2.GetAddressData())->sin_addr.s_addr & ((sockaddr_in*)m.GetAddressData())->sin_addr.s_addr));
}
Expand Down
2 changes: 1 addition & 1 deletion xLights/controllers/AlphaPix.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
#include "../models/ModelManager.h"
#include "ControllerCaps.h"
#include "../outputs/ControllerEthernet.h"
#include "UtilFunctions.h"
#include "../UtilFunctions.h"

#include <log4cpp/Category.hh>

Expand Down
4 changes: 3 additions & 1 deletion xLights/controllers/AlphaPix.h
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@

#include "BaseController.h"
#include "ControllerUploadData.h"
#include "UtilClasses.h"
#include "../UtilClasses.h"

class AlphaPixData;
class AlphaPixOutput;
Expand Down Expand Up @@ -100,7 +100,9 @@ class AlphaPix : public BaseController
#pragma endregion

#pragma region Getters and Setters
#ifndef DISCOVERYONLY
virtual bool SetOutputs(ModelManager* allmodels, OutputManager* outputManager, ControllerEthernet* controller, wxWindow* parent) override;
#endif
virtual bool UsesHTTP() const override { return true; }
#pragma endregion
};
3 changes: 2 additions & 1 deletion xLights/controllers/BaseController.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ BaseController::BaseController(const std::string& ip, const std::string &proxy)
}
}

#ifndef DISCOVERYONLY
BaseController *BaseController::CreateBaseController(ControllerEthernet *controller, const std::string &ipOrig) {
std::string ip = ipOrig;
ControllerCaps *caps = controller->GetControllerCaps();
Expand Down Expand Up @@ -77,7 +78,7 @@ BaseController *BaseController::CreateBaseController(ControllerEthernet *control
}
return bc;
}

#endif

#pragma endregion

Expand Down
8 changes: 7 additions & 1 deletion xLights/controllers/BaseController.h
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
#include <string>

#include "ControllerUploadData.h"
#include "UtilClasses.h"
#include "../UtilClasses.h"

class ModelManager;
class OutputManager;
Expand Down Expand Up @@ -54,7 +54,9 @@ class BaseController
virtual ~BaseController() {}


#ifndef DISCOVERYONLY
static BaseController *CreateBaseController(ControllerEthernet *controller, const std::string &ip = "");
#endif

#pragma endregion

Expand All @@ -64,11 +66,15 @@ class BaseController
virtual const std::string &GetModel() const { return _model; }
virtual const std::string &GetVersion() const { return _version; }
virtual std::string GetFullName() const { return _model + ((_version == "") ? _("") : (_(" ") + _version)); }

#ifndef DISCOVERYONLY
virtual bool SetInputUniverses(ControllerEthernet* controller, wxWindow* parent) { return false; }
virtual bool SetOutputs(ModelManager* allmodels, OutputManager* outputManager, ControllerEthernet* controller, wxWindow* parent) = 0;

virtual bool UploadForImmediateOutput(ModelManager* allmodels, OutputManager* outputManager, ControllerEthernet* controller, wxWindow* parent) { return false; }
virtual bool ResetAfterOutput(OutputManager* outputManager, ControllerEthernet* controller, wxWindow* parent) { return false; }
#endif

virtual bool UsesHTTP() const = 0;

#pragma endregion
Expand Down
10 changes: 5 additions & 5 deletions xLights/controllers/ESPixelStick.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,11 @@
#include <wx/regex.h>

#include "ESPixelStick.h"
#include "models/Model.h"
#include "outputs/OutputManager.h"
#include "outputs/Output.h"
#include "models/ModelManager.h"
#include "UtilFunctions.h"
#include "../models/Model.h"
#include "../outputs/OutputManager.h"
#include "../outputs/Output.h"
#include "../models/ModelManager.h"
#include "../UtilFunctions.h"
#include "ControllerCaps.h"
#include "../outputs/ControllerEthernet.h"

Expand Down
3 changes: 2 additions & 1 deletion xLights/controllers/ESPixelStick.h
Original file line number Diff line number Diff line change
Expand Up @@ -43,10 +43,11 @@ class ESPixelStick : public BaseController
#pragma endregion

#pragma region Getters and Setters
#ifndef DISCOVERYONLY
virtual bool SetOutputs(ModelManager* allmodels, OutputManager* outputManager, ControllerEthernet* controller, wxWindow* parent) override;
virtual bool SetInputUniverses(ControllerEthernet* controller, wxWindow* parent) override;
virtual bool UploadForImmediateOutput(ModelManager* allmodels, OutputManager* outputManager, ControllerEthernet* controller, wxWindow* parent) override;

#endif

virtual bool UsesHTTP() const override { return false; }
#pragma endregion
Expand Down
21 changes: 15 additions & 6 deletions xLights/controllers/FPP.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@
#include "SanDevices.h"
#include "J1Sys.h"

#include "TraceLog.h"
#include "../TraceLog.h"
using namespace TraceLog;

static const std::string PIHAT("Pi Hat");
Expand Down Expand Up @@ -832,7 +832,7 @@ bool FPP::uploadOrCopyFile(const std::string &filename,
return uploadFile(filename, file);
}


#ifndef DISCOVERYONLY
bool FPP::PrepareUploadSequence(const FSEQFile &file,
const std::string &seq,
const std::string &media,
Expand Down Expand Up @@ -995,6 +995,7 @@ bool FPP::PrepareUploadSequence(const FSEQFile &file,
outputFile->writeHeader();
return false;
}

bool FPP::WillUploadSequence() const {
return outputFile != nullptr;
}
Expand Down Expand Up @@ -1070,6 +1071,7 @@ bool FPP::UploadModels(const wxJSONValue &models) {
}
return false;
}

bool FPP::UploadDisplayMap(const std::string &displayMap) {
if (IsDrive()) {
wxFileName fn = (ipAddress + wxFileName::GetPathSeparator() + "config/virtualdisplaymap");
Expand All @@ -1081,6 +1083,7 @@ bool FPP::UploadDisplayMap(const std::string &displayMap) {
}
return false;
}

bool FPP::UploadUDPOut(const wxJSONValue &udp) {
if (IsDrive()) {
std::string fn = (ipAddress + wxFileName::GetPathSeparator() + "config" + wxFileName::GetPathSeparator() + "co-universes.json");
Expand Down Expand Up @@ -1232,6 +1235,7 @@ std::string FPP::CreateVirtualDisplayMap(ModelManager* allmodels, bool center0)

return ret;
}
#endif

inline wxString stripInvalidChars(const std::string &str) {
wxString s = str;
Expand Down Expand Up @@ -1294,7 +1298,7 @@ void FPP::SetNewRanges(const std::map<int, int> &rngs) {
ranges = rngList;
}


#ifndef DISCOVERYONLY
bool FPP::UploadUDPOutputsForProxy(OutputManager* outputManager) {
std::list<Controller*> selected;
for (const auto& it : outputManager->GetControllers()) {
Expand Down Expand Up @@ -1326,6 +1330,7 @@ wxJSONValue FPP::CreateUniverseFile(ControllerEthernet* controller, bool input)
selected.push_back(controller);
return CreateUniverseFile(selected, false);
}
#endif

std::string FPP::GetVendor(const std::string& type)
{
Expand All @@ -1343,6 +1348,7 @@ std::string FPP::GetModel(const std::string& type)
return m;
}

#ifndef DISCOVERYONLY
bool FPP::SetInputUniverses(ControllerEthernet* controller, wxWindow* parentWin) {

wxConfigBase* config = wxConfigBase::Get();
Expand Down Expand Up @@ -1399,6 +1405,7 @@ bool FPP::SetOutputs(ModelManager* allmodels, OutputManager* outputManager, Cont
parent = parent;
return AuthenticateAndUpdateVersions() && !UploadPixelOutputs(allmodels, outputManager, controller) && !Restart("");
}

bool FPP::UploadForImmediateOutput(ModelManager* allmodels, OutputManager* outputManager, ControllerEthernet* controller, wxWindow* parent) {
parent = parent;
bool b = AuthenticateAndUpdateVersions();
Expand All @@ -1412,6 +1419,7 @@ bool FPP::UploadForImmediateOutput(ModelManager* allmodels, OutputManager* outpu
}
return b;
}

bool FPP::ResetAfterOutput(OutputManager* outputManager, ControllerEthernet* controller, wxWindow* parent) {
std::string md = controller->GetRuntimeProperty("FPPMode");
if (md != "bridge" && md != "") {
Expand Down Expand Up @@ -1545,7 +1553,6 @@ void FPP::SetDescription(const std::string &st) {
}
}


bool FPP::SetInputUniversesBridge(Controller* controller) {
auto c = dynamic_cast<ControllerEthernet*>(controller);
if (c == nullptr) return false;
Expand All @@ -1561,6 +1568,7 @@ bool FPP::SetInputUniversesBridge(Controller* controller) {
}
return false;
}

static bool mergeSerialInto(wxJSONValue &otherDmxData, wxJSONValue &otherOrigRoot) {
bool changed = false;
for (int x = 0; x < otherDmxData["channelOutputs"].Size(); x++) {
Expand Down Expand Up @@ -1610,6 +1618,7 @@ static bool mergeSerialInto(wxJSONValue &otherDmxData, wxJSONValue &otherOrigRoo
}
return changed;
}
#endif

static bool IsCompatible(wxWindow *parent, const std::string ipAdd, const ControllerCaps *rules,
std::string &origVend, std::string &origMod, std::string origVar, const std::string &origId) {
Expand All @@ -1626,6 +1635,7 @@ static bool IsCompatible(wxWindow *parent, const std::string ipAdd, const Contro
return true;
}

#ifndef DISCOVERYONLY
bool FPP::UploadPixelOutputs(ModelManager* allmodels,
OutputManager* outputManager,
Controller* controller) {
Expand Down Expand Up @@ -2097,8 +2107,7 @@ bool FPP::UploadPixelOutputs(ModelManager* allmodels,
SetNewRanges(rngs);
return false;
}


#endif

#define FPP_CTRL_PORT 32320
static void ProcessFPPSysinfo(Discovery &discovery, const std::string &ip, const std::string &proxyIp, const std::string &sysInfo);
Expand Down
7 changes: 6 additions & 1 deletion xLights/controllers/FPP.h
Original file line number Diff line number Diff line change
Expand Up @@ -65,14 +65,15 @@ class FPP : public BaseController
bool IsVersionAtLeast(uint32_t maj, uint32_t min);
bool IsDrive();

#ifndef DISCOVERYONLY
bool PrepareUploadSequence(const FSEQFile &file,
const std::string &seq,
const std::string &media,
int type);
bool WillUploadSequence() const;
bool AddFrameToUpload(uint32_t frame, uint8_t *data);
bool FinalizeUploadSequence();

#endif

bool UploadUDPOutputsForProxy(OutputManager* outputManager);

Expand All @@ -95,18 +96,22 @@ class FPP : public BaseController
static void MapToFPPInstances(Discovery &discovery, std::list<FPP*> &instances, OutputManager* outputManager);


#ifndef DISCOVERYONLY
static wxJSONValue CreateModelMemoryMap(ModelManager* allmodels);
static std::string CreateVirtualDisplayMap(ModelManager* allmodels, bool center0);
static wxJSONValue CreateUniverseFile(const std::list<Controller*>& controllers, bool input);
static wxJSONValue CreateUniverseFile(ControllerEthernet* controller, bool input);
#endif
static std::string GetVendor(const std::string& type);
static std::string GetModel(const std::string& type);

#pragma region Getters and Setters
#ifndef DISCOVERYONLY
virtual bool SetInputUniverses(ControllerEthernet* controller, wxWindow* parent) override;
virtual bool SetOutputs(ModelManager* allmodels, OutputManager* outputManager, ControllerEthernet* controller, wxWindow* parent) override;
virtual bool UploadForImmediateOutput(ModelManager* allmodels, OutputManager* outputManager, ControllerEthernet* controller, wxWindow* parent) override;
virtual bool ResetAfterOutput(OutputManager* outputManager, ControllerEthernet* controller, wxWindow* parent) override;
#endif

virtual bool UsesHTTP() const override { return false; } // returning false here because i dont think you can uypload through a FPP proxy to another FPP
#pragma endregion
Expand Down
22 changes: 21 additions & 1 deletion xLights/controllers/Falcon.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -15,11 +15,15 @@
#include <wx/xml/xml.h>
#include <wx/progdlg.h>

#include "../models/Model.h"
#include "../outputs/OutputManager.h"
#include "../outputs/Output.h"

#ifndef DISCOVERONLY
#include "../models/Model.h"
#include "../models/ModelManager.h"
#include "ControllerUploadData.h"
#endif

#include "../outputs/ControllerEthernet.h"
#include "../outputs/DDPOutput.h"
#include "ControllerCaps.h"
Expand Down Expand Up @@ -379,6 +383,7 @@ int Falcon::MaxPixels(const wxXmlDocument& stringsDoc, int board) const {
#pragma endregion

#pragma region Port Handling
#ifndef DISCOVERYONLY
void Falcon::ResetStringOutputs() {

PutURL("/StringPorts.htm", "S=4&p0=0&p1=1&p2=2&p3=3");
Expand Down Expand Up @@ -501,6 +506,7 @@ std::string Falcon::GetSerialOutputURI(ControllerCaps* caps, int output, OutputM

return "";
}
#endif
#pragma endregion

#pragma region Encode and Decode
Expand Down Expand Up @@ -804,9 +810,22 @@ void Falcon::DecodeModelVersion(int p, int& model, int& version) {
break;
}
}
std::string Falcon::DecodeMode(int mode)
{
switch (mode) {
case 0: return "E131/ArtNET";
case 2: return "Player";
case 4: return "Remote";
case 8: return "Master";
case 16: return "ZCPP";
case 64: return "DDP";
}
return std::string();
}
#pragma endregion

#pragma region Getters and Setters
#ifndef DISCOVERYONLY
bool Falcon::UploadForImmediateOutput(ModelManager* allmodels, OutputManager* outputManager, ControllerEthernet* controller, wxWindow* parent) {
SetInputUniverses(controller, parent);
SetOutputs(allmodels, outputManager, controller, parent, false);
Expand Down Expand Up @@ -1388,4 +1407,5 @@ bool Falcon::SetOutputs(ModelManager* allmodels, OutputManager* outputManager, C

return success;
}
#endif
#pragma endregion
Loading

0 comments on commit 2ead5d0

Please sign in to comment.