It's important to clear the buffer when significant events occur. If the sensor assembly is active only when a lamp is on, for example, then be sure to reset the FIFO's pointers at that time. Use a simple semaphore to make a routine requesting data wait until the N samples are taken. The first few readings will be noisy, but they will be more or less immediate. As the FIFO fills the signal will settle down.
Boxcars are a special case of the more general averaging technique.
If the input does indeed move slowly with time, then any sort of averaging will smear the result. The output at time T is composed equally of the signal's behavior now and when the average started. In some cases the averaging distorts results excessively. The input to the computer is a quite noisy flux-gate compass. The firmware must smooth the noisy compass input, but must respond to changes in the boat's heading.