Here's the problem, I'm working with the BMP180 pressure sensor SparkFun Barometric Pressure Sensor Breakout - BMP180 - SEN-11824 - SparkFun Electronics. I've produced a library to manage the pressure readings, this includes loading the last X readings into an array, and then processing them as a group. The size of the array (i.e. X) is hardcoded into the library, if I want to change the size, I edit the library, re-compile, and load the sketch onto the arduino.
The problem is that my current project requires three identical BMP180 pressure sensors, so I need to create three different objects, each based on the same library. However, each different pressure module needs to work with a different number of samples i.e. a different size of array.
I've considered using three almost identical copies of the same library (each with a different array size), but that would waste memory and cause code-maintenance headaches. I've also considered moving the arrays outside of the library, but this would make the code very messy.
Currently the easiest way seems to be to size the array to be the maximum size required, and simple code the other two modules to ignore the extra samples that aren't required. This should give me the functionality I require, at the expense of having lots of extra memory wasted in over-sized arrays.