CurrentRanger
CurrentRanger copied to clipboard
enhancements related to sample rate adjustment and config adjustment
Submitting these for consideration. If any of the features need trivial changes to be acceptable, let me know.
CurrentRange_R3: add modal menu for calibration adjustments
The keys that adjust calibration constants are too easy to hit by mistake, corrupting the saved value. Also the difference between +
/-
and <
/>
is not intuitive.
Use a capital letter input to enter a mode to adjust any of the calibration constants, and use +
/-
consistently within the mode. Use !
to exit the mode since ESC clobbers screen output.
CurrentRange_R3: make oversampling configuration more flexible
Add a modal menu for selecting the oversample configuration (AVGCTRL.SAMPLEN), from 1x to 1024x as supported by the hardware. Set AVGCTRL.ADJRES to preserve 12-bit full-scale output.
Remove commented out old code and reduce the size required to store the 8-bit ADC_AVGCTRL register.
CurrentRange_R3: display oversample rate on OLED
Shift the range and sample display in the upper left corner over to make room for a one character expression of the oversampling rate.
CurrentRange_R3: allow touchpad setting of sample rate
Use "sample rate" instead of oversample rate to get a more natural match to user expectations: increase should increase the sample rate, which means decrease the oversample rate.
Add a preferences byte persisted in EEPROM. Use this to record whether the user wants simultaneous touch of uA+mA to toggle offset (bias) mode (default) or to repurpose the nA and mA keys to increase or decrease the sample rate.
Changes to sample rate through the serial interface are persisted to EEPROM.
Changes to the sample rate from the touchpads are not persisted. A tone is emitted to audibly reflect the selected sample rate.
CurrentRanger_R3: improve serial representation of sample rate
Refactor code that provides a human-readable representation of the sample rate. Display the configured sample rate along with other persisted information in the config/calibration block.
CurrentRanger_R3: add display of configured logging format
The logging format is preserved in EEPROM, but never displayed, so you can see the selected value only by changing it. Add it to the set of preferences that are displayed in the config/calib block.
Also start marking the key documentation for things that are "preferences" that are saved between restarts.
CurrentRanger_R3: add preference to timestamp samples
For USB and BT serial data output add options to preface each sample with the system time at which it was taken, in microseconds. This mitigates the loss of information when the sample rate is changed dynamically.
Be aware that the counter will wrap at 2^32 us, so relative calculations should be done using unsigned 32-bit operations.
Updated with a couple more features, specifically more display of persisted configurations and most importantly timestamp of data sent over USB or bluetooth (critical in cases where the sample rate may be changing, and pretty useful even if it doesn't).