Need help with non delay timing

Here is a snippet of code where I am trying to shutdown a neopixel stick so it goes off one led at a time. I want to be able to control the speed of the sequence with an interval. I can't seem to get the timer to work though. Looking for help.

/************************* Shutdown and helper functions ****************************/

unsigned long lastBarMillis_on = 0;   // bargraph on tracker
const int pd_interval = 100;     // interval at which to cycle lights (milliseconds).
 
void bargraph_shutdown(int currentMillis) {

  if(currentMillis - lastBarMillis_on > pd_interval){
  // save the last time you blinked the LED
    lastBarMillis_on = currentMillis;
         
    for (int i=7; i>-1; i-- ){//Bargraph power down sequence
    barGraph.setPixelColor(i,0);
    barGraph.show();}
    safety=false;}}

Post all your code.
If currentMillis is to contain what it sounds like, it should be of type unsigned long and not int.

There's a lot of code, but currentMillis is just holding the value for millis

 // get the current time
  int currentMillis = millis();

Here is what I have, but still does not use the delay to shutdown each pixel:

/************************* Shutdown and helper functions ****************************/
// get the current time
  unsigned long currentMillis = millis();
unsigned long lastBarMillis_on = 0;   // bargraph on tracker
const int pd_interval = 100;     // interval at which to cycle lights (milliseconds).
 
void bargraph_shutdown(unsigned long currentMillis) {
   
  if(currentMillis - lastBarMillis_on > pd_interval){
  // save the last time you blinked the LED
    lastBarMillis_on = currentMillis;         
    for (int i=7; i>-1; i-- ){//Bargraph power down sequence
    barGraph.setPixelColor(i,0);
    barGraph.show();}
    safety=false;}

}

grogking:
There's a lot of code, but currentMillis is just holding the value for millis

 // get the current time

int currentMillis = millis();

Read reply #1 again. Especially the second sentence.

DangerToMyself:
Read reply #1 again. Especially the second sentence.

If you notice the post just above yours, I have made that change. It still doesn't work.

In the code which you haven’t shown, is the function bargraph_shutdown() called once per shutdown, or is it called at regular intervals? In the function, there is no timing element in the loop which has the comment “ Bargraph power down sequence”, so it will go from 7 to 0 in a fraction of second.
Incidentally, it unusual to pass a value of millis() into a function. Instead, you can just test millis() directly in the function.

6v6gt:
In the code which you haven’t shown, is the function bargraph_shutdown() called once per shutdown, or is it called at regular intervals? In the function, there is no timing element in the loop which has the comment “ Bargraph power down sequence”, so it will go from 7 to 0 in a fraction of second.
Incidentally, it unusual to pass a value of millis() into a function. Instead, you can just test millis() directly in the function.

It's called once per shutdown.

It's called once per shutdown.

So, you expect the code to block until shutdown is complete. Given that, please explain why you are trying to convert it to a non-blocking function by not using delay().

grogking:
If you notice the post just above yours, I have made that change. It still doesn't work.

My appologies. Too much Killian's. I'm surprised my reply was even close to coherent.

Too much Killian's.

No such thing. You've been drinking too much if you even consider that such a thing is possible.

PaulS:
No such thing. You've been drinking too much if you even consider that such a thing is possible.

And I was just thinking how appropriate his choice of screen name was.