|
24 | 24 | #define LCD_COLUMNS 20 |
25 | 25 | #define LCD_ROWS 4 |
26 | 26 |
|
27 | | -#define VERSION "3.1" |
| 27 | +#define VERSION_EXAMPLE "3.1" |
28 | 28 |
|
29 | 29 | //#define DEBUG |
30 | 30 | /* |
@@ -52,7 +52,7 @@ void printCurrent(struct SBMFunctionDescriptionStruct * aDescription, uint16_t a |
52 | 52 | void printTemperature(struct SBMFunctionDescriptionStruct * aDescription, uint16_t aTemperature); |
53 | 53 |
|
54 | 54 | void printFunctionDescriptionArray(struct SBMFunctionDescriptionStruct * aSBMFunctionDescription, uint8_t aLengthOfArray, |
55 | | -bool aOnlyPrintIfValueChanged); |
| 55 | + bool aOnlyPrintIfValueChanged); |
56 | 56 | void printSMBStaticInfo(void); |
57 | 57 | void printSMBManufacturerInfo(void); |
58 | 58 | void printSMBNonStandardInfo(bool aOnlyPrintIfValueChanged); |
@@ -170,23 +170,22 @@ BQ20Z70_PackVoltage, Pack_Voltage, &printVoltage } }; |
170 | 170 | */ |
171 | 171 |
|
172 | 172 | void setup() { |
173 | | -// initialize the digital pin as an output. |
174 | 173 | pinMode(LED_BUILTIN, OUTPUT); |
| 174 | + Serial.begin(115200); |
| 175 | +#if defined(__AVR_ATmega32U4__) |
| 176 | + while (!Serial); //delay for Leonardo, but this loops forever for Maple Serial |
| 177 | +#endif |
| 178 | + // Just to know which program is running on my Arduino |
| 179 | + Serial.println(F("START " __FILE__ "\r\nVersion " VERSION_EXAMPLE " from " __DATE__)); |
175 | 180 |
|
176 | 181 | // Shutdown SPI, timers, and ADC |
177 | 182 | PRR = (1 << PRSPI) | (1 << PRTIM1) | (1 << PRTIM2) | (1 << PRADC); |
178 | 183 | // Disable digital input on all unused ADC channel pins to reduce power consumption |
179 | 184 | DIDR0 = ADC0D | ADC1D | ADC2D | ADC3D; |
180 | 185 |
|
181 | | - Serial.begin(115200); |
182 | | - while (!Serial) { |
183 | | - ; // wait for Leonardo enumeration, others continue immediately |
184 | | - } |
185 | | - |
186 | 186 | // set up the LCD's number of columns and rows: |
187 | 187 | myLCD.begin(LCD_COLUMNS, LCD_ROWS); |
188 | | - Serial.println(F("START SBMInfo\r\nVersion " VERSION " from " __DATE__)); |
189 | | - myLCD.print(F("SBMInfo " VERSION)); |
| 188 | + myLCD.print(F("SBMInfo " VERSION_EXAMPLE)); |
190 | 189 | myLCD.setCursor(0, 1); |
191 | 190 | myLCD.print(F(__DATE__)); |
192 | 191 | /* |
@@ -613,7 +612,7 @@ void printBatteryStatus(struct SBMFunctionDescriptionStruct * aDescription, uint |
613 | 612 | } |
614 | 613 |
|
615 | 614 | void printFunctionDescriptionArray(struct SBMFunctionDescriptionStruct * aSBMFunctionDescription, uint8_t aLengthOfArray, |
616 | | -bool aOnlyPrintIfValueChanged) { |
| 615 | + bool aOnlyPrintIfValueChanged) { |
617 | 616 | for (uint8_t i = 0; i < aLengthOfArray; ++i) { |
618 | 617 | readWordAndPrint(aSBMFunctionDescription, aOnlyPrintIfValueChanged); |
619 | 618 | aSBMFunctionDescription++; |
|
0 commit comments