Logic Machine Forum
Art-Net DMX - Printable Version

+- Logic Machine Forum (https://forum.logicmachine.net)
+-- Forum: LogicMachine eco-system (https://forum.logicmachine.net/forumdisplay.php?fid=1)
+--- Forum: Scripting (https://forum.logicmachine.net/forumdisplay.php?fid=8)
+--- Thread: Art-Net DMX (/showthread.php?tid=1391)

Pages: 1 2


RE: Art-Net DMX - lcrowhurst - 06.02.2020

(04.02.2020, 13:09)admin Wrote: You can run the sending script on the same device. Just set IP to 127.0.0.1


Thanks that works perfectly, now to get an art net to dmx converter to test with. Once again thank you so much for your help


RE: Art-Net DMX - lcrowhurst - 07.09.2020

I finally installed at the clients site, Using an Enttec DMX to Artnet. The script works well for presets , ie setting dmx 1 to 255, however if a slider is used eg sliding up from 0 to 255, where eg value 1,5,7,10,14 etc are sent out, the shac(LM) has trouble keeping up with all the packets of data being sent. This results in at first the light matching the slider but very quickly it starts lagging, so by the time the slider reaches 255, it may be a few second before the shac(LM) changes the light level to 255. Is there any way of speeding up the script?


RE: Art-Net DMX - tomnord - 07.05.2024

(03.02.2020, 12:51)admin Wrote: An example of Art-Net receiver. It ignores sequence and universe numbers which are not needed for general use. Edit mapping table to select which groups addresses are mapped to DMX channel numbers starting from 1. Output value for each channel is 1 byte (0..255).

Code:
if not server then
  mapping = {
    [1] = '32/1/1',
    [2] = '32/1/2',
    [3] = '32/1/3',
  }

  server = require('socket').udp()
  server:settimeout(1)
  server:setsockname('*', 0x1936)

  header = 'Art-Net' .. string.char(0, 0, 0x50)
  values = {}

  function parse(data)
    local count, value

    if data:sub(1, #header) ~= header then
      return
    end

    count = #data - 18

    for i = 1, count do
      value = data:byte(i + 18)

      if value ~= values[ i ] then
        values[ i ] = value

        if mapping[ i ] then
          grp.update(mapping[ i ], value)
        end
      end
    end
  end
end

data = server:receive()
if data then
  parse(data)
end
Regarding this. Is there any way to have the LM separate commands based on Universe? My client  want's to use universe 3 on art-net to control KNX lights on/off and value dim. Universe 1 and 2 are used for stagelights.


RE: Art-Net DMX - admin - 07.05.2024

Try this:
Code:
if not server then
  mapping = {
    [1] = '32/1/1',
    [2] = '32/1/2',
    [3] = '32/1/3',
  }

  server = require('socket').udp()
  server:settimeout(1)
  server:setsockname('*', 0x1936)

  header = 'Art-Net' .. string.char(0, 0, 0x50)
  values = {}

  function parse(data)
    local count, value

    if #data < 19 or data:sub(1, #header) ~= header then
      return
    end

    local univlo, univhi = data:byte(15, 16)
    local universe = univhi * 256 + univlo

    if universe ~= 3 then
      return
    end

    count = #data - 18

    for i = 1, count do
      value = data:byte(i + 18)

      if value ~= values[ i ] then
        values[ i ] = value

        if mapping[ i ] then
          grp.update(mapping[ i ], value)
        end
      end
    end
  end
end

data = server:receive()
if data then
  parse(data)
end



RE: Art-Net DMX - tomnord - 07.05.2024

(07.05.2024, 13:07)admin Wrote: Try this:
Code:
if not server then
  mapping = {
    [1] = '32/1/1',
    [2] = '32/1/2',
    [3] = '32/1/3',
  }

  server = require('socket').udp()
  server:settimeout(1)
  server:setsockname('*', 0x1936)

  header = 'Art-Net' .. string.char(0, 0, 0x50)
  values = {}

  function parse(data)
    local count, value

    if #data < 19 or data:sub(1, #header) ~= header then
      return
    end

    local univlo, univhi = data:byte(15, 16)
    local universe = univhi * 256 + univlo

    if universe ~= 3 then
      return
    end

    count = #data - 18

    for i = 1, count do
      value = data:byte(i + 18)

      if value ~= values[ i ] then
        values[ i ] = value

        if mapping[ i ] then
          grp.update(mapping[ i ], value)
        end
      end
    end
  end
end

data = server:receive()
if data then
  parse(data)
end

When logging the "server" variable i get this status: udp{unconnected}: 0xb6e42ac0


RE: Art-Net DMX - admin - 07.05.2024

This is correct, UDP server cannot be in a connected state, only UDP client can.
Consider changing grp.update() to grp.checkupdate().


RE: Art-Net DMX - tomnord - 07.05.2024

(07.05.2024, 13:20)admin Wrote: This is correct, UDP server cannot be in a connected state, only UDP client can.
Consider changing grp.update() to grp.checkupdate().

I still do not get any values. Is there any other diagnostics I can add?
the variable "data" returns NIL


RE: Art-Net DMX - admin - 07.05.2024

You should check the sending side settings.