Skip to content

Commit 6daf76c

Browse files
committed
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. Signed-off-by: Peter A. Bigot <pab@pabigot.com>
1 parent e8dce7b commit 6daf76c

1 file changed

Lines changed: 11 additions & 7 deletions

File tree

CurrentRanger_R3.ino

Lines changed: 11 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -115,6 +115,13 @@ Adafruit_FreeTouch qt[3] = {
115115
//***********************************************************************************************************
116116
#define PREFERENCE_MU_SAMPLERATE 0x01 // default BIAS
117117
//***********************************************************************************************************
118+
static const char *const loggingFormat_str[] = {
119+
[LOGGING_FORMAT_EXPONENT] = "exp (1.23E-3 = 123 mA)",
120+
[LOGGING_FORMAT_NANOS] = "nA (1234 = 1.234 uA)",
121+
[LOGGING_FORMAT_MICROS] = "uA (1234 = 1.234 mA)",
122+
[LOGGING_FORMAT_MILLIS] = "mA (1234 = 1.234 A)",
123+
[LOGGING_FORMAT_ADC] = "adc (0..4095)",
124+
};
118125
int offsetCorrectionValue = 0;
119126
uint16_t gainCorrectionValue = 0;
120127
float ldoValue = 0, ldoOptimized=0;
@@ -477,11 +484,7 @@ void loop()
477484
case 'f': //cycle through output logging formats
478485
if (++LOGGING_FORMAT>LOGGING_FORMAT_ADC) LOGGING_FORMAT=LOGGING_FORMAT_EXPONENT;
479486
eeprom_LOGGINGFORMAT.write(LOGGING_FORMAT);
480-
if (LOGGING_FORMAT==LOGGING_FORMAT_EXPONENT) Serial.println("LOGGING_FORMAT_EXPONENT"); else
481-
if (LOGGING_FORMAT==LOGGING_FORMAT_NANOS) Serial.println("LOGGING_FORMAT_NANOS"); else
482-
if (LOGGING_FORMAT==LOGGING_FORMAT_MICROS) Serial.println("LOGGING_FORMAT_MICROS"); else
483-
if (LOGGING_FORMAT==LOGGING_FORMAT_MILLIS) Serial.println("LOGGING_FORMAT_MILLIS"); else
484-
if (LOGGING_FORMAT==LOGGING_FORMAT_ADC) Serial.println("LOGGING_FORMAT_ADC");
487+
Serial.println(loggingFormat_str[LOGGING_FORMAT]);
485488
break;
486489
case 'a': //toggle autoOff function
487490
if (AUTOFF_INTERVAL == AUTOFF_DEFAULT)
@@ -895,6 +898,7 @@ void printCalibInfo() {
895898
Serial.print("Gain="); Serial.println(gainCorrectionValue);
896899
Serial.print("LDO="); Serial.println(ldoValue,3);
897900
Serial.print("SampleRate: "); sampleRateOutSerial();
901+
Serial.print("LogFmt: "); Serial.println(loggingFormat_str[LOGGING_FORMAT]);
898902
Serial.print("uA+mA: ");
899903
Serial.println((PREFERENCES & PREFERENCE_MU_SAMPLERATE)
900904
? "toggle samplerate adjust"
@@ -904,9 +908,9 @@ void printSerialMenu() {
904908
Serial.println("\r\nUSB serial commands:");
905909
Serial.println("a = toggle Auto-Off function");
906910
Serial.print ("b = toggle BT/serial logging (");Serial.print(SERIAL_UART_BAUD);Serial.println("baud)");
907-
Serial.println("f = cycle serial logging formats (exponent,nA,uA,mA/raw-ADC)");
911+
Serial.println("f = cycle serial logging formats (exponent,nA,uA,mA/raw-ADC) [PREF]");
908912
Serial.println("g = toggle GPIO range indication (SCK=mA,MISO=uA,MOSI=nA)");
909-
Serial.println("o = toggle touchpad offset (bias) / samplerate selection");
913+
Serial.println("o = toggle touchpad offset (bias) / samplerate selection [PREF]");
910914
Serial.println("t = toggle touchpad serial output debug info");
911915
Serial.println("u = toggle USB/serial logging");
912916
Serial.println("+ = increase mode value");

0 commit comments

Comments
 (0)