Putting all the accumulating_gyro_X variables into a structure could make the code cleaner.

accumulate_gyro {
  bool accumulating;
  uint32_t num_samples;
  float[3] samples;
}