data_flow

Data flow for weight and count calculations

 * We will do calculations as mass in user-selectable units (g or oz, with necessary conversion to bolts as below).
 * There will be a flag indicating whether the unit of choice is g or oz.
 * Rationale for not using other options:
 * Using V gives better but unnecessary precision, and is storing abstract values that aren't ever accessed for output, wasting program time.
 * Using a hardwired g or oz until end is overly arbitrary and sometimes requires an extra calculation.

Flow
Raw voltage from scales --> voltage buffer --> voltage mean --> calibration (includes conversion to grams or ounces) --> this is "raw weight" --> subtract tare (based on whether grams or ounces is selected) --> this is "weight" --> if necessary, do count functionality.

Count
/* prompt for first load of bolts and number of bolts in load = bolts1 weight_per_bolt = weight / bolts1; (ie. weight_per_bolt is expressed in g or oz, not volts.) /* prompt for second load of bolts bolts2 = weight / weight_per_bolt;

Quick point of order: I think that the calibration datapoints (for the moment, assume that we are using several points and a linear interpolation) should be part of the Settings. This means that we can re-use the save to flash memory of the settings to hold onto our Calibration data. The weigh function (whatever form it may take) should read the raw calibration datapoints and then figure out what the correct mass is. --Alex