Are you doing shading around the HSL circle? Looks like you are with that code. Or at least part of it. It's hard to tell.
Those delays in the sequence are what's killing you. You'll need to massively restructure your code in order to deal with that. Work on splitting it into subroutines for each sequence, then we can start restructuring.
BTW, I have a sketch that does HSL shading of the backlight of an RGB LCD screen in a non-blocking way. I'll post it here so you can see what I did and possibly get inspiration. It's far from the best I could have done, but I can help you out understanding it if you need.
/*
LiquidCrystal Library - Hello World
Demonstrates the use a 16x2 LCD display. The LiquidCrystal
library works with all LCD displays that are compatible with the
Hitachi HD44780 driver. There are many of them out there, and you
can usually tell them by the 16-pin interface.
This sketch prints "Hello World!" to the LCD
and shows the time.
The circuit:
* LCD RS pin to digital pin 12
* LCD Enable pin to digital pin 11
* LCD D4 pin to digital pin 5
* LCD D5 pin to digital pin 4
* LCD D6 pin to digital pin 3
* LCD D7 pin to digital pin 2
* LCD R/W pin to ground
* 10K resistor:
* ends to +5V and ground
* wiper to LCD VO pin (pin 3)
Library originally added 18 Apr 2008
by David A. Mellis
library modified 5 Jul 2009
by Limor Fried (http://www.ladyada.net)
example added 9 Jul 2009
by Tom Igoe
modified 22 Nov 2010
by Tom Igoe
This example code is in the public domain.
http://www.arduino.cc/en/Tutorial/LiquidCrystal
*/
// include the library code:
#include <LiquidCrystal.h>
// initialize the library with the numbers of the interface pins
LiquidCrystal lcd(12, 11, 5, 4, 3, 2);
char hex_str[3];
char bar[16];
byte line_char[8] = {
B00000,
B00000,
B11111,
B11111,
B11111,
B11111,
B00000,
B00000
};
void setup() {
// set up the LCD's number of columns and rows:
lcd.begin(20, 4);
// Print a message to the LCD.
lcd.print("RGB Backlight");
lcd.setCursor( 0, 1 );
lcd.print( "R: 0x" );
lcd.setCursor( 0, 2 );
lcd.print( "G: 0x" );
lcd.setCursor( 0, 3 );
lcd.print( "B: 0x" );
lcd.createChar( 0, line_char );
pinMode(13,OUTPUT);
}
void loop() {
long time = millis()/25;
time = time%360;
int time_index = time / 60;
lcd.setCursor( 18, 0 );
lcd.print( time_index );
//lcd.setCursor(0,2);
//lcd.print(time_index);
byte red;
byte gre;
byte blu;
switch(time_index)
{
case 0:
red = 0x00;
gre = map( time, 0, 60, 0xFF, 0x00 );
blu = 0xFF;
break;
case 1:
red = map( time, 60, 120, 0x00, 0xFF );
gre = 0x00;
blu = 0xFF;
break;
case 2:
red = 0xFF;
gre = 0x00;
blu = map( time, 120, 180, 0xFF, 0x00 );
break;
case 3:
red = 0xFF;
gre = map( time, 180, 240, 0x00, 0xFF );
blu = 0x00;
break;
case 4:
red = map( time, 240, 300, 0xFF, 0x00 );
gre = 0xFF;
blu = 0x00;
break;
case 5:
red = 0x00;
gre = 0xFF;
blu = map( time, 300, 360, 0x00, 0xFF );
break;
}
lcd.setCursor(5, 1);
sprintf( hex_str, "%.2X", 0xFF-red );
lcd.print( hex_str );
lcd.setCursor(5, 2);
sprintf( hex_str, "%.2X", 0xFF-gre );
lcd.print( hex_str );
lcd.setCursor(5, 3);
sprintf( hex_str, "%.2X", 0xFF-blu );
lcd.print( hex_str );
lcd.setCursor( 10, 1 );
for( int i=0; i<10; i++ )
{
if( i<map( red, 0xFF, 0x00, 0, 10 ) )
{
byte ii = 0;
lcd.write( ii );
}
else
{
lcd.print( " " );
}
}
lcd.setCursor( 10, 2 );
for( int i=0; i<10; i++ )
{
if( i<map( gre, 0xFF, 0x00, 0, 10 ) )
{
byte ii = 0;
lcd.write( ii );
}
else
{
lcd.print( " " );
}
}
lcd.setCursor( 10, 3 );
for( int i=0; i<10; i++ )
{
if( i<map( blu, 0xFF, 0x00, 0, 10 ) )
{
byte ii = 0;
lcd.write( ii );
}
else
{
lcd.print( " " );
}
}
analogWrite( 6, red );
analogWrite( 9, gre );
analogWrite( 10, blu );
}
void hexify(byte num, char* str)
{
str[1] = '0' + (num & 0x0F);
str[0] = '0' + ((num>>4) & 0x0F);
}