You cannot select more than 25 topics
			Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
		
		
		
		
		
			
		
			
				
	
	
		
			25 lines
		
	
	
		
			428 B
		
	
	
	
		
			JavaScript
		
	
			
		
		
	
	
			25 lines
		
	
	
		
			428 B
		
	
	
	
		
			JavaScript
		
	
const { lights } = require("./config.js");
 | 
						|
 | 
						|
let latest_color = [];
 | 
						|
 | 
						|
// initialize
 | 
						|
for (let i in lights) {
 | 
						|
  for (let j = 1; j <= 3; j++) {
 | 
						|
    latest_color.push(1);
 | 
						|
  }
 | 
						|
}
 | 
						|
 | 
						|
module.exports = {
 | 
						|
  get: () => {
 | 
						|
    return latest_color;
 | 
						|
  },
 | 
						|
 | 
						|
  set: (new_color) => {
 | 
						|
    // because sometimes protobuf disconnects and I don't know why
 | 
						|
    if (new_color.every((n) => n == 0)) {
 | 
						|
      return;
 | 
						|
    }
 | 
						|
    latest_color = new_color;
 | 
						|
  },
 | 
						|
};
 |