Skip to content

Commit 644f451

Browse files
committed
2 parents 020ddf4 + 16c63d9 commit 644f451

File tree

2 files changed

+102
-0
lines changed

2 files changed

+102
-0
lines changed

Factory_Tests/Feather_ESP32S2_FactoryTest/.feather_esp32s2.test.only

Whitespace-only changes.
Lines changed: 102 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,102 @@
1+
// SPDX-FileCopyrightText: 2022 Limor Fried for Adafruit Industries
2+
//
3+
// SPDX-License-Identifier: MIT
4+
5+
#include <Arduino.h>
6+
#include "Adafruit_MAX1704X.h"
7+
#include "Adafruit_LC709203F.h"
8+
#include <Adafruit_NeoPixel.h>
9+
#include "Adafruit_TestBed.h"
10+
#include <Adafruit_BME280.h>
11+
12+
Adafruit_BME280 bme; // I2C
13+
bool bmefound = false;
14+
extern Adafruit_TestBed TB;
15+
16+
Adafruit_LC709203F lc_bat;
17+
Adafruit_MAX17048 max_bat;
18+
19+
bool maxfound = false;
20+
bool lcfound = false;
21+
22+
void setup() {
23+
Serial.begin(115200);
24+
// while (! Serial) delay(10);
25+
26+
delay(100);
27+
28+
pinMode(NEOPIXEL_POWER, OUTPUT);
29+
digitalWrite(NEOPIXEL_POWER, HIGH);
30+
delay(10);
31+
32+
TB.neopixelPin = PIN_NEOPIXEL;
33+
TB.neopixelNum = 1;
34+
TB.begin();
35+
TB.setColor(WHITE);
36+
37+
if (lc_bat.begin()) {
38+
Serial.println("Found LC709203F");
39+
Serial.print("Version: 0x"); Serial.println(lc_bat.getICversion(), HEX);
40+
lc_bat.setPackSize(LC709203F_APA_500MAH);
41+
lcfound = true;
42+
}
43+
else {
44+
Serial.println(F("Couldnt find Adafruit LC709203F?\nChecking for Adafruit MAX1704X.."));
45+
delay(200);
46+
if (!max_bat.begin()) {
47+
Serial.println(F("Couldnt find Adafruit MAX1704X?\nMake sure a battery is plugged in!"));
48+
while (1) delay(10);
49+
}
50+
Serial.print(F("Found MAX17048"));
51+
Serial.print(F(" with Chip ID: 0x"));
52+
Serial.println(max_bat.getChipID(), HEX);
53+
maxfound = true;
54+
55+
}
56+
57+
58+
if (TB.scanI2CBus(0x77)) {
59+
Serial.println("BME280 address");
60+
61+
unsigned status = bme.begin();
62+
if (!status) {
63+
Serial.println("Could not find a valid BME280 sensor, check wiring, address, sensor ID!");
64+
Serial.print("SensorID was: 0x"); Serial.println(bme.sensorID(),16);
65+
Serial.print(" ID of 0xFF probably means a bad address, a BMP 180 or BMP 085\n");
66+
Serial.print(" ID of 0x56-0x58 represents a BMP 280,\n");
67+
Serial.print(" ID of 0x60 represents a BME 280.\n");
68+
Serial.print(" ID of 0x61 represents a BME 680.\n");
69+
return;
70+
}
71+
Serial.println("BME280 found OK");
72+
bmefound = true;
73+
}
74+
}
75+
76+
uint8_t j = 0;
77+
78+
void loop() {
79+
80+
if (j % 10 == 0) {
81+
Serial.println("**********************");
82+
if (lcfound == true) {
83+
Serial.print(F("Batt Voltage: "));
84+
Serial.print(lc_bat.cellVoltage(), 1);
85+
Serial.print(" V / ");
86+
Serial.print(F("Batt Percent: "));
87+
Serial.print(lc_bat.cellPercent(), 0);
88+
Serial.println("%");
89+
}
90+
else {
91+
Serial.print(F("Batt Voltage: "));
92+
Serial.print(max_bat.cellVoltage(), 1);
93+
Serial.print(" V / ");
94+
Serial.print(F("Batt Percent: "));
95+
Serial.print(max_bat.cellPercent(), 0);
96+
Serial.println("%");
97+
}
98+
TB.printI2CBusScan();
99+
}
100+
TB.setColor(TB.Wheel(j++));
101+
return;
102+
}

0 commit comments

Comments
 (0)