Skip to content

Commit

Permalink
Sync with local development
Browse files Browse the repository at this point in the history
  • Loading branch information
vanvught committed Jan 2, 2024
1 parent 1d518f5 commit a8e4499
Show file tree
Hide file tree
Showing 36 changed files with 519 additions and 651 deletions.
30 changes: 14 additions & 16 deletions gd32_emac_artnet_pixel_dmx_multi/firmware/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -72,13 +72,15 @@
#include "remoteconfigparams.h"

#include "configstore.h"
#include "storeartnet.h"


#include "firmwareversion.h"
#include "software_version.h"

static constexpr uint32_t DMXPORT_OFFSET = 64;
namespace artnetnode {
namespace configstore {
uint32_t DMXPORT_OFFSET = 64;
} // namespace configstore
} // namespace artnetnode

void Hardware::RebootHandler() {
WS28xxMulti::Get()->Blackout();
Expand Down Expand Up @@ -109,14 +111,9 @@ void main() {

ArtNetNode node;

StoreArtNet storeArtNet(DMXPORT_OFFSET);
node.SetArtNetStore(&storeArtNet);

ArtNetParams artnetParams;

if (artnetParams.Load()) {
artnetParams.Set(DMXPORT_OFFSET);
}
artnetParams.Load();
artnetParams.Set();

// LightSet A - Pixel - 64 Universes

Expand Down Expand Up @@ -155,8 +152,8 @@ void main() {

uint32_t nDmxUniverses = 0;

for (uint32_t nPortIndex = DMXPORT_OFFSET; nPortIndex < artnetnode::MAX_PORTS; nPortIndex++) {
const auto nDmxPortIndex = nPortIndex - DMXPORT_OFFSET;
for (uint32_t nPortIndex = artnetnode::configstore::DMXPORT_OFFSET; nPortIndex < artnetnode::MAX_PORTS; nPortIndex++) {
const auto nDmxPortIndex = nPortIndex - artnetnode::configstore::DMXPORT_OFFSET;

if (artnetParams.GetDirection(nDmxPortIndex) == lightset::PortDir::OUTPUT) {
const auto Universe = artnetParams.GetUniverse(nDmxPortIndex);
Expand All @@ -165,14 +162,15 @@ void main() {
}
}

DmxParams dmxparams;

Dmx dmx;

DmxParams dmxparams;
dmxparams.Load();
dmxparams.Set(&dmx);

for (uint32_t nPortIndex = DMXPORT_OFFSET; nPortIndex < artnetnode::MAX_PORTS; nPortIndex++) {
const auto nDmxPortIndex = nPortIndex - DMXPORT_OFFSET;
for (uint32_t nPortIndex = artnetnode::configstore::DMXPORT_OFFSET; nPortIndex < artnetnode::MAX_PORTS; nPortIndex++) {
const auto nDmxPortIndex = nPortIndex - artnetnode::configstore::DMXPORT_OFFSET;

if (node.GetPortDirection(nPortIndex) == lightset::PortDir::OUTPUT) {
dmx.SetPortDirection(nDmxPortIndex, dmx::PortDirection::OUTP, false);
Expand Down Expand Up @@ -235,7 +233,7 @@ void main() {
displayUdfParams.Load();
displayUdfParams.Set(&display);

display.Show(&node, DMXPORT_OFFSET);
display.Show(&node);

display.Printf(7, "%s:%d G%d %s",
PixelType::GetType(pixelDmxConfiguration.GetType()),
Expand Down
Original file line number Diff line number Diff line change
@@ -1 +1 @@
constexpr uint32_t DEVICE_SOFTWARE_VERSION_ID=1702811908;
constexpr uint32_t DEVICE_SOFTWARE_VERSION_ID=1704222230;
19 changes: 8 additions & 11 deletions gd32_emac_artnet_pixel_multi/firmware/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -66,13 +66,15 @@
#include "remoteconfigparams.h"

#include "configstore.h"
#include "storeartnet.h"


#include "firmwareversion.h"
#include "software_version.h"

static constexpr uint32_t DMXPORT_OFFSET = LIGHTSET_PORTS;
namespace artnetnode {
namespace configstore {
uint32_t DMXPORT_OFFSET = LIGHTSET_PORTS;
} // namespace configstore
} // namespace artnetnode

void Hardware::RebootHandler() {
WS28xxMulti::Get()->Blackout();
Expand Down Expand Up @@ -100,14 +102,9 @@ void main() {

ArtNetNode node;

StoreArtNet storeArtNet(DMXPORT_OFFSET);
node.SetArtNetStore(&storeArtNet);

ArtNetParams artnetParams;

if (artnetParams.Load()) {
artnetParams.Set(DMXPORT_OFFSET);
}
artnetParams.Load();
artnetParams.Set();

PixelDmxConfiguration pixelDmxConfiguration;

Expand Down Expand Up @@ -189,7 +186,7 @@ void main() {
displayUdfParams.Load();
displayUdfParams.Set(&display);

display.Show(&node, DMXPORT_OFFSET);
display.Show(&node);

display.Printf(7, "%s:%d G%d %s",
PixelType::GetType(pixelDmxConfiguration.GetType()),
Expand Down
2 changes: 1 addition & 1 deletion gd32_emac_artnet_pixel_multi/include/sofware_version_id.h
Original file line number Diff line number Diff line change
@@ -1 +1 @@
constexpr uint32_t DEVICE_SOFTWARE_VERSION_ID=1702811908;
constexpr uint32_t DEVICE_SOFTWARE_VERSION_ID=1704222259;
2 changes: 1 addition & 1 deletion gd32_emac_ddp_pixel_dmx_multi/firmware/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -124,9 +124,9 @@ void main() {

// LightSet B - DMX - 2 Universes

DmxParams dmxparams;
Dmx dmx;

DmxParams dmxparams;
dmxparams.Load();
dmxparams.Set(&dmx);

Expand Down
2 changes: 1 addition & 1 deletion gd32_emac_ddp_pixel_dmx_multi/include/sofware_version_id.h
Original file line number Diff line number Diff line change
@@ -1 +1 @@
constexpr uint32_t DEVICE_SOFTWARE_VERSION_ID=1702811913;
constexpr uint32_t DEVICE_SOFTWARE_VERSION_ID=1704222269;
2 changes: 1 addition & 1 deletion gd32_emac_ddp_pixel_multi/include/sofware_version_id.h
Original file line number Diff line number Diff line change
@@ -1 +1 @@
constexpr uint32_t DEVICE_SOFTWARE_VERSION_ID=1702811915;
constexpr uint32_t DEVICE_SOFTWARE_VERSION_ID=1704222278;
21 changes: 12 additions & 9 deletions gd32_emac_e131_pixel_dmx_multi/firmware/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -72,11 +72,14 @@

#include "configstore.h"


#include "firmwareversion.h"
#include "software_version.h"

static constexpr uint32_t DMXPORT_OFFSET = 64;
namespace e131bridge {
namespace configstore {
uint32_t DMXPORT_OFFSET = 64;
} // namespace configstore
} // namespace e131bridge

void Hardware::RebootHandler() {
WS28xxMulti::Get()->Blackout();
Expand Down Expand Up @@ -107,7 +110,7 @@ void main() {

E131Params e131params;
e131params.Load();
e131params.Set(DMXPORT_OFFSET);
e131params.Set();

// LightSet A - Pixel - 64 Universes

Expand Down Expand Up @@ -148,27 +151,27 @@ void main() {
auto direction = e131params.GetDirection(0);

if (direction == lightset::PortDir::OUTPUT) {
bridge.SetUniverse(DMXPORT_OFFSET, lightset::PortDir::OUTPUT, nUniverse);
bridge.SetUniverse(e131bridge::configstore::DMXPORT_OFFSET, lightset::PortDir::OUTPUT, nUniverse);
nDmxUniverses++;
}

nUniverse = e131params.GetUniverse(1, bIsSet);
direction = e131params.GetDirection(1);

if (direction == lightset::PortDir::OUTPUT) {
bridge.SetUniverse(DMXPORT_OFFSET + 1U, lightset::PortDir::OUTPUT, nUniverse);
bridge.SetUniverse(e131bridge::configstore::DMXPORT_OFFSET + 1U, lightset::PortDir::OUTPUT, nUniverse);
nDmxUniverses++;
}

DmxParams dmxparams;
Dmx dmx;

DmxParams dmxparams;
dmxparams.Load();
dmxparams.Set(&dmx);

for (uint32_t nPortIndex = DMXPORT_OFFSET; nPortIndex < e131bridge::MAX_PORTS; nPortIndex++) {
for (uint32_t nPortIndex = e131bridge::configstore::DMXPORT_OFFSET; nPortIndex < e131bridge::MAX_PORTS; nPortIndex++) {
uint16_t nUniverse;
const auto nDmxPortIndex = nPortIndex - DMXPORT_OFFSET;
const auto nDmxPortIndex = nPortIndex - e131bridge::configstore::DMXPORT_OFFSET;

if (bridge.GetUniverse(nPortIndex, nUniverse, lightset::PortDir::OUTPUT)) {
dmx.SetPortDirection(nDmxPortIndex, dmx::PortDirection::OUTP, false);
Expand Down Expand Up @@ -227,7 +230,7 @@ void main() {
displayUdfParams.Load();
displayUdfParams.Set(&display);

display.Show(&bridge, DMXPORT_OFFSET);
display.Show(&bridge);

display.Printf(7, "%s:%d G%d %s",
PixelType::GetType(pixelDmxConfiguration.GetType()),
Expand Down
3 changes: 1 addition & 2 deletions gd32_emac_e131_pixel_dmx_multi/include/sofware_version_id.h
Original file line number Diff line number Diff line change
@@ -1,2 +1 @@
// Generated do 14 sep 2023 12:39:45 CEST
constexpr uint32_t DEVICE_SOFTWARE_VERSION_ID=1694687985;
constexpr uint32_t DEVICE_SOFTWARE_VERSION_ID=1704222298;
8 changes: 6 additions & 2 deletions gd32_emac_e131_pixel_multi/firmware/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,11 @@
#include "firmwareversion.h"
#include "software_version.h"

static constexpr uint32_t DMXPORT_OFFSET = 32;
namespace e131bridge {
namespace configstore {
uint32_t DMXPORT_OFFSET = LIGHTSET_PORTS;
} // namespace configstore
} // namespace e131bridge

void Hardware::RebootHandler() {
WS28xxMulti::Get()->Blackout();
Expand Down Expand Up @@ -100,7 +104,7 @@ void main() {

E131Params e131params;
e131params.Load();
e131params.Set(DMXPORT_OFFSET);
e131params.Set();

PixelDmxConfiguration pixelDmxConfiguration;

Expand Down
3 changes: 1 addition & 2 deletions gd32_emac_e131_pixel_multi/include/sofware_version_id.h
Original file line number Diff line number Diff line change
@@ -1,2 +1 @@
// Generated do 14 sep 2023 12:39:46 CEST
constexpr uint32_t DEVICE_SOFTWARE_VERSION_ID=1694687986;
constexpr uint32_t DEVICE_SOFTWARE_VERSION_ID=1704222308;
63 changes: 4 additions & 59 deletions lib-artnet/include/artnetnode.h
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
/**
* Art-Net Designed by and Copyright Artistic Licence Holdings Ltd.
*/
/* Copyright (C) 2016-2023 by Arjan van Vught mailto:info@orangepi-dmx.nl
/* Copyright (C) 2016-2024 by Arjan van Vught mailto:info@orangepi-dmx.nl
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
Expand Down Expand Up @@ -48,7 +48,6 @@
#include "artnet.h"
#include "artnetnode_ports.h"
#include "artnettimecode.h"
#include "artnetstore.h"
#include "artnetdisplay.h"
#include "artnettrigger.h"
#if defined (RDM_CONTROLLER)
Expand Down Expand Up @@ -273,6 +272,9 @@ class ArtNetNode {
return artnet::VERSION;
}

void SetOutputStyle(const uint32_t nPortIndex, lightset::OutputStyle outputStyle);
lightset::OutputStyle GetOutputStyle(const uint32_t nPortIndex) const;

void SetFailSafe(const artnetnode::FailSafe failsafe);

artnetnode::FailSafe GetFailSafe() {
Expand Down Expand Up @@ -300,58 +302,6 @@ class ArtNetNode {
return artnetnode::FailSafe::OFF;
}

#if defined (OUTPUT_HAVE_STYLESWITCH)
void SetOutputStyle(const uint32_t nPortIndex, lightset::OutputStyle outputStyle) {
assert(nPortIndex < artnetnode::MAX_PORTS);

if (outputStyle == GetOutputStyle(nPortIndex)) {
return;
}

if ((m_State.status == artnetnode::Status::ON) && (m_pLightSet != nullptr)) {
m_pLightSet->SetOutputStyle(nPortIndex, outputStyle);
outputStyle = m_pLightSet->GetOutputStyle(nPortIndex);
}

if (outputStyle == lightset::OutputStyle::CONSTANT) {
m_OutputPort[nPortIndex].GoodOutputB |= artnet::GoodOutputB::STYLE_CONSTANT;
} else {
m_OutputPort[nPortIndex].GoodOutputB &= static_cast<uint8_t>(~artnet::GoodOutputB::STYLE_CONSTANT);
}

#if defined (OUTPUT_DMX_SEND) || defined (OUTPUT_DMX_SEND_MULTI)
/**
* FIXME I do not like this hack. It should be handled in dmx.cpp
*/
if ((m_Node.Port[nPortIndex].direction == lightset::PortDir::OUTPUT)
&& (outputStyle == lightset::OutputStyle::CONSTANT)
&& (m_pLightSet != nullptr)) {
if (m_OutputPort[nPortIndex].IsTransmitting) {
m_OutputPort[nPortIndex].IsTransmitting = false;
m_pLightSet->Stop(nPortIndex);
}
}
#endif

m_State.IsSynchronousMode = false;

if (m_State.status == artnetnode::Status::ON) {
if (m_pArtNetStore != nullptr) {
m_pArtNetStore->SaveOutputStyle(nPortIndex, outputStyle);
}

artnet::display_outputstyle(nPortIndex, outputStyle);
}
}

lightset::OutputStyle GetOutputStyle(const uint32_t nPortIndex) const {
assert(nPortIndex < artnetnode::MAX_PORTS);

const auto isStyleConstant = (m_OutputPort[nPortIndex].GoodOutputB & artnet::GoodOutputB::STYLE_CONSTANT) == artnet::GoodOutputB::STYLE_CONSTANT;
return isStyleConstant ? lightset::OutputStyle::CONSTANT : lightset::OutputStyle::DELTA;
}
#endif

void SetOutput(LightSet *pLightSet) {
m_pLightSet = pLightSet;
#if (ARTNET_VERSION >= 4)
Expand Down Expand Up @@ -498,10 +448,6 @@ class ArtNetNode {

void SetTimeCodeIp(uint32_t nDestinationIp);

void SetArtNetStore(ArtNetStore *pArtNetStore) {
m_pArtNetStore = pArtNetStore;
}

void SetArtNetTrigger(ArtNetTrigger *pArtNetTrigger) {
m_pArtNetTrigger = pArtNetTrigger;
}
Expand Down Expand Up @@ -725,7 +671,6 @@ class ArtNetNode {

ArtNetTimeCode *m_pArtNetTimeCode { nullptr };
ArtNetTrigger *m_pArtNetTrigger { nullptr };
ArtNetStore *m_pArtNetStore { nullptr };

artnetnode::Node m_Node;
artnetnode::State m_State;
Expand Down
2 changes: 1 addition & 1 deletion lib-artnet/include/artnetparams.h
Original file line number Diff line number Diff line change
Expand Up @@ -143,7 +143,7 @@ class ArtNetParams {
Builder(nullptr, pBuffer, nLength, nSize);
}

void Set(uint32_t nPortIndexOffset);
void Set();

bool IsRdm() const {
return isMaskSet(artnetparams::Mask::ENABLE_RDM);
Expand Down
Loading

0 comments on commit a8e4499

Please sign in to comment.