Skip to content

Commit

Permalink
Iss101 - MAX_CHANNEL changed to 512 inclusive from 511 inclusive
Browse files Browse the repository at this point in the history
The ranges were then altered to start at 1 rather than 0
  • Loading branch information
zacharyjg00 authored and theeldestelder committed Nov 2, 2019
1 parent 03b84fe commit b8cc558
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions app/js/dmx.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ const fadeInterval = 50;
let fadeChange = 255.0 * fadeInterval / fadeDuration;

// Limits
const MAX_CHANNEL = 511; // Inclusive
const MAX_CHANNEL = 512; // Inclusive

// Returns the value for the element with the given id, parsed as an int.
// If failed to parse or find, returns default value
Expand Down Expand Up @@ -76,13 +76,13 @@ function setChannel(channel, value) {
function setChannelRange(value) {
const start = getIntFromElementById('rangeStart', -1);

if (start < 0 || start > MAX_CHANNEL) {
if (start < 1 || start > MAX_CHANNEL) {
setBackground('rangeStart', 'red');
return;
}

const end = getIntFromElementById('rangeEnd', -1);
if (end < 0 || end > MAX_CHANNEL) {
if (end < 1 || end > MAX_CHANNEL) {
setBackground('rangeEnd', 'red');
return;
}
Expand All @@ -99,7 +99,7 @@ function setChannelRange(value) {
// Sets a single DMX channel to the given value
function setSingleChannel(value) {
const channel = getIntFromElementById('singleChannel', -1);
if (channel < 0 || channel > MAX_CHANNEL) {
if (channel < 1 || channel > MAX_CHANNEL) {
setBackground('singleChannel', 'red');
return;
}
Expand Down

0 comments on commit b8cc558

Please sign in to comment.