k-yle / sACN

💡 🎭 Send & Receive sACN data (DMX over IP) in node.js
https://npm.im/sacn
Apache License 2.0
28 stars 12 forks source link

sender script #30

Closed JoachimAs closed 3 years ago

JoachimAs commented 3 years ago

Hello together, your receiver is very beautiful and it works perfectly. Now I want to implement the sender and the priority is 0, with the tool sacnview for windows. And the sender only once sent the information.

`const { Sender } = require('sacn');

const sACNServer = new Sender({ universe: 1, // see table 3 below for all options });

async function main() { await sACNServer.send({ payload: { // required. object with the percentages for each DMX channel 1: 100, 2: 50, 3: 0, }, sourceName: "My NodeJS app", // optional. LED lights will use this as the name of the source lighting console. priority: 188, // optional. value between 0-200, in case there are other consoles broadcasting to the same universe });

}

main(); // wrapped in a main() function so that we can await the promise`

k-yle commented 3 years ago

Hi @JoachimAs, the two problems you reported are related:

Unlike some sACN receivers, sACNViewer requires the sender to repeatedly send the data. sACN Viewer does not hold the last DMX data, so if you stop sending data it sets all channels and the priority value back to 0.

So, I've added a new option to the sender called minRefreshRate which should solve both these issues:

const sACNServer = new Sender({
  universe: 1,
  minRefreshRate: 2, // 2Hz = every 0.5seconds
});

Let me know if you still have problems