Skip to content

Commit adaf540

Browse files
committed
Leonardo setup
1 parent 1d837ab commit adaf540

File tree

1 file changed

+10
-11
lines changed

1 file changed

+10
-11
lines changed

src/SBMInfo/SBMInfo.ino

Lines changed: 10 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@
2424
#define LCD_COLUMNS 20
2525
#define LCD_ROWS 4
2626

27-
#define VERSION "3.1"
27+
#define VERSION_EXAMPLE "3.1"
2828

2929
//#define DEBUG
3030
/*
@@ -52,7 +52,7 @@ void printCurrent(struct SBMFunctionDescriptionStruct * aDescription, uint16_t a
5252
void printTemperature(struct SBMFunctionDescriptionStruct * aDescription, uint16_t aTemperature);
5353

5454
void printFunctionDescriptionArray(struct SBMFunctionDescriptionStruct * aSBMFunctionDescription, uint8_t aLengthOfArray,
55-
bool aOnlyPrintIfValueChanged);
55+
bool aOnlyPrintIfValueChanged);
5656
void printSMBStaticInfo(void);
5757
void printSMBManufacturerInfo(void);
5858
void printSMBNonStandardInfo(bool aOnlyPrintIfValueChanged);
@@ -170,23 +170,22 @@ BQ20Z70_PackVoltage, Pack_Voltage, &printVoltage } };
170170
*/
171171

172172
void setup() {
173-
// initialize the digital pin as an output.
174173
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__));
175180

176181
// Shutdown SPI, timers, and ADC
177182
PRR = (1 << PRSPI) | (1 << PRTIM1) | (1 << PRTIM2) | (1 << PRADC);
178183
// Disable digital input on all unused ADC channel pins to reduce power consumption
179184
DIDR0 = ADC0D | ADC1D | ADC2D | ADC3D;
180185

181-
Serial.begin(115200);
182-
while (!Serial) {
183-
; // wait for Leonardo enumeration, others continue immediately
184-
}
185-
186186
// set up the LCD's number of columns and rows:
187187
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));
190189
myLCD.setCursor(0, 1);
191190
myLCD.print(F(__DATE__));
192191
/*
@@ -613,7 +612,7 @@ void printBatteryStatus(struct SBMFunctionDescriptionStruct * aDescription, uint
613612
}
614613

615614
void printFunctionDescriptionArray(struct SBMFunctionDescriptionStruct * aSBMFunctionDescription, uint8_t aLengthOfArray,
616-
bool aOnlyPrintIfValueChanged) {
615+
bool aOnlyPrintIfValueChanged) {
617616
for (uint8_t i = 0; i < aLengthOfArray; ++i) {
618617
readWordAndPrint(aSBMFunctionDescription, aOnlyPrintIfValueChanged);
619618
aSBMFunctionDescription++;

0 commit comments

Comments
 (0)