Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/libdof.yml
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ jobs:
# install dependencies
#
- if: (matrix.platform == 'win')
uses: microsoft/setup-msbuild@v2
uses: microsoft/setup-msbuild@v3
- if: (matrix.platform == 'win')
run: |
if [[ "${{ matrix.arch }}" == "x64" ]]; then
Expand Down
2 changes: 1 addition & 1 deletion include/DOF/DOF.h
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

#define LIBDOF_VERSION_MAJOR 0 // X Digits
#define LIBDOF_VERSION_MINOR 4 // Max 2 Digits
#define LIBDOF_VERSION_PATCH 5 // Max 2 Digits
#define LIBDOF_VERSION_PATCH 6 // Max 2 Digits

#define _LIBDOF_STR(x) #x
#define LIBDOF_STR(x) _LIBDOF_STR(x)
Expand Down
2 changes: 0 additions & 2 deletions src/Pinball.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -441,7 +441,6 @@ void Pinball::MainThreadDoIt()
{
try
{

auto now = std::chrono::steady_clock::now();
updateRequired |= m_alarms->ExecuteAlarms(now + std::chrono::milliseconds(1));
}
Expand All @@ -465,7 +464,6 @@ void Pinball::MainThreadDoIt()

if (m_keepMainThreadAlive)
{

auto nextAlarm = m_alarms->GetNextAlarmTime();
auto now = std::chrono::steady_clock::now();

Expand Down
1 change: 0 additions & 1 deletion src/cab/out/OutputControllerCompleteBase.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -339,7 +339,6 @@ void OutputControllerCompleteBase::UpdaterThreadDoIt()

if (m_keepUpdaterThreadAlive)
{

std::unique_lock<std::mutex> lock(m_conditionMutex);
m_updateCondition.wait_for(lock, std::chrono::milliseconds(50), [this] { return !m_keepUpdaterThreadAlive || m_updateRequired; });
}
Expand Down
20 changes: 3 additions & 17 deletions src/cab/out/adressableledstrip/WemosD1StripController.cpp
Original file line number Diff line number Diff line change
@@ -1,10 +1,9 @@
#include "WemosD1StripController.h"
#include "../../../Log.h"
#include "../../../general/StringExtensions.h"
#include <algorithm>
#include <thread>
#include <chrono>
#include <climits>
#include <thread>

namespace DOF
{
Expand Down Expand Up @@ -145,24 +144,11 @@ void WemosD1MPStripController::SendLedstripData(const std::vector<uint8_t>& outp
int nbData = static_cast<int>(m_compressedData.size()) / 4;
int nbLeds = static_cast<int>(outputValues.size()) / 3;

if (targetPosition + nbLeds > GetNumberOfLedsPerChannel() * 10)
{
throw std::runtime_error(StringExtensions::Build("LED range {0}-{1} exceeds configured strip capacity {2}", std::to_string(targetPosition),
std::to_string(targetPosition + nbLeds - 1), std::to_string(GetNumberOfLedsPerChannel() * 10)));
}

std::vector<uint8_t> commandData = { (uint8_t)'Q', (uint8_t)(targetPosition >> 8), (uint8_t)(targetPosition & 255), (uint8_t)(nbData >> 8), (uint8_t)(nbData & 255),
(uint8_t)(nbLeds >> 8), (uint8_t)(nbLeds & 255) };

enum sp_return result = sp_blocking_write(GetComPort(), commandData.data(), 7, GetComPortTimeOutMs());
if (result < 0)
throw std::runtime_error(StringExtensions::Build("Failed to write compressed command data: {0}", sp_last_error_message()));

result = sp_blocking_write(GetComPort(), m_compressedData.data(), m_compressedData.size(), GetComPortTimeOutMs());
if (result < 0)
throw std::runtime_error(StringExtensions::Build("Failed to write compressed output values: {0}", sp_last_error_message()));

std::this_thread::sleep_for(std::chrono::milliseconds(100));
sp_blocking_write(GetComPort(), commandData.data(), 7, GetComPortTimeOutMs());
sp_blocking_write(GetComPort(), m_compressedData.data(), m_compressedData.size(), GetComPortTimeOutMs());
}
else
{
Expand Down
3 changes: 0 additions & 3 deletions src/cab/overrides/TableOverrideSetting.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,6 @@ void TableOverrideSetting::ParseRoms()

while (std::getline(ss, item, ','))
{

item.erase(0, item.find_first_not_of(" \t"));
item.erase(item.find_last_not_of(" \t") + 1);

Expand Down Expand Up @@ -70,7 +69,6 @@ void TableOverrideSetting::ParseTables()

while (std::getline(ss, item, ','))
{

item.erase(0, item.find_first_not_of(" \t"));
item.erase(item.find_last_not_of(" \t") + 1);

Expand All @@ -91,7 +89,6 @@ void TableOverrideSetting::AddTableOverrideSettingDevice(TableOverrideSettingDev

void TableOverrideSetting::ClearTableOverrideSettingDevices()
{

for (auto* device : m_tableOverrideSettingDeviceList)
{
delete device;
Expand Down
1 change: 0 additions & 1 deletion src/cab/sequencer/SequentialOutputSetting.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,6 @@ int SequentialOutputDevice::GetNextOutput(int currentOutputNumber)
}
else
{

m_outputIndex = 0;
m_outputTimestamp = now;
return m_outputNumbers[m_outputIndex];
Expand Down
2 changes: 0 additions & 2 deletions src/cab/toys/ToyList.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@ ToyList::ToyList() { }

ToyList::~ToyList()
{

for (IToy* toy : *this)
delete toy;
clear();
Expand Down Expand Up @@ -85,7 +84,6 @@ void ToyList::UpdateToys()
{
if (toy != nullptr)
{

IToyUpdatable* updatableToy = dynamic_cast<IToyUpdatable*>(toy);
if (updatableToy != nullptr)
{
Expand Down
10 changes: 0 additions & 10 deletions src/cab/toys/hardware/Motor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -69,13 +69,10 @@ void Motor::UpdateOutputs()
{
if (m_currentMotorPower == 0)
{

if (p > 0)
{

if (m_kickstartDurationMs > 0 && m_kickstartPower > 0 && p <= m_kickstartPower)
{

m_targetMotorPower = p;

if (!m_kickstartActive)
Expand All @@ -91,7 +88,6 @@ void Motor::UpdateOutputs()
}
else
{

m_currentMotorPower = p;
m_targetMotorPower = p;
output->SetOutput(static_cast<uint8_t>(p));
Expand All @@ -105,15 +101,12 @@ void Motor::UpdateOutputs()
}
else if (m_kickstartActive)
{

if (p > 0)
{

m_targetMotorPower = p;
}
else
{

if (m_alarmHandler != nullptr)
{
}
Expand All @@ -124,10 +117,8 @@ void Motor::UpdateOutputs()
}
else
{

if (p == 0)
{

if (m_alarmHandler != nullptr)
{
}
Expand All @@ -137,7 +128,6 @@ void Motor::UpdateOutputs()
}
else if (p != m_currentMotorPower)
{

m_currentMotorPower = p;
m_targetMotorPower = p;
output->SetOutput(static_cast<uint8_t>(p));
Expand Down
3 changes: 0 additions & 3 deletions src/cab/toys/layer/MatrixDictionaryBase.h
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,6 @@ template <typename MatrixElementType> MatrixElementType* MatrixDictionaryBase<Ma

template <typename MatrixElementType> void MatrixDictionaryBase<MatrixElementType>::SetLayer(int layerNr, MatrixElementType* data)
{

auto it = this->find(layerNr);
if (it != this->end())
{
Expand All @@ -93,7 +92,6 @@ template <typename MatrixElementType> void MatrixDictionaryBase<MatrixElementTyp
int newWidth = MathExtensions::Limit(value, 1, INT_MAX);
if (newWidth != m_width)
{

Clear();
m_width = newWidth;
}
Expand All @@ -104,7 +102,6 @@ template <typename MatrixElementType> void MatrixDictionaryBase<MatrixElementTyp
int newHeight = MathExtensions::Limit(value, 1, INT_MAX);
if (newHeight != m_height)
{

Clear();
m_height = newHeight;
}
Expand Down
1 change: 0 additions & 1 deletion src/cab/toys/layer/RGBAToy.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,6 @@ void RGBAToy::Init(Cabinet* cabinet)

void RGBAToy::Reset()
{

m_currentColor = RGBAColor(0, 0, 0, 255);
UpdateOutputs();
}
Expand Down
1 change: 0 additions & 1 deletion src/cab/toys/lwequivalent/LedWizEquivalent.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,6 @@ LedWizEquivalentOutputList::LedWizEquivalentOutputList() { }

LedWizEquivalentOutputList::~LedWizEquivalentOutputList()
{

for (LedWizEquivalentOutput* output : *this)
{
delete output;
Expand Down
8 changes: 0 additions & 8 deletions src/cab/toys/virtual/ToyGroupBase.h
Original file line number Diff line number Diff line change
Expand Up @@ -60,11 +60,8 @@ template <typename MatrixElementType> ToyGroupBase<MatrixElementType>::~ToyGroup

template <typename MatrixElementType> void ToyGroupBase<MatrixElementType>::Init(Cabinet* cabinet)
{


InitializeToyMatrix(cabinet);


m_layers = LayerDictionary<MatrixElementType>(m_width, m_height);
}

Expand All @@ -76,7 +73,6 @@ template <typename MatrixElementType> void ToyGroupBase<MatrixElementType>::Upda

template <typename MatrixElementType> void ToyGroupBase<MatrixElementType>::UpdateOutputs()
{

std::vector<int> layerNumbers = m_layers.GetLayerNumbers();

for (int layerNr : layerNumbers)
Expand All @@ -92,7 +88,6 @@ template <typename MatrixElementType> void ToyGroupBase<MatrixElementType>::Upda
{
if (y < static_cast<int>(m_toys.size()) && x < static_cast<int>(m_toys[y].size()) && m_toys[y][x] != nullptr)
{

LayerDictionary<MatrixElementType>& targetLayers = m_toys[y][x]->GetLayers();
MatrixElementType* targetLayer = targetLayers.GetOrCreateLayer(targetLayerNr, 1);
if (targetLayer != nullptr)
Expand Down Expand Up @@ -142,7 +137,6 @@ template <typename MatrixElementType> void ToyGroupBase<MatrixElementType>::Init

if (m_height > 0)
{

for (const auto& row : m_toyNames)
{
m_width = std::max(m_width, static_cast<int>(row.size()));
Expand All @@ -151,7 +145,6 @@ template <typename MatrixElementType> void ToyGroupBase<MatrixElementType>::Init

if (m_height == 0 || m_width == 0)
{

m_height = 1;
m_width = 1;
m_toyNames = { { "" } };
Expand All @@ -169,7 +162,6 @@ template <typename MatrixElementType> void ToyGroupBase<MatrixElementType>::Init
{
if (y < static_cast<int>(m_toyNames.size()) && x < static_cast<int>(m_toyNames[y].size()) && !m_toyNames[y][x].empty())
{

IToy* toy = cabinet->GetToys()->FindByName(m_toyNames[y][x]);
ILayerToy<MatrixElementType>* layerToy = dynamic_cast<ILayerToy<MatrixElementType>*>(toy);
m_toys[y][x] = layerToy;
Expand Down
1 change: 0 additions & 1 deletion src/fx/EffectList.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,6 @@ bool EffectList::FromXml(const tinyxml2::XMLElement* element)
IEffect* effect = factory.CreateEffect(typeName);
if (effect)
{

if (effect->FromXml(effectElement))
{
Add(effect);
Expand Down
12 changes: 8 additions & 4 deletions src/fx/matrixfx/MatrixBitmapAnimationEffectBase.h
Original file line number Diff line number Diff line change
Expand Up @@ -32,12 +32,16 @@ template <typename MatrixElementType> class MatrixBitmapAnimationEffectBase : pu
void SetAnimationStepDirection(MatrixAnimationStepDirectionEnum value) { m_animationStepDirection = value; }
AnimationBehaviourEnum GetAnimationBehaviour() const { return m_animationBehaviour; }
void SetAnimationBehaviour(AnimationBehaviourEnum value) { m_animationBehaviour = value; }
virtual void SetBitmapTop(int value) override { MatrixBitmapEffectBase<MatrixElementType>::SetBitmapTop(MathExtensions::Limit(value, 0, INT_MAX)); }
virtual void SetBitmapLeft(int value) override { MatrixBitmapEffectBase<MatrixElementType>::SetBitmapLeft(MathExtensions::Limit(value, 0, INT_MAX)); }
virtual void SetBitmapWidth(int value) override { MatrixBitmapEffectBase<MatrixElementType>::SetBitmapWidth(MathExtensions::Limit(value, -1, INT_MAX)); }
virtual void SetBitmapHeight(int value) override { MatrixBitmapEffectBase<MatrixElementType>::SetBitmapHeight(MathExtensions::Limit(value, -1, INT_MAX)); }
virtual void Trigger(TableElementData* tableElementData) override;
virtual void Init(Table* table) override;
virtual void Finish() override;

protected:
void ControlAnimation(int fadeValue, TableElementData* tableElementData);
void ControlAnimation(int fadeValue);
void Animate();
void StopAnimation();
void CleanupPixels();
Expand Down Expand Up @@ -78,11 +82,11 @@ template <typename MatrixElementType> void MatrixBitmapAnimationEffectBase<Matri
int fadeValue = tableElementData->m_value;
if (this->GetFadeMode() == FadeModeEnum::OnOff)
fadeValue = (fadeValue < 1 ? 0 : 255);
ControlAnimation(fadeValue, tableElementData);
ControlAnimation(fadeValue);
}
}

template <typename MatrixElementType> void MatrixBitmapAnimationEffectBase<MatrixElementType>::ControlAnimation(int fadeValue, TableElementData* tableElementData)
template <typename MatrixElementType> void MatrixBitmapAnimationEffectBase<MatrixElementType>::ControlAnimation(int fadeValue)
{
if (fadeValue > 0)
{
Expand Down Expand Up @@ -201,7 +205,7 @@ template <typename MatrixElementType> void MatrixBitmapAnimationEffectBase<Matri
m_pixels.resize(stepCount);
for (int s = 0; s < stepCount; s++)
{
auto stepFrameIt = frames.find(this->GetBitmapFrameNumber() + s * m_animationStepSize);
auto stepFrameIt = frames.find(this->GetBitmapFrameNumber() + s);
if (stepFrameIt != frames.end())
{
FastBitmap clippedBitmap = stepFrameIt->second.GetClip(this->GetAreaWidth(), this->GetAreaHeight(), this->GetBitmapLeft(), this->GetBitmapTop(), this->GetBitmapWidth(),
Expand Down
10 changes: 5 additions & 5 deletions src/fx/matrixfx/MatrixBitmapEffectBase.h
Original file line number Diff line number Diff line change
Expand Up @@ -29,15 +29,15 @@ template <typename MatrixElementType> class MatrixBitmapEffectBase : public Matr
virtual FilePattern* GetBitmapFilePattern() const override { return m_bitmapFilePattern; }
virtual void SetBitmapFilePattern(FilePattern* value) override;
virtual int GetBitmapFrameNumber() const override { return m_bitmapFrameNumber; }
virtual void SetBitmapFrameNumber(int value) override { m_bitmapFrameNumber = MathExtensions::Limit(value, 0, 1000); }
virtual void SetBitmapFrameNumber(int value) override { m_bitmapFrameNumber = value; }
virtual int GetBitmapLeft() const override { return m_bitmapLeft; }
virtual void SetBitmapLeft(int value) override { m_bitmapLeft = MathExtensions::Limit(value, 0, 1000); }
virtual void SetBitmapLeft(int value) override { m_bitmapLeft = value; }
virtual int GetBitmapTop() const override { return m_bitmapTop; }
virtual void SetBitmapTop(int value) override { m_bitmapTop = MathExtensions::Limit(value, 0, 1000); }
virtual void SetBitmapTop(int value) override { m_bitmapTop = value; }
virtual int GetBitmapWidth() const override { return m_bitmapWidth; }
virtual void SetBitmapWidth(int value) override { m_bitmapWidth = MathExtensions::Limit(value, -1, 1000); }
virtual void SetBitmapWidth(int value) override { m_bitmapWidth = value; }
virtual int GetBitmapHeight() const override { return m_bitmapHeight; }
virtual void SetBitmapHeight(int value) override { m_bitmapHeight = MathExtensions::Limit(value, -1, 1000); }
virtual void SetBitmapHeight(int value) override { m_bitmapHeight = value; }
virtual FastBitmapDataExtractModeEnum GetDataExtractMode() const override { return m_dataExtractMode; }
virtual void SetDataExtractMode(FastBitmapDataExtractModeEnum value) override { m_dataExtractMode = value; }
virtual void Trigger(TableElementData* tableElementData) override;
Expand Down
4 changes: 2 additions & 2 deletions src/fx/matrixfx/MatrixEffectBase.h
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,7 @@ template <typename MatrixElementType> void MatrixEffectBase<MatrixElementType>::
{
tmp = m_areaRight;
m_areaRight = m_areaLeft;
m_areaLeft = tmp;
m_areaLeft = m_areaRight;
}
if (m_areaTop > m_areaBottom)
{
Expand All @@ -127,7 +127,7 @@ template <typename MatrixElementType> void MatrixEffectBase<MatrixElementType>::
std::vector<std::string> args2 = { std::to_string(m_areaLeft), std::to_string(m_areaTop), std::to_string(m_areaRight), std::to_string(m_areaBottom), std::to_string(GetAreaWidth()),
std::to_string(GetAreaHeight()) };
args.insert(args.end(), args2.begin(), args2.end());
args.push_back(this->GetName());
args.push_back(this->GetXmlElementName());
Log::Instrumentation("MX",
StringExtensions::Build("MatrixBase for {12}. Calculated area size: AreaDef(L:{0}, T:{1}, W:{2}, H:{3}), Matrix(W:{4}, H:{5}), ResultArea(Left: {6}, Top:{7}, Right:{8}, "
"Bottom:{9}, Width:{10}, Height:{11})",
Expand Down
Loading