So I know the first thing I will be asked is "post your code" but in this situation that will not be possible due to this project being made with the intention of selling it. (also the rest of the code is irrelevant and incredibly long) However, I can post some parts of the code for you to analyze.
Info: Arduino Mega 2560, sketch uses 10% program storage space, 25% dynamic variable space.
Essentially, this project is using two 10-length addressable RGB strips for aesthetics, and the RGB strips use a single wire chipset, which can cause problems with interrupts being disabled according to the FastLED wiki. However, it is not serial or i2c or spi or servo or any other communication that is being broken by FastLED, but a variable. There is a password that must be set with a keypad, which is then displayed on an i2c LCD. Later in the program, the password is required again, but the original password is displayed so that it can be entered. However, when a specific block of FastLED code is added to the code, instead of the original password being displayed, all four characters of the password are replaced by a custom LCD character that is used elsewhere in the code. Depending on where the block of fastLED code is placed, only 2 or 3 of the password's characters are corrupted.
For reference, the password is stored in a four-length char array, and the custom character is stored in an 8 length byte array. These are completely unrelated and strangely, when the custom character is commented out, the password is corrupted by fully filled character spaces on the LCD.
When this specific block of FastLED code is removed, everything works fine. When it is in the code, depending on where in the code it is, some or all of the password characters corrupt.
Also, when the password corrupts, the code does not recognize the correct password when it is inputted.
(yes I realize it gives the user the password and then asks them to input it. It's supposed to be easy.)
Back to the interrupt disabling done by the fastLED library, I have tried using the #define FASTLED_ALLOW_INTERRUPTS to both 0 and 1, neither of which fixed the problem. I also tried setting the FASTLED_INTERRUPT_RETRY_COUNT to 1.
Here is the offending block of code:
currentTime = millis();
if (currentTime >= lastTimePing + 3000){
lastTimePing = millis();
leds[leadLed] = CRGB (20,0,0);
leds[leadLed-3] = CRGB (0,0,0);
fill_solid(&(leds[20]), 2, CRGB (0,0,0));
FastLED.show();
leadLed++;
if (leadLed == 23){
leadLed = 0;
}
}
"leds" and "leadLed" are variables custom made to control the addressable LED strip with the FastLED library.
millis() and currentTime and lastTimePing are used to keep track of the time when this function is called in void loop().
If anyone has any ideas, I will be very grateful. I have spent hours pulling my hair out over this code, and I have eliminated a few other unrelated bugs in the code, none of which fixed the problem. There may be another bug in the code, but I do not think there is.