Coder Social home page Coder Social logo

mathertel / dmxserial2 Goto Github PK

View Code? Open in Web Editor NEW
98.0 98.0 30.0 97 KB

An Arduino library for sending and receiving DMX RDM packets.

License: BSD 3-Clause "New" or "Revised" License

C++ 48.91% C 51.09%
arduino arduino-library dmx dmx512 rdm-responder

dmxserial2's Introduction

dmxserial2's People

Contributors

dojoe avatar graham-hanson avatar kevitto avatar mathertel avatar peternewman avatar stefankrupop avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

dmxserial2's Issues

Add support for STM32

How possible would it be to add support for the STM32 Arduino core? Right now there's a whole pile of compile errors similar to 'UCSRnB' was not declared in this scope

DMX Out

Good morning!

I've built an RDM IN module with this code, which works awesome, by the way! But now, I'm trying to get it to ingest RDM through the serial port and push out DMX at address 1 from the received packets, but for some reason using this in tandem with DMXSimple kills the DMXSerial2.tick() timer (it'll only respond to RDM once, then stop responding) when I try to use the DMX out.

Is there a way to implement DMX forwarding directly in this code? Not all the functions are exposed in the Wiki and documentation.

Thanks!

Stop working on Mega 2560

I use dmxserial2 on Arduino Mega platform.
Ttestsketch is RdmSericalRec.ino
Now RDM stopped working (City Theatrical DMXcat is the DMX/RDM master)

  • DMX data is received
  • RDM devices are not found any more.

When I compile for and upload on a UNO everything is working like expected.

I tried to use UART1 on the Mega, different enable pins, Arduino IDE1.8 and 2.1.1, behavoir is alwas the same.
Does anyone have an idea?

Attached are Logic analyser measurements. RDM Data on Mega looks totally messed up - but why?

I'd really appreciate any help - I even registered a rdm manufacturer ID.

uno
uno_overview
Mega
Mega_overview

Saving RDM data issue

Hi all,
First of all, thank you for sharing this wonderful library!
I'm struggling with some stange issue, maybe you have already encountered a similar problem and will be able to help me.
I have several light sources with the driver based on mega328P. So the hardware is almost identical like Arduino + DMX shield, but the PCB is own design.
I use DMXcat as DMX/RDM controller. I'm able to control every single device, set device address and properties. Everything seems to work fine until the power goes off.
The issue is that after switchhing on the whole set, some of the devices are run again with the defaualt settings (address: 1 and the device name "new").
As I'm not sure if the problem is the EEPROM data saving or reading, I modified the library code a little bit to add additional CRC in EEPROMVALUES struct. Additionally I try to save / read data again when the the verification of CRC fails.
But after all the issues still exists.
Do you have any suggestions what could be wrong?
I'm wondering if sending respondMessage (interrupts?) just after _eepromSaved is called could somehow affected saving process as it takes a few milliseconds?

Adapting for ATMega4809 = Arduino Nano Every

I would like to use this library for the ATMega4809 but I can't figure out, how to define the USART-Registers
#define UCSRnA UCSR0A // Control and Status Register A
I have found the Register Summary for this chip but Status and Control are different signals:
image

If it's possible and with a little help, I would add the definition, test it and commit it here.

THX.

Last remaining compiler warning in DMSSerial.cpp

Sign/Unsigned comparison warning on line 791
for (int n = 0; n < _initData->additionalCommandsLength; n++) {

RDMINIT.additionalCommandsLength is declared as uint16_t

Simple fix is to replace int n by uint16_t n.

This is the last remaining Compiler warning in DMXSerial itself. The warnings from EEPROM.h have been fixed in ArduinoCors-Avr/Libraries/EEPROM.h but not yet released!

Example using sensors

Please create an example using a sensor. I am a noob and struggling to implement.
Any help appreciated. Thanks.

Verify error

Verifying in Arduino 1.8.5 returns;

RDMSerialRecv:67: error: too many initializers for 'RDMINIT'
};

RDM channel size from 3 to 4

Anyone knowing how to increase the number of channels from 3 to 4. The example have 3 channels, RGB for LED's, I would like to add an additional channel. I can't find where to change 3 to 4, anyone who knows where to change it?

Build is "noisy" when Arduino Compiler Warnings = All selected.

If the Arduino Compiler Warnings preference is set to All, a number of unnecessary warnings are generated.

It is always good practice to build C/C++ programs with the highest compiler warning level enabled (and in fact with with a compiler flag to treat warnings as errors, but we don't easily have the level in the Arduino IDE without editing configuration files.

Unfortunately, several warnings come from the core EEPROM library, however, there are also a few from DMXSerial2 that we could fix.

Firstly the constants

  • SERIAL_8N1
  • SERIAL_8N2
  • SERIAL_8E1
  • SERIAL_8E2
    Are preceded by a comment that they are already defined in HardwareSerial.h.
    However, each one generates a long warning message like

C:\Users\grh\Google Drive\Arduino\libraries\DmxSerial2\src\DMXSerial2.cpp:146:0: warning: "SERIAL_8N1" redefined

#define SERIAL_8N1 ((0<<USBSn) | (0<<UPMn0) | (3<<UCSZn0))

^

In file included from C:\Users\grh\AppData\Local\Arduino15\packages\arduino\hardware\avr\1.6.21\cores\arduino/Arduino.h:232:0,

            from C:\Users\grh\Google Drive\Arduino\libraries\DmxSerial2\src\DMXSerial2.cpp:18:

C:\Users\grh\AppData\Local\Arduino15\packages\arduino\hardware\avr\1.6.21\cores\arduino/HardwareSerial.h:71:0: note: this is the location of the previous definition

#define SERIAL_8N1 0x06

^
Further, only two values

  • SERIAL_8E1
  • SERIAL_8N2
    are actually used.
    My suggestion would be to remove (or comment) the unused values SERIAL_8N1 and SERIAL_8E2 immediately removing two warnings.
    For the other two constants we have options -
  • If we can guarantee that the HardwareSerial.h header will always be included, we could simply remove (or comment) the new definitions, alternatively, we can protect them ussing
#ifndef SERIAL_8N2
#   define  SERIAL_8N2  ((1<<USBSn) | (0<<UPMn0) | (3<<UCSZn0))
#endif
#ifndef SERIAL_8E1
#   define  SERIAL_8E1  ((0<<USBSn) | (2<<UPMn0) | (3<<UCSZn0))
#endif

Assuming of course that we trust the environment, if not we would need to #undef the values if already defined before #defineing them.

There are a couple of other warnings - I will continue in another issue!

Graham

Personality example

This is the best RDM example I have found many thanks.I have ported DMXSerial2 to an STM32F103 and its working well. I am using the original code as a testbed(MEGA2560) to add RDM functionality. I am trying to add some personalities but I am not sure at what point I should send the Personality description.I am using a Swisson to debug RDM. I can set number of personalities to 10 and set the current personality and the Swisson shows the correct values. Any help would be greatly appreciated.

Adafruit NeoPixel Library

If pixel.show() command is executed, I can no longer see my device on rdm.
I assume the two library's are conflicting somehow (I'm really not good at code).
(im using arduino uno)
So my question is:
Is this true and if so is there an easy fix?

Device doesn't unmute when the unmute request is sent to broadcast uid

As the title states, it doesn't unmute when the request is made to broadcast as it only checks if packet is to self, should check also if it's to all.

I won't push a patch as the fix is simple enough.

DmxSerial2.cpp, line 525 should be:
if (packetIsForMe || packetIsForAll) {

Best regards,

Build warning when Compler Warnings = All (Part 2)

If the Arduino Compiler Warnings option is set to YES, the following warning is generated -

C:\Users\grh\Google Drive\Arduino\libraries\DmxSerial2\src\DMXSerial2.cpp: In member function 'uint8_t DMXSerialClass2::readRelative(unsigned int)':

C:\Users\grh\Google Drive\Arduino\libraries\DmxSerial2\src\DMXSerial2.cpp:395:16: warning: comparison of unsigned expression >= 0 is always true [-Wtype-limits]

   if ((channel >= 0) && (channel < _initData->footprint)) {

                ^

This occurs because channel is declared as unsigned int.

The fix is simply to change the statement to

   if (channel < _initData->footprint) {

Build warning when Compler Warnings = All (Part 3)

If the Arduino Compiler Warnings option is set to YES, the following warnings are generated -

C:\Users\grh\Google Drive\Arduino\libraries\DmxSerial2\src\DMXSerial2.cpp: In member function 'void DMXSerialClass2::write(int, uint8_t)':

C:\Users\grh\Google Drive\Arduino\libraries\DmxSerial2\src\DMXSerial2.cpp:411:13: warning: comparison is always false due to limited range of data type [-Wtype-limits]

   if (value < DMXSERIAL_MIN_SLOT_VALUE) value = DMXSERIAL_MIN_SLOT_VALUE;

             ^

C:\Users\grh\Google Drive\Arduino\libraries\DmxSerial2\src\DMXSerial2.cpp:412:13: warning: comparison is always false due to limited range of data type [-Wtype-limits]

   if (value > DMXSERIAL_MAX_SLOT_VALUE) value = DMXSERIAL_MAX_SLOT_VALUE;

             ^

The problem here is that value is declared as uint8_t and can thus never be less than DMXSERIAL_MIN_SLOT_VALUE or greater than DMXSERIAL_MAX_SLOT_VALUE

The fix is to simply remove or comment out the two if statements.

Compiler warning about unused instance of EEPROM class in example RDMSerialRecv.ino

Compile warning when building the RDMSerialRecv.ino sample -

After updating Arduino AVR Boards to version 1.6.23, which fixes most of the EEPROM related warnings there is a single warning remaining when building the RDMSerialRecv sample at EEPROM.h:145 that
static EEPROMClass EEPROM is unused :(

It appears the the sample #includes EEPROM.h but does not actually make use of the resulting instance, thus the compiler, quite rightly, complains that EEPROM is unused.

Fix is simply to remove the line '#include <EEPROM.h>`

My RDM Arduino Uno device not working

So I'm using the RDMSerialRecv example (Link: https://github.com/mathertel/DmxSerial2/tree/master/examples/RDMSerialRecv) and it's not working. I am using the Chamsys Magicq software connected to a DMXKing ultraDMX2 Pro (Link: https://www.dmxking.com/usbdmx/ultradmx2-pro) which connects to my MAX485 RS485 transceiver IC chip which finally connects to my arduino Uno.

The wiring looks like so:
Wiring

What happens is when I try to discover all my RDM devices, my arduino doesn't blink and my software doesn't detect anything. I can control my arduino through dmx using universe test but I can't detect rdm. Also, I'm using enttec Pro/Lumen Radio as a out type and I've messed with all the in types.

I2C PROBLEM

WHY DO I HAVE PROBLEMS WHEN THE DISPLAY IS INITIALIZED?
SERIAL COMMUNICATION OR DMX COMMUNICATION STOPS WORKING:

#include <Wire.h>
#include <LiquidCrystal_I2C.h>
#include <DMXSerial2.h>

// ... (rest code)

// Set the I2C address of your LCD
#define I2C_ADDR 0x27

// Set the LCD dimensions
#define LCD_COLS 16
#define LCD_ROWS 2

// Create an instance of the LiquidCrystal_I2C class
LiquidCrystal_I2C lcd(I2C_ADDR, LCD_COLS, LCD_ROWS);

// ... (rest code)

void setup() {
// ... (rest code)

// Initialize the LCD
lcd.begin(LCD_COLS, LCD_ROWS);

#if defined(SERIAL_DEBUG)
// ... (rest code)
#endif
}

void loop() {
// ... (rest code)

// Display DMX address on the LCD
lcd.clear();
lcd.print("DMX Address:");
lcd.setCursor(0, 1);
lcd.print(DMXSerial2.getStartAddress());

// ... (rest code)

RDM Buffer too small - truncated received messages and fails OLA rdm-tests

I notice that the receive buffer is 60 BYTES ?
// the byte array used while receiving and sending.
byte buffer[60];

RDM allows 231 Bytes, so why set at 60 ?

I noticed this as the OLA rdm-tests fail several tests, like E120_DEVICE_LABEL, > 32char
when set to 60, it truncates the RDM message at exactly 32char (I don't know why a buffer of 60 truncates the RDM Data at 32bytes)?
when i increase the buffer to [231] - we now capture the NACK for > 32 char test

BUT, not that the buffer is [231] it fails 41 instead of 6 !!!
any ideas ?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.