Esempio n. 1
0
void WavePixels::run(Sign &sign, EffectData &data, uint8_t ci){
  uint16_t angle = (millis() % cycleTime[ci])*UINT16_MAX/cycleTime[ci];

  int16_t delta_hue = hueA[ci] * sin16(angle)/UINT16_MAX;
  uint16_t seg_count = sign.segmentCount();

  bool on = (ci == 0);

  for(uint8_t i=0; i < seg_count; i++){
    Segment *curr_seg = sign.segments[i];

    if(curr_seg -> isOn == on){
      curr_seg -> setColor(color[ci]);
      delta_hue = -delta_hue;
      int16_t hue_add = delta_hue;

      uint8_t pixel_count = curr_seg -> pixelCount();

      for(uint8_t j = 0; j < pixel_count; j++ ){
        Pixel *currPixel = curr_seg -> pixels[j];
        currPixel -> addHue16(hue_add);
        hue_add += delta_hue;
      }
    }
  }

}
Esempio n. 2
0
void RainbowSegment::run(Sign &sign, uint8_t layer){
  if( sign.textChanged ){ this -> signWasUpdated(sign);}
  uint8_t segment_count = sign.segmentCount();
  CHSV curr_color = color[layer];

  if(changeOnBeat && sign.onBeat){
    color[layer].hue += beatStep[layer];
  }

  for(uint8_t i=0; i<segment_count; i++){
    Segment* curr_segment = sign.segments[i];
    curr_segment -> setColor(layer, curr_color);
    curr_color.hue += hueStep[layer];
  }

}