-
-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
4 changed files
with
77 additions
and
125 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,7 +2,7 @@ | |
* @file pixeldmxconfiguration.h | ||
* | ||
*/ | ||
/* Copyright (C) 2021-2023 by Arjan van Vught mailto:[email protected] | ||
/* Copyright (C) 2021-2024 by Arjan van Vught mailto:[email protected] | ||
* | ||
* Permission is hereby granted, free of charge, to any person obtaining a copy | ||
* of this software and associated documentation files (the "Software"), to deal | ||
|
@@ -27,9 +27,13 @@ | |
#define PIXELDMXCONFIGURATION_H_ | ||
|
||
#include <cstdint> | ||
#include <cstdio> | ||
#include <algorithm> | ||
|
||
#include "pixelconfiguration.h" | ||
|
||
#include "debug.h" | ||
|
||
namespace pixeldmxconfiguration { | ||
struct PortInfo { | ||
uint32_t nBeginIndexPort[4]; | ||
|
@@ -71,9 +75,62 @@ class PixelDmxConfiguration: public PixelConfiguration { | |
return m_nDmxStartAddress; | ||
} | ||
|
||
void Validate(uint32_t nPortsMax, uint32_t& nLedsPerPixel, pixeldmxconfiguration::PortInfo& portInfo); | ||
void Validate(const uint32_t nPortsMax, uint32_t& nLedsPerPixel, pixeldmxconfiguration::PortInfo& portInfo) { | ||
DEBUG_ENTRY | ||
|
||
PixelConfiguration::Validate(nLedsPerPixel); | ||
|
||
if (!IsRTZProtocol()) { | ||
const auto type = GetType(); | ||
if (!((type == pixel::Type::WS2801) || (type == pixel::Type::APA102) || (type == pixel::Type::SK9822))) { | ||
SetType(pixel::Type::WS2801); | ||
} | ||
|
||
PixelConfiguration::Validate(nLedsPerPixel); | ||
} | ||
|
||
portInfo.nBeginIndexPort[0] = 0; | ||
|
||
if (GetType() == pixel::Type::SK6812W) { | ||
portInfo.nBeginIndexPort[1] = 128; | ||
portInfo.nBeginIndexPort[2] = 256; | ||
portInfo.nBeginIndexPort[3] = 384; | ||
} else { | ||
portInfo.nBeginIndexPort[1] = 170; | ||
portInfo.nBeginIndexPort[2] = 340; | ||
portInfo.nBeginIndexPort[3] = 510; | ||
} | ||
|
||
if ((m_nGroupingCount == 0) || (m_nGroupingCount > GetCount())) { | ||
m_nGroupingCount = GetCount(); | ||
} | ||
|
||
m_nGroups = GetCount() / m_nGroupingCount; | ||
|
||
m_nOutputPorts = std::min(nPortsMax, m_nOutputPorts); | ||
m_nUniverses = (1U + (m_nGroups / (1U + portInfo.nBeginIndexPort[1]))); | ||
|
||
if (nPortsMax == 1) { | ||
portInfo.nProtocolPortIndexLast = (m_nGroups / (1U + portInfo.nBeginIndexPort[1])); | ||
} else { | ||
#if defined (NODE_DDP_DISPLAY) | ||
portInfo.nProtocolPortIndexLast = (((m_nOutputPorts - 1U) * 4U) + m_nUniverses - 1U); | ||
#else | ||
portInfo.nProtocolPortIndexLast = ((m_nOutputPorts * m_nUniverses) - 1U); | ||
#endif | ||
} | ||
|
||
DEBUG_PRINTF("portInfo.nProtocolPortIndexLast=%u", portInfo.nProtocolPortIndexLast); | ||
DEBUG_EXIT | ||
} | ||
|
||
void Print() { | ||
PixelConfiguration::Print(); | ||
|
||
void Print(); | ||
puts("Pixel DMX configuration"); | ||
printf(" Outputs : %d\n", m_nOutputPorts); | ||
printf(" Grouping count : %d [Groups : %d]\n", m_nGroupingCount, m_nGroups); | ||
} | ||
|
||
private: | ||
uint32_t m_nOutputPorts { 1 }; | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.