Lixie_II.cpp 17 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723
  1. /*
  2. Lixie_II.cpp - Library for controlling the Lixie 2!
  3. Created by Connor Nishijma July 6th, 2019
  4. Released under the GPLv3 License
  5. */
  6. #include "Lixie_II.h"
  7. uint8_t get_size(uint32_t input);
  8. // FastLED info for the LEDs
  9. #define LED_TYPE WS2812B
  10. #define COLOR_ORDER GRB
  11. const uint8_t leds_per_digit = 22;
  12. uint8_t n_digits; // Keeps the number of displays
  13. uint16_t n_LEDs; // Keeps the number of LEDs based on display quantity.
  14. CLEDController *lix_controller; // FastLED
  15. CRGB *lix_leds;
  16. const uint8_t led_assignments[leds_per_digit] = { 1, 9, 4, 6, 255, 7, 3, 0, 2, 8, 5, 5, 8, 2, 0, 3, 7, 255, 6, 4, 9, 1 }; // 255 is extra pane
  17. const uint8_t x_offsets[leds_per_digit] = { 0, 0, 0, 0, 1, 1, 1, 1, 2, 2, 2, 3, 3, 3, 4, 4, 4, 4, 5, 5, 5, 5 };
  18. uint8_t max_x_pos = 0;
  19. CRGB *col_on;
  20. CRGB *col_off;
  21. uint8_t *led_mask_0;
  22. uint8_t *led_mask_1;
  23. uint8_t current_mask = 0;
  24. float mask_fader = 0.0;
  25. float mask_push = 1.0;
  26. bool mask_fade_finished = false;
  27. uint8_t trans_type = CROSSFADE;
  28. uint16_t trans_time = 250;
  29. bool transition_mid_point = true;
  30. float bright = 1.0;
  31. bool background_updates = true;
  32. #if defined(ARDUINO_ARCH_ESP8266) || defined(ARDUINO_ARCH_ESP32)
  33. Ticker lixie_animation;
  34. #endif
  35. uint16_t led_to_x_pos(uint16_t led){
  36. uint8_t led_digit_pos = x_offsets[led%22];
  37. uint8_t complete_digits = 0;
  38. while(led >= leds_per_digit){
  39. led -= leds_per_digit;
  40. complete_digits += 1;
  41. }
  42. return max_x_pos - (led_digit_pos + (complete_digits*6));
  43. }
  44. void animate(){
  45. if(mask_fader < 1.0){
  46. mask_fader += mask_push;
  47. }
  48. if(mask_fader >= 1.0){
  49. mask_fader = 1.0;
  50. if(!mask_fade_finished){
  51. mask_fade_finished = true;
  52. }
  53. }
  54. else if(mask_fader >= 0.5){
  55. transition_mid_point = true;
  56. }
  57. for(uint16_t i = 0; i < n_LEDs; i++){
  58. float mask_float;
  59. CRGB new_col;
  60. uint8_t mask_input_0 = led_mask_0[i];
  61. uint8_t mask_input_1 = led_mask_1[i];
  62. if(trans_type == INSTANT || trans_type == CROSSFADE){
  63. if(current_mask == 0){
  64. mask_float = ((mask_input_0*(1-mask_fader)) + (mask_input_1*(mask_fader)))/255.0;
  65. }
  66. else if(current_mask == 1){
  67. mask_float = ((mask_input_1*(1-mask_fader)) + (mask_input_0*(mask_fader)))/255.0;
  68. }
  69. }
  70. new_col.r = ((col_on[i].r*mask_float) + (col_off[i].r*(1-mask_float)))*bright;
  71. new_col.g = ((col_on[i].g*mask_float) + (col_off[i].g*(1-mask_float)))*bright;
  72. new_col.b = ((col_on[i].b*mask_float) + (col_off[i].b*(1-mask_float)))*bright;
  73. lix_leds[i] = new_col;
  74. //Serial.print(led_to_x_pos(i));
  75. //Serial.print('\t');
  76. //Serial.println(max_x_pos);
  77. }
  78. lix_controller->showLeds();
  79. }
  80. void Lixie_II::transition_type(uint8_t type){
  81. trans_type = type;
  82. }
  83. void Lixie_II::transition_time(uint16_t ms){
  84. trans_time = ms;
  85. }
  86. void Lixie_II::run(){
  87. animate();
  88. }
  89. void Lixie_II::wait(){
  90. while(mask_fader < 1.0){
  91. animate();
  92. }
  93. }
  94. void Lixie_II::start_animation(){
  95. #if defined(ARDUINO_ARCH_ESP8266) || defined(ARDUINO_ARCH_ESP32)
  96. lixie_animation.attach_ms(20, animate);
  97. #elif defined(__AVR__)
  98. // TIMER 1 for interrupt frequency 50 Hz:
  99. cli(); // stop interrupts
  100. TCCR1A = 0; // set entire TCCR1A register to 0
  101. TCCR1B = 0; // same for TCCR1B
  102. TCNT1 = 0; // initialize counter value to 0
  103. // set compare match register for 50 Hz increments
  104. OCR1A = 39999; // = 16000000 / (8 * 50) - 1 (must be <65536)
  105. // turn on CTC mode
  106. TCCR1B |= (1 << WGM12);
  107. // Set CS12, CS11 and CS10 bits for 8 prescaler
  108. TCCR1B |= (0 << CS12) | (1 << CS11) | (0 << CS10);
  109. // enable timer compare interrupt
  110. TIMSK1 |= (1 << OCIE1A);
  111. sei(); // allow interrupts
  112. #endif
  113. }
  114. #if defined(__AVR__)
  115. ISR(TIMER1_COMPA_vect){
  116. animate();
  117. }
  118. #endif
  119. void Lixie_II::stop_animation(){
  120. #if defined(ARDUINO_ARCH_ESP8266) || defined(ARDUINO_ARCH_ESP32)
  121. lixie_animation.detach();
  122. #endif
  123. }
  124. Lixie_II::Lixie_II(const uint8_t pin, uint8_t number_of_digits){
  125. n_LEDs = number_of_digits * leds_per_digit;
  126. n_digits = number_of_digits;
  127. max_x_pos = (number_of_digits * 6)-1;
  128. lix_leds = new CRGB[n_LEDs];
  129. led_mask_0 = new uint8_t[n_LEDs];
  130. led_mask_1 = new uint8_t[n_LEDs];
  131. col_on = new CRGB[n_LEDs];
  132. col_off = new CRGB[n_LEDs];
  133. for(uint16_t i = 0; i < n_LEDs; i++){
  134. led_mask_0[i] = 0;
  135. led_mask_1[i] = 0;
  136. col_on[i] = CRGB(255,255,255);
  137. col_off[i] = CRGB(0,0,0);
  138. }
  139. build_controller(pin);
  140. }
  141. void Lixie_II::build_controller(const uint8_t pin){
  142. //FastLED control pin has to be defined as a constant, (not just const, it's weird) this is a hacky workaround.
  143. // Also, this stops you from defining non existent pins with your current board architecture
  144. if (pin == 0)
  145. lix_controller = &FastLED.addLeds<LED_TYPE, 0, COLOR_ORDER>(lix_leds, n_LEDs);
  146. else if (pin == 2)
  147. lix_controller = &FastLED.addLeds<LED_TYPE, 2, COLOR_ORDER>(lix_leds, n_LEDs);
  148. else if (pin == 4)
  149. lix_controller = &FastLED.addLeds<LED_TYPE, 4, COLOR_ORDER>(lix_leds, n_LEDs);
  150. else if (pin == 5)
  151. lix_controller = &FastLED.addLeds<LED_TYPE, 5, COLOR_ORDER>(lix_leds, n_LEDs);
  152. else if (pin == 12)
  153. lix_controller = &FastLED.addLeds<LED_TYPE, 12, COLOR_ORDER>(lix_leds, n_LEDs);
  154. else if (pin == 13)
  155. lix_controller = &FastLED.addLeds<LED_TYPE, 13, COLOR_ORDER>(lix_leds, n_LEDs);
  156. //FastLED.addLeds<LED_TYPE, 13, COLOR_ORDER>(lix_leds, n_LEDs);
  157. }
  158. void Lixie_II::begin(){
  159. max_power(5,500); // Default for the safety of your PC USB
  160. start_animation();
  161. }
  162. void Lixie_II::max_power(uint8_t V, uint16_t mA){
  163. FastLED.setMaxPowerInVoltsAndMilliamps(V, mA);
  164. }
  165. void Lixie_II::clear_all(){
  166. if(current_mask == 0){
  167. for(uint16_t i = 0; i < n_LEDs; i++){
  168. led_mask_0[i] = 0;
  169. }
  170. }
  171. else if(current_mask == 1){
  172. for(uint16_t i = 0; i < n_LEDs; i++){
  173. led_mask_1[i] = 0;
  174. }
  175. }
  176. }
  177. void Lixie_II::write(uint32_t input){
  178. //if(get_size(input) <= n_digits){
  179. clear_all();
  180. uint32_t n_place = 1;
  181. // Powers of 10 while avoiding floating point math
  182. for(uint8_t i = 1; i < get_size(input); i++){
  183. n_place *= 10;
  184. }
  185. for(n_place; n_place > 0; n_place /= 10){
  186. push_digit(input / n_place);
  187. if(n_place > 1) input = (input % n_place);
  188. }
  189. //}
  190. if(current_mask == 0){
  191. current_mask = 1;
  192. }
  193. else if(current_mask == 1){
  194. current_mask = 0;
  195. }
  196. mask_update();
  197. }
  198. bool char_is_number(char input){
  199. if(input <= 57 && input >= 48) // if between ASCII '9' and '0'
  200. return true;
  201. else
  202. return false;
  203. }
  204. void Lixie_II::write(char* input){
  205. char temp[20] = "";
  206. byte index = 0;
  207. for(uint8_t i = 0; i < 20; i++){
  208. if(char_is_number(input[i])){
  209. temp[index] = input[i];
  210. index++;
  211. }
  212. }
  213. uint32_t output = atol(temp);
  214. write(output);
  215. }
  216. void Lixie_II::write_float(float input_raw, uint8_t dec_places){
  217. uint16_t dec_places_10s = 1;
  218. float input_mult = input_raw;
  219. for(uint8_t i = 0; i < dec_places; i++){
  220. input_mult*=10;
  221. dec_places_10s*=10;
  222. }
  223. uint16_t input = input_mult;
  224. clear_all();
  225. uint32_t n_place = 1;
  226. // Powers of 10 while avoiding floating point math
  227. for(uint8_t i = 1; i < get_size(input); i++){
  228. n_place *= 10;
  229. }
  230. for(n_place; n_place > 0; n_place /= 10){
  231. if(n_place == (dec_places_10s/10)){
  232. push_digit(255);
  233. }
  234. push_digit(input / n_place);
  235. if(n_place > 1) input = (input % n_place);
  236. }
  237. if(current_mask == 0){
  238. current_mask = 1;
  239. }
  240. else if(current_mask == 1){
  241. current_mask = 0;
  242. }
  243. mask_update();
  244. }
  245. void Lixie_II::push_digit(uint8_t number) {
  246. // If multiple displays, move all LED states forward one
  247. if (n_digits > 1) {
  248. for (uint16_t i = n_LEDs - 1; i >= leds_per_digit; i--) {
  249. if(current_mask == 0){
  250. led_mask_0[i] = led_mask_0[i - leds_per_digit];
  251. }
  252. else{
  253. led_mask_1[i] = led_mask_1[i - leds_per_digit];
  254. }
  255. }
  256. }
  257. // Clear the LED states for the first display
  258. for (uint16_t i = 0; i < leds_per_digit; i++) {
  259. if(current_mask == 0){
  260. led_mask_0[i] = led_mask_0[i - leds_per_digit];
  261. }
  262. else{
  263. led_mask_1[i] = led_mask_1[i - leds_per_digit];
  264. }
  265. }
  266. for(uint8_t i = 0; i < leds_per_digit; i++){
  267. if(led_assignments[i] == number){
  268. if(current_mask == 0){
  269. led_mask_0[i] = 255;
  270. }
  271. else{
  272. led_mask_1[i] = 255;
  273. }
  274. }
  275. else{
  276. if(current_mask == 0){
  277. led_mask_0[i] = 0;
  278. }
  279. else{
  280. led_mask_1[i] = 0;
  281. }
  282. }
  283. }
  284. }
  285. void Lixie_II::write_digit(uint8_t digit, uint8_t num){
  286. uint16_t start_index = leds_per_digit*digit;
  287. if(num < 10){
  288. clear_digit(digit,num);
  289. for(uint8_t i = 0; i < leds_per_digit; i++){
  290. if(led_assignments[i] == num){
  291. if(current_mask == 0){
  292. led_mask_1[start_index+i] = 255;
  293. }
  294. else if(current_mask == 1){
  295. led_mask_0[start_index+i] = 255;
  296. }
  297. }
  298. }
  299. mask_update();
  300. }
  301. }
  302. void Lixie_II::clear_digit(uint8_t digit, uint8_t num){
  303. uint16_t start_index = leds_per_digit*digit;
  304. for(uint8_t i = 0; i < 22; i++){
  305. if(current_mask == 0){
  306. led_mask_1[start_index+i] = 0;//CRGB(0*0.06,100*0.06,255*0.06);
  307. }
  308. if(current_mask == 1){
  309. led_mask_0[start_index+i] = 0;//CRGB(0*0.06,100*0.06,255*0.06);
  310. }
  311. }
  312. mask_update();
  313. }
  314. void Lixie_II::mask_update(){
  315. mask_fader = 0.0;
  316. if(trans_type == INSTANT){
  317. mask_push = 1.0;
  318. }
  319. else{
  320. float trans_multiplier = trans_time / float(1000);
  321. mask_push = 1 / (50.0 * trans_multiplier);
  322. }
  323. mask_fade_finished = false;
  324. transition_mid_point = false;
  325. // WAIT GOES HERE
  326. }
  327. void Lixie_II::color_all(uint8_t layer, CRGB col){
  328. for(uint16_t i = 0; i < n_LEDs; i++){
  329. if(layer == ON){
  330. col_on[i] = col;
  331. }
  332. else if(layer == OFF){
  333. col_off[i] = col;
  334. }
  335. }
  336. }
  337. void Lixie_II::color_all_dual(uint8_t layer, CRGB col_left, CRGB col_right){
  338. bool side = 1;
  339. for(uint16_t i = 0; i < n_LEDs; i++){
  340. if(i % (leds_per_digit/2) == 0){
  341. side = !side;
  342. }
  343. if(layer == ON){
  344. if(side){
  345. col_on[i] = col_left;
  346. }
  347. else{
  348. col_on[i] = col_right;
  349. }
  350. }
  351. else if(layer == OFF){
  352. if(side){
  353. col_off[i] = col_left;
  354. }
  355. else{
  356. col_off[i] = col_right;
  357. }
  358. }
  359. }
  360. }
  361. void Lixie_II::color_display(uint8_t display, uint8_t layer, CRGB col){
  362. uint16_t start_index = leds_per_digit*display;
  363. for(uint16_t i = 0; i < leds_per_digit; i++){
  364. if(layer == ON){
  365. col_on[start_index+i] = col;
  366. }
  367. else if(layer == OFF){
  368. col_off[start_index+i] = col;
  369. }
  370. }
  371. }
  372. void Lixie_II::gradient_rgb(uint8_t layer, CRGB col_left, CRGB col_right){
  373. for(uint16_t i = 0; i < n_LEDs; i++){
  374. float progress = 1-(led_to_x_pos(i)/float(max_x_pos));
  375. CRGB col_out = CRGB(0,0,0);
  376. col_out.r = (col_right.r*(1-progress)) + (col_left.r*(progress));
  377. col_out.g = (col_right.g*(1-progress)) + (col_left.g*(progress));
  378. col_out.b = (col_right.b*(1-progress)) + (col_left.b*(progress));
  379. if(layer == ON){
  380. col_on[i] = col_out;
  381. }
  382. else if(layer == OFF){
  383. col_off[i] = col_out;
  384. }
  385. }
  386. }
  387. void Lixie_II::brightness(float level){
  388. //FastLED.setBrightness(255*level); // NOT SUPPORTED WITH CLEDCONTROLLER :(
  389. bright = level; // We instead enforce brightness in the animation ISR
  390. }
  391. void Lixie_II::fade_in(){
  392. for(int16_t i = 0; i < 255; i++){
  393. brightness(i/255.0);
  394. FastLED.delay(1);
  395. }
  396. brightness(1.0);
  397. }
  398. void Lixie_II::fade_out(){
  399. for(int16_t i = 255; i > 0; i--){
  400. brightness(i/255.0);
  401. FastLED.delay(1);
  402. }
  403. brightness(0.0);
  404. }
  405. void Lixie_II::streak(CRGB col, float pos, uint8_t blur){
  406. float pos_whole = pos*n_digits*6; // 6 X-positions in a single display
  407. for(uint16_t i = 0; i < n_LEDs; i++){
  408. uint16_t pos_delta = abs(led_to_x_pos(i) - pos_whole);
  409. if(pos_delta > blur){
  410. pos_delta = blur;
  411. }
  412. float pos_level = 1-(pos_delta/float(blur));
  413. pos_level *= pos_level; // Squared for sharper falloff
  414. lix_leds[i] = CRGB(col.r * pos_level, col.g * pos_level, col.b * pos_level);
  415. }
  416. lix_controller->showLeds();
  417. }
  418. void Lixie_II::sweep_color(CRGB col, uint16_t speed, uint8_t blur, bool reverse){
  419. stop_animation();
  420. sweep_gradient(col, col, speed, blur, reverse);
  421. start_animation();
  422. }
  423. void Lixie_II::sweep_gradient(CRGB col_left, CRGB col_right, uint16_t speed, uint8_t blur, bool reverse){
  424. stop_animation();
  425. if(!reverse){
  426. for(int16_t sweep_pos = (blur*-1); sweep_pos <= max_x_pos+(blur); sweep_pos++){
  427. int16_t sweep_pos_fixed = sweep_pos;
  428. if(sweep_pos < 0){
  429. sweep_pos_fixed = 0;
  430. }
  431. if(sweep_pos > max_x_pos){
  432. sweep_pos_fixed = max_x_pos;
  433. }
  434. float progress = 1-(sweep_pos_fixed/float(max_x_pos));
  435. CRGB col_out = CRGB(0,0,0);
  436. col_out.r = (col_right.r*(1-progress)) + (col_left.r*(progress));
  437. col_out.g = (col_right.g*(1-progress)) + (col_left.g*(progress));
  438. col_out.b = (col_right.b*(1-progress)) + (col_left.b*(progress));
  439. streak(col_out, 1-progress, blur);
  440. FastLED.delay(speed);
  441. }
  442. }
  443. else{
  444. for(int16_t sweep_pos = max_x_pos+(blur); sweep_pos >= (blur*-1); sweep_pos--){
  445. int16_t sweep_pos_fixed = sweep_pos;
  446. if(sweep_pos < 0){
  447. sweep_pos_fixed = 0;
  448. }
  449. if(sweep_pos > max_x_pos){
  450. sweep_pos_fixed = max_x_pos;
  451. }
  452. float progress = 1-(sweep_pos_fixed/float(max_x_pos));
  453. CRGB col_out = CRGB(0,0,0);
  454. col_out.r = (col_right.r*(1-progress)) + (col_left.r*(progress));
  455. col_out.g = (col_right.g*(1-progress)) + (col_left.g*(progress));
  456. col_out.b = (col_right.b*(1-progress)) + (col_left.b*(progress));
  457. streak(col_out, progress, blur);
  458. FastLED.delay(speed);
  459. }
  460. }
  461. start_animation();
  462. }
  463. uint8_t Lixie_II::get_size(uint32_t input){
  464. uint8_t places = 1;
  465. while(input > 9){
  466. places++;
  467. input /= 10;
  468. }
  469. return places;
  470. }
  471. void Lixie_II::nixie(){
  472. color_all(ON, CRGB(255, 70, 7));
  473. color_all(OFF, CRGB(0, 3, 8));
  474. }
  475. void Lixie_II::white_balance(CRGB c_adj){
  476. lix_controller->setTemperature(c_adj);
  477. }
  478. void Lixie_II::rainbow(uint8_t r_hue, uint8_t r_sep){
  479. for(uint8_t i = 0; i < n_digits; i++){
  480. color_display(i, ON, CHSV(r_hue,255,255));
  481. r_hue+=r_sep;
  482. }
  483. }
  484. void Lixie_II::clear(bool show_change){
  485. for(uint16_t i = 0; i < n_LEDs; i++){
  486. led_mask_0[i] = 0.0;
  487. led_mask_1[i] = 0.0;
  488. }
  489. if(show_change){
  490. mask_fader = 0.0;
  491. mask_push = 1.0;
  492. mask_fade_finished = false;
  493. }
  494. }
  495. void Lixie_II::clear_digit(uint8_t index, bool show_change){
  496. uint16_t start_index = index*leds_per_digit;
  497. for(uint16_t i = start_index; i < leds_per_digit; i++){
  498. led_mask_0[i] = 0.0;
  499. led_mask_1[i] = 0.0;
  500. }
  501. }
  502. void Lixie_II::show(){
  503. mask_update();
  504. }
  505. // BEGIN LIXIE 1 DEPRECATED FUNCTIONS
  506. void Lixie_II::write_flip(uint32_t input, uint16_t flip_time, uint8_t flip_speed){
  507. // This animation no longer supported, crossfade is used instead
  508. transition_type(CROSSFADE);
  509. transition_time(flip_time);
  510. write(input);
  511. }
  512. void Lixie_II::write_fade(uint32_t input, uint16_t fade_time){
  513. transition_type(CROSSFADE);
  514. transition_time(fade_time);
  515. write(input);
  516. }
  517. void Lixie_II::sweep(CRGB col, uint8_t speed){
  518. sweep_color(col, speed, 3, false);
  519. }
  520. void Lixie_II::progress(float percent, CRGB col1, CRGB col2){
  521. uint16_t crossover_whole = percent * n_digits;
  522. for(uint8_t i = 0; i < n_digits; i++){
  523. if(n_digits-i-1 > crossover_whole){
  524. color_display(n_digits-i-1, ON, col1);
  525. color_display(n_digits-i-1, OFF, col1);
  526. }
  527. else{
  528. color_display(n_digits-i-1, ON, col2);
  529. color_display(n_digits-i-1, OFF, col2);
  530. }
  531. }
  532. }
  533. void Lixie_II::fill_fade_in(CRGB col, uint8_t fade_speed){
  534. for(float fade = 0.0; fade < 1.0; fade += 0.05){
  535. for(uint16_t i = 0; i < n_LEDs; i++){
  536. lix_leds[i].r = col.r*fade;
  537. lix_leds[i].g = col.g*fade;
  538. lix_leds[i].b = col.b*fade;
  539. }
  540. FastLED.show();
  541. delay(fade_speed);
  542. }
  543. }
  544. void Lixie_II::fill_fade_out(CRGB col, uint8_t fade_speed){
  545. for(float fade = 1; fade > 0; fade -= 0.05){
  546. for(uint16_t i = 0; i < n_LEDs; i++){
  547. lix_leds[i].r = col.r*fade;
  548. lix_leds[i].g = col.g*fade;
  549. lix_leds[i].b = col.b*fade;
  550. }
  551. FastLED.show();
  552. delay(fade_speed);
  553. }
  554. }
  555. void Lixie_II::color(uint8_t r, uint8_t g, uint8_t b){
  556. color_all(ON,CRGB(r,g,b));
  557. }
  558. void Lixie_II::color(CRGB c){
  559. color_all(ON,c);
  560. }
  561. void Lixie_II::color(uint8_t r, uint8_t g, uint8_t b, uint8_t index){
  562. color_display(index, ON, CRGB(r,g,b));
  563. }
  564. void Lixie_II::color(CRGB c, uint8_t index){
  565. color_display(index, ON, c);
  566. }
  567. void Lixie_II::color_off(uint8_t r, uint8_t g, uint8_t b){
  568. color_all(OFF,CRGB(r,g,b));
  569. }
  570. void Lixie_II::color_off(CRGB c){
  571. color_all(OFF,c);
  572. }
  573. void Lixie_II::color_off(uint8_t r, uint8_t g, uint8_t b, uint8_t index){
  574. color_display(index, OFF, CRGB(r,g,b));
  575. }
  576. void Lixie_II::color_off(CRGB c, uint8_t index){
  577. color_display(index, OFF, c);
  578. }
  579. void Lixie_II::color_fade(CRGB col, uint16_t duration){
  580. // not supported
  581. color_all(ON,col);
  582. }
  583. void Lixie_II::color_fade(CRGB col, uint16_t duration, uint8_t index){
  584. // not supported
  585. color_display(index,ON,col);
  586. }
  587. void Lixie_II::color_array_fade(CRGB *cols, uint16_t duration){
  588. // support removed
  589. }
  590. void Lixie_II::color_array_fade(CHSV *cols, uint16_t duration){
  591. // support removed
  592. }
  593. void Lixie_II::color_wipe(CRGB col1, CRGB col2){
  594. gradient_rgb(ON,col1,col2);
  595. }
  596. void Lixie_II::nixie_mode(bool enabled, bool has_aura){
  597. // enabled removed
  598. // has_aura removed
  599. nixie();
  600. }
  601. void Lixie_II::nixie_aura_intensity(uint8_t val){
  602. // support removed
  603. }