-
Notifications
You must be signed in to change notification settings - Fork 45
Add new USB command to reset settings to defaults, clean up compiler warnings #22
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
This file was deleted.
|
Owner
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This is needed for older versions. |
This file was deleted.
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -19,11 +19,12 @@ | |
| #include <U8g2lib.h> //https://github.com/olikraus/u8g2/wiki/u8g2reference fonts:https://github.com/olikraus/u8g2/wiki/fntlistall | ||
| //#include <ATSAMD21_ADC.h> | ||
|
|
||
| #define FW_VERSION "1.1.4" //firmware version | ||
| #define FW_VERSION "1.1.5" //firmware version | ||
| // ********************** CHANGE LOG *********************************************************************** | ||
| // 1.1.4 - BUGFIX - USB logging values are half value when CR started without OLED, and until AUTORANGING is toggled | ||
| // 1.1.3 - BUGFIX - CR turns off after 21hrs when AUTO-OFF disabled | ||
| // 1.1.2 - BUGFIX - BIAS MODE bug fix | ||
| // 1.1.5 - FEATURE - NEw USB UI command to reset runtimes settings to default values | ||
| // 1.1.4 - BUGFIX - USB logging values are half value when CR started without OLED, and until AUTORANGING is toggled | ||
| // 1.1.3 - BUGFIX - CR turns off after 21hrs when AUTO-OFF disabled | ||
| // 1.1.2 - BUGFIX - BIAS MODE bug fix | ||
| //*********************************************************************************************************** | ||
| #define BIAS_LED 11 | ||
| #define LPFPIN 4 | ||
|
|
@@ -350,7 +351,7 @@ void loop() { | |
| Serial.print("\nRebooting to bootloader."); | ||
| for (byte i=0;i++<30;) { delay(10); Serial.print('.'); } | ||
| rebootIntoBootloader(); | ||
| break; | ||
| break; | ||
| case 'u': //toggle USB logging | ||
| USB_LOGGING_ENABLED =! USB_LOGGING_ENABLED; | ||
| Serial.println(USB_LOGGING_ENABLED ? "USB_LOGGING_ENABLED" : "USB_LOGGING_DISABLED"); | ||
|
|
@@ -421,6 +422,49 @@ void loop() { | |
| case '4': toggleLPF(); break; | ||
| case '5': toggleOffset(); break; | ||
| case '6': toggleAutoranging(); break; | ||
|
|
||
| case '!': //reset runtime params | ||
| USB_LOGGING_ENABLED = false; | ||
| Serial.println("USB_LOGGING_DISABLED"); | ||
|
|
||
| LOGGING_FORMAT=LOGGING_FORMAT_EXPONENT; | ||
| eeprom_LOGGINGFORMAT.write(LOGGING_FORMAT); | ||
| Serial.println("LOGGING_FORMAT_EXPONENT"); | ||
|
|
||
| TOUCH_DEBUG_ENABLED = false; | ||
| Serial.println( "TOUCH_DEBUG_DISABLED"); | ||
|
|
||
| GPIO_HEADER_RANGING = false; | ||
| Serial.println("GPIO_HEADER_RANGING_DISABLED"); | ||
|
|
||
| BT_LOGGING_ENABLED = false; | ||
| Serial.println("BT_LOGGING_DISABLED"); | ||
|
|
||
| LOGGING_FORMAT=LOGGING_FORMAT_EXPONENT; | ||
| eeprom_LOGGINGFORMAT.write(LOGGING_FORMAT); | ||
| Serial.println("LOGGING_FORMAT_EXPONENT"); | ||
|
Owner
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This is repeated on lines 430-432. |
||
|
|
||
| ADC_SAMPLING_SPEED=ADC_SAMPLING_SPEED_AVG; | ||
| eeprom_ADCSAMPLINGSPEED.write(ADC_SAMPLING_SPEED); | ||
| refreshADCSamplingSpeed(); | ||
| Serial.println("ADC_SAMPLING_SPEED_AVG"); | ||
|
|
||
| autooff_interval = AUTOOFF_DEFAULT; | ||
| eeprom_AUTOFF.write(autooff_interval); | ||
| Serial.println("AUTOOFF_DEFAULT"); | ||
|
|
||
| TOUCH_DEBUG_ENABLED = false; | ||
| Serial.println("TOUCH_DEBUG_DISABLED"); | ||
|
Owner
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This is repeated on line 434-435. |
||
|
|
||
| if (LPF) toggleLPF(); | ||
| if (BIAS) toggleOffset(); | ||
| if (AUTORANGE) toggleAutoranging(); | ||
| rangeMA(); | ||
|
|
||
| Serial.println("SETTINGS_RESET"); | ||
|
|
||
| break; | ||
|
|
||
| case '?': | ||
| printSerialMenu(); | ||
| break; | ||
|
|
@@ -521,11 +565,17 @@ void loop() { | |
|
|
||
| if (autoffBuzz) u8g2.drawStr(5,26,"* AUTO OFF! *"); //autoffWarning | ||
| u8g2.setFont(u8g2_font_helvB24_te); | ||
| u8g2.setCursor(RANGE_MA ? 102 : 106, RANGE_UA ? 55:60); u8g2.print(RANGE_UA ? char('µ') : rangeUnit); | ||
| u8g2.setCursor(RANGE_MA ? 102 : 106, RANGE_UA ? 55:60); u8g2.print(RANGE_UA ? char(u'µ') : rangeUnit); | ||
| u8g2.setFont(u8g2_font_logisoso32_tr); | ||
| u8g2.setCursor(0,64); u8g2.print((BIAS&&abs(VOUT)>=0.4||!BIAS&&VOUT>=0.4)?VOUT:0, abs(VOUT)>=1000?0:1); | ||
| if (!BIAS && readDiff>ADC_OVERLOAD || BIAS && abs(readDiff)>ADC_OVERLOAD/2) | ||
| { | ||
| u8g2.setCursor(0,64); | ||
| u8g2.print( | ||
| ( (BIAS && (abs(VOUT)>=0.4)) || (!BIAS&&(VOUT>=0.4)) )? VOUT:0 , | ||
| (abs(VOUT)>=1000)?0:1 | ||
| ); | ||
| if ( | ||
| (!BIAS && (readDiff>ADC_OVERLOAD)) || | ||
| (BIAS && (abs(readDiff)>ADC_OVERLOAD/2)) | ||
| ) { | ||
| u8g2.setFont(u8g2_font_9x15B_tf); | ||
| u8g2.drawStr(0,28, "OVERLOAD!"); | ||
| } | ||
|
|
@@ -863,6 +913,7 @@ void printSerialMenu() { | |
| Serial.println("4 = toggle Low Pass Filter (LPF)"); | ||
| Serial.println("5 = toggle BIAS (disables AutoRanging)"); | ||
| Serial.println("6 = toggle AutoRanging (disables BIAS)"); | ||
| Serial.println("! = reset all runtime settings to defaults"); | ||
| Serial.println("? = Print this menu and calib info"); | ||
| Serial.println(); | ||
| } | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is needed for older versions.