Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Resolves #186, Resolves #291 , Resolves #287 , Resolves #288 , Resolves #292 , Resolves #293 , Resolves #294 #295

Merged
merged 56 commits into from
Dec 27, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
56 commits
Select commit Hold shift + click to select a range
924aac3
#286
vanvught Dec 2, 2024
3dfc3c2
Hardware::RebootHandler() -> hal:: reboot_handler()
vanvught Dec 2, 2024
b8d64c8
Updated GD32 board definitions
vanvught Dec 2, 2024
4a6dcdb
Added support for DMA memory copy
vanvught Dec 2, 2024
dbe1840
Added JSON frame_rate
vanvught Dec 2, 2024
de16c51
Moved code to *.h for better inline optimization
vanvught Dec 2, 2024
55eec6c
Added sections for fast SRAM
vanvught Dec 2, 2024
496c156
Added ArtPollReply UserData and RefreshRate
vanvught Dec 2, 2024
cb52042
Changed CONFIG_ENET_ENABLE_PTP -> CONFIG_NET_ENABLE_PTP
vanvught Dec 2, 2024
60784d2
Removed vtable for ArtNetTimeCode and ArtNetTrigger
vanvught Dec 2, 2024
f1c08b5
Updated Eclipse project settings
vanvught Dec 2, 2024
41749ac
Art-Net trigger is now a callback function pointer
vanvught Dec 2, 2024
9efedbf
Added TCNetTimeCodeCallbackFunctionPtr
vanvught Dec 2, 2024
e4c0c36
Refactoring
vanvught Dec 2, 2024
38a62a0
Added CONFIG_SPI_LCD_OPTIMIZE_O2 and CONFIG_SPI_LCD_OPTIMIZE_O3
vanvught Dec 2, 2024
0f4ff45
Refactoring
vanvught Dec 2, 2024
49a8e4b
Fixed missing \n
vanvught Dec 2, 2024
7cea808
Refactor hal::i2c -> HAL_I2C
vanvught Dec 2, 2024
273fab4
Refactor hal::i2c -> HAL_I2C
vanvught Dec 2, 2024
14982f1
Fixed issue with SK6812W
vanvught Dec 3, 2024
e0b9e30
Fixed issue that Art-Net was not working
vanvught Dec 3, 2024
f35c6fe
Updated Eclipse project settings
vanvught Dec 5, 2024
c9cfcde
#289
vanvught Dec 6, 2024
732824e
W.I.P. #287
vanvught Dec 6, 2024
91123d1
W.I.P. #287
vanvught Dec 6, 2024
1521fab
Minor cleanup
vanvught Dec 6, 2024
1e00691
Removed mdns_print()
vanvught Dec 6, 2024
97caeca
W.I.P. #287
vanvught Dec 7, 2024
b609a7b
W.I.P. #287
vanvught Dec 7, 2024
ac66c8e
W.I.P. #287
vanvught Dec 10, 2024
37bac76
Fixed #291
vanvught Dec 14, 2024
87ed397
#292
vanvught Dec 18, 2024
abe881c
Updated Eclipse project settings
vanvught Dec 18, 2024
2048667
Moved DmxConfigUdp to DmxSend
vanvught Dec 18, 2024
fa9ad5e
#287 Fixed overflow issue
vanvught Dec 18, 2024
3688d5f
Minor code cleanup
vanvught Dec 18, 2024
187223e
#293
vanvught Dec 22, 2024
5a712f1
#292
vanvught Dec 22, 2024
04d486b
Refactoring and minor cleanup
vanvught Dec 22, 2024
3a2b6af
Added CONFIG_NET_ENABLE_NTP_CLIENT
vanvught Dec 22, 2024
298cb8f
Refactoring and minor cleanup
vanvught Dec 22, 2024
e064456
LtcEtc has now UDP staticCallbackFunction
vanvught Dec 22, 2024
6b49bf8
Removed Run()
vanvught Dec 22, 2024
ce1a1af
Refactoring
vanvught Dec 22, 2024
12b10b3
Now using UDP staticCallbackFunction
vanvught Dec 22, 2024
1c93a80
Now using UDP staticCallbackFunction
vanvught Dec 23, 2024
d59c55c
Fixed issue with variable not initialised
vanvught Dec 23, 2024
8dcb663
Added support for AT24C04
vanvught Dec 23, 2024
2fca121
Removed Run()
vanvught Dec 24, 2024
8bdaa08
Ran clang-tidy
vanvught Dec 25, 2024
d5bf504
#294
vanvught Dec 27, 2024
9d859bf
Removed LightSet *const pLightSet references
vanvught Dec 27, 2024
b2b1be2
OSC Server is now using UDP staticCallbackFunction
vanvught Dec 27, 2024
6197a81
Code cleanup
vanvught Dec 27, 2024
3de0ae9
Now using UDP staticCallbackFunction
vanvught Dec 27, 2024
b986354
Updated SOFTWARE_VERSION[]
vanvught Dec 27, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
18 changes: 17 additions & 1 deletion firmware-template-h3/memmap
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
MEMORY
{
ram : ORIGIN = 0x40000000, LENGTH = 16M
SRAMA1 : ORIGIN = 0x00000000, LENGTH = 64K
SRAMA2 : ORIGIN = 0x00044000, LENGTH = 32K
ram : ORIGIN = 0x40000000, LENGTH = 16M
}

__ram_start = ORIGIN(ram);
Expand All @@ -21,6 +23,20 @@ __svc_cpus_stack_size = 0x10000;

SECTIONS
{
.srama1 :
{
. = ALIGN(4);
*(.srama1)
*(.srama1*)
} >SRAMA1

.srama2 :
{
. = ALIGN(4);
*(.srama2)
*(.srama2*)
} >SRAMA2

.init :
{
. = ALIGN(4);
Expand Down
8 changes: 4 additions & 4 deletions firmware-template/libs.mk
Original file line number Diff line number Diff line change
Expand Up @@ -33,10 +33,6 @@ ifeq ($(findstring E131_CONTROLLER,$(DEFINES)),E131_CONTROLLER)
endif
endif

ifeq ($(findstring NODE_SHOWFILE,$(DEFINES)),NODE_SHOWFILE)
LIBS+=showfile osc
endif

ifeq ($(findstring NODE_LTC_SMPTE,$(DEFINES)),NODE_LTC_SMPTE)
LIBS+=ltc tcnet midi input osc ws28xxdisplay ws28xx rgbpanel gps
endif
Expand All @@ -63,6 +59,10 @@ ifeq ($(findstring ARTNET_CONTROLLER,$(DEFINES)),ARTNET_CONTROLLER)
endif
endif

ifeq ($(findstring NODE_SHOWFILE,$(DEFINES)),NODE_SHOWFILE)
LIBS+=showfile osc
endif

ifeq ($(findstring RDM_CONTROLLER,$(DEFINES)),RDM_CONTROLLER)
RDM=1
DMX=1
Expand Down
20 changes: 14 additions & 6 deletions include/net/if.h
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
* @file if.h
*
*/
/* Copyright (C) 2020 by Arjan van Vught mailto:info@orangepi-dmx.nl
/* Copyright (C) 2020-2024 by Arjan van Vught mailto:info@gd32-dmx.org
*
* 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 All @@ -23,13 +23,21 @@
* THE SOFTWARE.
*/

#ifndef IF_H_
#define IF_H_
#ifndef NET_IF_H_
#define NET_IF_H_

#define IF_NAMESIZE 16
/**
* https://pubs.opengroup.org/onlinepubs/009695399/basedefs/net/if.h.html
*
* The <net/if.h> header shall define the following symbolic constant for the length of a buffer containing
* an interface name (including the terminating NULL character):
* IF_NAMESIZE Interface name length.
*/

#define IF_NAMESIZE 16 ///< Length of interface name (including the terminating NULL character).

#ifndef IFNAMSIZ
#define IFNAMSIZ IF_NAMESIZE
# define IFNAMSIZ IF_NAMESIZE
#endif

#endif /* IF_H_ */
#endif /* NET_IF_H_ */
5 changes: 0 additions & 5 deletions include/string.h
Original file line number Diff line number Diff line change
Expand Up @@ -189,11 +189,6 @@ inline int strncasecmp(const char *s1, const char *s2, size_t n) {
return 0;
}

inline char *strcat(char *s1, const char *s2) {
strcpy(s1 + strlen(s1), s2);
return s1;
}

inline char *strchr(const char *p, int ch) {
char c = (char) ch;

Expand Down
4 changes: 2 additions & 2 deletions lib-arm/.settings/language.settings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<provider copy-of="extension" id="org.eclipse.cdt.ui.UserLanguageSettingsProvider"/>
<provider-reference id="org.eclipse.cdt.core.ReferencedProjectsLanguageSettingsProvider" ref="shared-provider"/>
<provider copy-of="extension" id="org.eclipse.cdt.managedbuilder.core.GCCBuildCommandParser"/>
<provider class="org.eclipse.cdt.internal.build.crossgcc.CrossGCCBuiltinSpecsDetector" console="false" env-hash="-868968903555373684" id="org.eclipse.cdt.build.crossgcc.CrossGCCBuiltinSpecsDetector" keep-relative-paths="false" name="CDT Cross GCC Built-in Compiler Settings" parameter="${COMMAND} ${FLAGS} -E -P -v -dD &quot;${INPUTS}&quot;" prefer-non-shared="true">
<provider class="org.eclipse.cdt.internal.build.crossgcc.CrossGCCBuiltinSpecsDetector" console="false" env-hash="-868850457862413684" id="org.eclipse.cdt.build.crossgcc.CrossGCCBuiltinSpecsDetector" keep-relative-paths="false" name="CDT Cross GCC Built-in Compiler Settings" parameter="${COMMAND} ${FLAGS} -E -P -v -dD &quot;${INPUTS}&quot;" prefer-non-shared="true">
<language-scope id="org.eclipse.cdt.core.gcc"/>
<language-scope id="org.eclipse.cdt.core.g++"/>
</provider>
Expand All @@ -17,7 +17,7 @@
<provider copy-of="extension" id="org.eclipse.cdt.ui.UserLanguageSettingsProvider"/>
<provider-reference id="org.eclipse.cdt.core.ReferencedProjectsLanguageSettingsProvider" ref="shared-provider"/>
<provider copy-of="extension" id="org.eclipse.cdt.managedbuilder.core.GCCBuildCommandParser"/>
<provider class="org.eclipse.cdt.internal.build.crossgcc.CrossGCCBuiltinSpecsDetector" console="false" env-hash="1924002177239169812" id="org.eclipse.cdt.build.crossgcc.CrossGCCBuiltinSpecsDetector" keep-relative-paths="false" name="CDT Cross GCC Built-in Compiler Settings" parameter="${COMMAND} ${FLAGS} -E -P -v -dD &quot;${INPUTS}&quot;" prefer-non-shared="true">
<provider class="org.eclipse.cdt.internal.build.crossgcc.CrossGCCBuiltinSpecsDetector" console="false" env-hash="1924120622932129812" id="org.eclipse.cdt.build.crossgcc.CrossGCCBuiltinSpecsDetector" keep-relative-paths="false" name="CDT Cross GCC Built-in Compiler Settings" parameter="${COMMAND} ${FLAGS} -E -P -v -dD &quot;${INPUTS}&quot;" prefer-non-shared="true">
<language-scope id="org.eclipse.cdt.core.gcc"/>
<language-scope id="org.eclipse.cdt.core.g++"/>
</provider>
Expand Down
3 changes: 3 additions & 0 deletions lib-artnet/.cproject
Original file line number Diff line number Diff line change
Expand Up @@ -374,6 +374,7 @@
<listOptionValue builtIn="false" value="LIGHTSET_PORTS=4"/>
<listOptionValue builtIn="false" value="ARTNET_HAVE_TIMECODE"/>
<listOptionValue builtIn="false" value="OUTPUT_HAVE_STYLESWITCH"/>
<listOptionValue builtIn="false" value="ARTNET_HAVE_TRIGGER"/>
</option>
<option IS_BUILTIN_EMPTY="false" IS_VALUE_EMPTY="true" id="ilg.gnuarmeclipse.managedbuild.cross.option.assembler.include.paths.653222067" name="Include paths (-I)" superClass="ilg.gnuarmeclipse.managedbuild.cross.option.assembler.include.paths" valueType="includePath"/>
<inputType id="ilg.gnuarmeclipse.managedbuild.cross.tool.assembler.input.1115950689" superClass="ilg.gnuarmeclipse.managedbuild.cross.tool.assembler.input"/>
Expand All @@ -393,6 +394,7 @@
<listOptionValue builtIn="false" value="LIGHTSET_PORTS=4"/>
<listOptionValue builtIn="false" value="ARTNET_HAVE_TIMECODE"/>
<listOptionValue builtIn="false" value="OUTPUT_HAVE_STYLESWITCH"/>
<listOptionValue builtIn="false" value="ARTNET_HAVE_TRIGGER"/>
</option>
<option IS_BUILTIN_EMPTY="false" IS_VALUE_EMPTY="true" id="ilg.gnuarmeclipse.managedbuild.cross.option.c.compiler.include.paths.510275320" name="Include paths (-I)" superClass="ilg.gnuarmeclipse.managedbuild.cross.option.c.compiler.include.paths" useByScannerDiscovery="true" valueType="includePath"/>
<inputType id="ilg.gnuarmeclipse.managedbuild.cross.tool.c.compiler.input.2134415444" superClass="ilg.gnuarmeclipse.managedbuild.cross.tool.c.compiler.input"/>
Expand All @@ -412,6 +414,7 @@
<listOptionValue builtIn="false" value="LIGHTSET_PORTS=4"/>
<listOptionValue builtIn="false" value="ARTNET_HAVE_TIMECODE"/>
<listOptionValue builtIn="false" value="OUTPUT_HAVE_STYLESWITCH"/>
<listOptionValue builtIn="false" value="ARTNET_HAVE_TRIGGER"/>
</option>
<option IS_BUILTIN_EMPTY="false" IS_VALUE_EMPTY="false" id="ilg.gnuarmeclipse.managedbuild.cross.option.cpp.compiler.include.paths.1645629639" name="Include paths (-I)" superClass="ilg.gnuarmeclipse.managedbuild.cross.option.cpp.compiler.include.paths" useByScannerDiscovery="true" valueType="includePath">
<listOptionValue builtIn="false" value="&quot;${workspace_loc:/${ProjName}/include}&quot;"/>
Expand Down
6 changes: 3 additions & 3 deletions lib-artnet/.settings/language.settings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<provider copy-of="extension" id="org.eclipse.cdt.ui.UserLanguageSettingsProvider"/>
<provider-reference id="org.eclipse.cdt.core.ReferencedProjectsLanguageSettingsProvider" ref="shared-provider"/>
<provider class="org.eclipse.cdt.managedbuilder.language.settings.providers.GCCBuildCommandParser" id="org.eclipse.cdt.managedbuilder.core.GCCBuildCommandParser" keep-relative-paths="false" name="CDT GCC Build Output Parser" parameter="([^/\\\\]*)((g?cc)|([gc]\+\+)|(clang))" prefer-non-shared="true"/>
<provider class="org.eclipse.cdt.internal.build.crossgcc.CrossGCCBuiltinSpecsDetector" console="false" env-hash="-868968903555373684" id="org.eclipse.cdt.build.crossgcc.CrossGCCBuiltinSpecsDetector" keep-relative-paths="false" name="CDT Cross GCC Built-in Compiler Settings" parameter="${COMMAND} ${FLAGS} -E -P -v -dD &quot;${INPUTS}&quot;" prefer-non-shared="true">
<provider class="org.eclipse.cdt.internal.build.crossgcc.CrossGCCBuiltinSpecsDetector" console="false" env-hash="-868850457862413684" id="org.eclipse.cdt.build.crossgcc.CrossGCCBuiltinSpecsDetector" keep-relative-paths="false" name="CDT Cross GCC Built-in Compiler Settings" parameter="${COMMAND} ${FLAGS} -E -P -v -dD &quot;${INPUTS}&quot;" prefer-non-shared="true">
<language-scope id="org.eclipse.cdt.core.gcc"/>
<language-scope id="org.eclipse.cdt.core.g++"/>
</provider>
Expand All @@ -17,7 +17,7 @@
<provider copy-of="extension" id="org.eclipse.cdt.ui.UserLanguageSettingsProvider"/>
<provider-reference id="org.eclipse.cdt.core.ReferencedProjectsLanguageSettingsProvider" ref="shared-provider"/>
<provider copy-of="extension" id="org.eclipse.cdt.managedbuilder.core.GCCBuildCommandParser"/>
<provider class="org.eclipse.cdt.internal.build.crossgcc.CrossGCCBuiltinSpecsDetector" console="false" env-hash="-868968903555373684" id="org.eclipse.cdt.build.crossgcc.CrossGCCBuiltinSpecsDetector" keep-relative-paths="false" name="CDT Cross GCC Built-in Compiler Settings" parameter="${COMMAND} ${FLAGS} -E -P -v -dD &quot;${INPUTS}&quot;" prefer-non-shared="true">
<provider class="org.eclipse.cdt.internal.build.crossgcc.CrossGCCBuiltinSpecsDetector" console="false" env-hash="-868850457862413684" id="org.eclipse.cdt.build.crossgcc.CrossGCCBuiltinSpecsDetector" keep-relative-paths="false" name="CDT Cross GCC Built-in Compiler Settings" parameter="${COMMAND} ${FLAGS} -E -P -v -dD &quot;${INPUTS}&quot;" prefer-non-shared="true">
<language-scope id="org.eclipse.cdt.core.gcc"/>
<language-scope id="org.eclipse.cdt.core.g++"/>
</provider>
Expand All @@ -26,7 +26,7 @@
</configuration>
<configuration id="ilg.gnuarmeclipse.managedbuild.cross.toolchain.base.309283989.303033930.1702909156.1968016134.361802700" name="H3">
<extension point="org.eclipse.cdt.core.LanguageSettingsProvider">
<provider class="org.eclipse.cdt.managedbuilder.language.settings.providers.GCCBuiltinSpecsDetector" console="true" env-hash="1360993027267989977" id="org.eclipse.embedcdt.managedbuild.cross.arm.core.GCCBuiltinSpecsDetector" keep-relative-paths="false" name="CDT Arm Cross GCC Built-in Compiler Settings" parameter="${COMMAND} ${FLAGS} ${cross_toolchain_flags} -E -P -v -dD &quot;${INPUTS}&quot;" prefer-non-shared="true">
<provider class="org.eclipse.cdt.managedbuilder.language.settings.providers.GCCBuiltinSpecsDetector" console="true" env-hash="1362671244237841593" id="org.eclipse.embedcdt.managedbuild.cross.arm.core.GCCBuiltinSpecsDetector" keep-relative-paths="false" name="CDT Arm Cross GCC Built-in Compiler Settings" parameter="${COMMAND} ${FLAGS} ${cross_toolchain_flags} -E -P -v -dD &quot;${INPUTS}&quot;" prefer-non-shared="true">
<language-scope id="org.eclipse.cdt.core.gcc"/>
<language-scope id="org.eclipse.cdt.core.g++"/>
</provider>
Expand Down
22 changes: 9 additions & 13 deletions lib-artnet/include/artnetcontroller.h
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,7 @@
* @file artnetcontroller.h
*
*/
/**
* Art-Net Designed by and Copyright Artistic Licence Holdings Ltd.
*/
/* Copyright (C) 2017-2024 by Arjan van Vught mailto:[email protected]
/* Copyright (C) 2017-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
Expand Down Expand Up @@ -113,16 +110,14 @@ class ArtNetController: public ArtNetPollTable {
}
#endif

// Handler
void SetArtNetTrigger(ArtNetTrigger *pArtNetTrigger) {
m_pArtNetTrigger = pArtNetTrigger;
}
ArtNetTrigger *GetArtNetTrigger() const {
return m_pArtNetTrigger;
}

const uint8_t *GetSoftwareVersion();

#if defined (ARTNET_HAVE_TRIGGER)
void SetArtTriggerCallbackFunctionPtr(ArtTriggerCallbackFunctionPtr artTriggerCallbackFunctionPtr) {
m_ArtTriggerCallbackFunctionPtr = artTriggerCallbackFunctionPtr;
}
#endif

static ArtNetController *Get() {
return s_pThis;
}
Expand Down Expand Up @@ -153,7 +148,8 @@ class ArtNetController: public ArtNetPollTable {

artnet::ArtDmx *m_pArtDmx;
artnet::ArtSync *m_pArtSync;
ArtNetTrigger *m_pArtNetTrigger { nullptr }; // Trigger handler

ArtTriggerCallbackFunctionPtr m_ArtTriggerCallbackFunctionPtr { nullptr };

bool m_bSynchronization { true };
bool m_bUnicast { true };
Expand Down
23 changes: 8 additions & 15 deletions lib-artnet/include/artnetnode.h
Original file line number Diff line number Diff line change
Expand Up @@ -68,12 +68,6 @@
# include "e131bridge.h"
#endif

#if defined(OUTPUT_DMX_SEND) || defined(OUTPUT_DMX_SEND_MULTI)
# if !defined(ARTNET_DISABLE_DMX_CONFIG_UDP)
# include "dmxconfigudp.h"
# endif
#endif

#include "lightset.h"
#include "hardware.h"
#include "network.h"
Expand Down Expand Up @@ -451,18 +445,20 @@ class ArtNetNode {
Network::Get()->SendTo(m_nHandle, &m_ArtTimeCode, sizeof(struct artnet::ArtTimeCode), m_Node.IPAddressTimeCode, artnet::UDP_PORT);
}

void SetTimeCodeHandler(ArtNetTimeCode *pArtNetTimeCode) {
m_pArtNetTimeCode = pArtNetTimeCode;
void SetArtTimeCodeCallbackFunction(ArtTimeCodeCallbackFunctionPtr artTimeCodeCallbackFunctionPtr) {
m_ArtTimeCodeCallbackFunctionPtr = artTimeCodeCallbackFunctionPtr;
}

void SetTimeCodeIp(const uint32_t nDestinationIp) {
m_Node.IPAddressTimeCode = nDestinationIp;
}
#endif

void SetArtNetTrigger(ArtNetTrigger *pArtNetTrigger) {
m_pArtNetTrigger = pArtNetTrigger;
#if defined (ARTNET_HAVE_TRIGGER)
void SetArtTriggerCallbackFunctionPtr(ArtTriggerCallbackFunctionPtr artTriggerCallbackFunctionPtr) {
m_ArtTriggerCallbackFunctionPtr = artTriggerCallbackFunctionPtr;
}
#endif

void SetDestinationIp(const uint32_t nPortIndex, const uint32_t nDestinationIp) {
if (nPortIndex < artnetnode::MAX_PORTS) {
Expand Down Expand Up @@ -694,8 +690,8 @@ class ArtNetNode {

LightSet *m_pLightSet { nullptr };

ArtNetTimeCode *m_pArtNetTimeCode { nullptr };
ArtNetTrigger *m_pArtNetTrigger { nullptr };
ArtTimeCodeCallbackFunctionPtr m_ArtTimeCodeCallbackFunctionPtr { nullptr };
ArtTriggerCallbackFunctionPtr m_ArtTriggerCallbackFunctionPtr { nullptr };

artnetnode::Node m_Node;
artnetnode::State m_State;
Expand Down Expand Up @@ -726,9 +722,6 @@ class ArtNetNode {
#if defined (ARTNET_ENABLE_SENDDIAG)
artnet::ArtDiagData m_DiagData;
#endif
#if defined (DMXCONFIGUDP_H_)
DmxConfigUdp m_DmxConfigUdp;
#endif

static inline ArtNetNode *s_pThis;
};
Expand Down
2 changes: 1 addition & 1 deletion lib-artnet/include/artnetrdmresponder.h
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ class ArtNetRdmResponder final: public RDMDeviceResponder, RDMHandler {
DEBUG_EXIT
}

~ArtNetRdmResponder() {
~ArtNetRdmResponder() override {
DEBUG_ENTRY
DEBUG_EXIT
}
Expand Down
9 changes: 1 addition & 8 deletions lib-artnet/include/artnettimecode.h
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,6 @@
* @file artnettimecode.h
*
*/
/**
* Art-Net Designed by and Copyright Artistic Licence Holdings Ltd.
*/
/* Copyright (C) 2016-2024 by Arjan van Vught mailto:[email protected]
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
Expand Down Expand Up @@ -41,10 +38,6 @@ struct TimeCode {
} __attribute__((packed));
} // namespace artnet

class ArtNetTimeCode {
public:
virtual ~ArtNetTimeCode() = default;
virtual void Handler(const struct artnet::TimeCode *)= 0;
};
typedef void (*ArtTimeCodeCallbackFunctionPtr)(const struct artnet::TimeCode *);

#endif /* ARTNETTIMECODE_H_ */
26 changes: 12 additions & 14 deletions lib-artnet/include/artnettrigger.h
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,7 @@
* @file artnettrigger.h
*
*/
/**
* Art-Net Designed by and Copyright Artistic Licence Holdings Ltd.
*/
/* Copyright (C) 2019-2023 by Arjan van Vught mailto:[email protected]
/* Copyright (C) 2019-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
Expand All @@ -31,27 +28,28 @@

#include <cstdint>

// When the Oem field = ffff16 the meaning of the SubKey field is defined by enum TArtTriggerKey
// When the Oem field = ffff the meaning of the SubKey field is defined by enum ArtTriggerKey

enum TArtTriggerKey {
enum class ArtTriggerKey: uint8_t {
ART_TRIGGER_KEY_ASCII, ///< The SubKey field contains an ASCII character which the receiving device should process as if it were a keyboard press. (Payload not used).
ART_TRIGGER_KEY_MACRO, ///< The SubKey field contains the number of a Macro which the receiving device should execute. (Payload not used).
ART_TRIGGER_KEY_SOFT, ///< The SubKey field contains a soft-key number which the receiving device should process as if it were a soft-key keyboard press. (Payload not used).
ART_TRIGGER_KEY_SHOW ///< The SubKey field contains the number of a Show which the receiving device should run. (Payload not used).
ART_TRIGGER_KEY_SHOW, ///< The SubKey field contains the number of a Show which the receiving device should run. (Payload not used).
ART_TRIGGER_UNDEFINED
};

// If the Oem field is set to a value other than ffff16 then the Key and SubKey fields are manufacturer specific.
inline bool operator== (uint8_t a, ArtTriggerKey b) {
return (static_cast<uint32_t>(a) == static_cast<uint32_t>(b));
}

struct TArtNetTrigger {
// If the Oem field is set to a value other than ffff then the Key and SubKey fields are manufacturer specific.

struct ArtNetTrigger {
uint8_t Key; ///< The Trigger Key.
uint8_t SubKey; ///< The Trigger SubKey.
uint8_t Data[512]; ///< The interpretation of the payload is defined by the Key.
}__attribute__((packed));

class ArtNetTrigger {
public:
virtual ~ArtNetTrigger() = default;
virtual void Handler(const struct TArtNetTrigger *ptArtNetTrigger)= 0;
};
typedef void (*ArtTriggerCallbackFunctionPtr)(const struct ArtNetTrigger *);

#endif /* ARTNETTRIGGER_H_ */
20 changes: 8 additions & 12 deletions lib-artnet/src/controller/artnetcontroller.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,6 @@
* @file artnetcontroller.cpp
*
*/
/**
* Art-Net Designed by and Copyright Artistic Licence Holdings Ltd.
*/
/* Copyright (C) 2017-2024 by Arjan van Vught mailto:[email protected]
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
Expand Down Expand Up @@ -383,13 +380,7 @@ void ArtNetController::HandleBlackout() {

void ArtNetController::HandleTrigger() {
DEBUG_ENTRY
const ArtTrigger *pArtTrigger = &m_pArtNetPacket->ArtPacket.ArtTrigger;

if ((pArtTrigger->OemCodeHi == 0xFF && pArtTrigger->OemCodeLo == 0xFF) || (pArtTrigger->OemCodeHi == m_ArtNetController.Oem[0] && pArtTrigger->OemCodeLo == m_ArtNetController.Oem[1])) {
DEBUG_PRINTF("Key=%d, SubKey=%d, Data[0]=%d", pArtTrigger->Key, pArtTrigger->SubKey, pArtTrigger->Data[0]);

m_pArtNetTrigger->Handler(reinterpret_cast<const struct TArtNetTrigger*>(&pArtTrigger->Key));
}

DEBUG_EXIT
}
Expand Down Expand Up @@ -464,11 +455,16 @@ void ArtNetController::Run() {
case artnet::OpCodes::OP_POLL:
HandlePoll();
break;
case artnet::OpCodes::OP_TRIGGER:
if (m_pArtNetTrigger != nullptr) {
HandleTrigger();
#if defined (ARTNET_HAVE_TRIGGER)
case artnet::OpCodes::OP_TRIGGER: {
const ArtTrigger *pArtTrigger = &m_pArtNetPacket->ArtPacket.ArtTrigger;
if ((pArtTrigger->OemCodeHi == 0xFF && pArtTrigger->OemCodeLo == 0xFF) || (pArtTrigger->OemCodeHi == m_ArtNetController.Oem[0] && pArtTrigger->OemCodeLo == m_ArtNetController.Oem[1])) {
DEBUG_PRINTF("Key=%d, SubKey=%d, Data[0]=%d", pArtTrigger->Key, pArtTrigger->SubKey, pArtTrigger->Data[0]);
m_ArtTriggerCallbackFunctionPtr(reinterpret_cast<const struct ArtNetTrigger*>(&pArtTrigger->Key));
}
}
break;
#endif
default:
break;
}
Expand Down
Loading
Loading