 //
 //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
 #define NUM_OF_OUTPUTS 2
-#define NUM_OF_UNIVERSES_PER_OUT 3
-
+#define MAX_NUM_LED_PER_OUTPUT 384
+#define NUM_CHANNEL_PER_LED 4
+
+//#define _use_FastLED  //for all types of chips but only 3 channel
+#define _use_octoWS2811 //for all WS2811 type chips
 
 //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
 //
 // definitions calculated from user settings
 //
 //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
+#define num_channel_per_output MAX_NUM_LED_PER_OUTPUT*NUM_CHANNEL_PER_LED
+#if num_channel_per_output%512 > 0
+#define NUM_OF_UNIVERSES_PER_OUT (num_channel_per_output/512)+1
+#else 
+#define num_universes_per_output num_channel_per_output/512
+#endif
+
+#define num_led_per_output num_channel_per_output/NUM_CHANNEL_PER_LED
+
+#define num_artnet_ports num_universes_per_output*NUM_OF_OUTPUTS
+
+//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
+//
+// settings error check
+//
+//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
+
+#ifdef _use_octoWS2811
+#ifdef _use_FastLED
+#error "only use one led controlle type"
+#endif
+#endif
+
+#if NUM_CHANNEL_PER_LED > 4
+#error "max 4 channels per LED"
+#elif NUM_CHANNEL_PER_LED > 3
+#ifndef _use_octoWS2811
+#error "only octoWS2811 has 4 channel support"
+#endif
+#elif NUM_CHANNEL_PER_LED < 3
+#error "only 3 or 4 channel support"
+#endif
+
+#if num_artnet_ports > 18
+#error "can't handle more than 18"
+#endif 
+
+#if F_BUS < 60000000
+#error "Teensy needs to run at 120MHz to read all packets in time"
+#endif 
 
 //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
 //


          // OpSync
          case 0x5200: {
              LEDS.show();

              // calculate framerate
              currentMillis = millis();

//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////

void blink() {
  #ifdef _use_octoWS2811
  for (int i = 0; i < 8 * num_led_per_output; i++) {
    LEDS.setPixel(i, 0xFFFFFFFF); //set full white
  }
  LEDS.show();
  delay(300);
  for (int i = 0; i <  8 * num_led_per_output; i++) {
    LEDS.setPixel(i, 0x00000000); //set 0
  }
  LEDS.show();
  delay(100);
  #endif
  #ifdef _use_FastLED
  #endif
}

//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
