Skip to content

Commit 0bc0da9

Browse files
authored
Merge pull request #2100 from ladyada/main
Add 2 more factory tests
2 parents 1c293c4 + 26825b8 commit 0bc0da9

File tree

4 files changed

+127
-0
lines changed

4 files changed

+127
-0
lines changed

Factory_Tests/Feather_ESP32_V2_FactoryTest/.feather_esp32_v2_daily.test.only

Whitespace-only changes.
Lines changed: 66 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,66 @@
1+
// SPDX-FileCopyrightText: 2022 Limor Fried for Adafruit Industries
2+
//
3+
// SPDX-License-Identifier: MIT
4+
5+
#include "WiFi.h"
6+
#include <Adafruit_TestBed.h>
7+
extern Adafruit_TestBed TB;
8+
9+
#define NEOPIXEL_I2C_POWER 2
10+
#define NEOPIXEL_PIN 0
11+
12+
// the setup routine runs once when you press reset:
13+
void setup() {
14+
Serial.begin(115200);
15+
16+
// turn on the QT port and NeoPixel
17+
pinMode(NEOPIXEL_I2C_POWER, OUTPUT);
18+
digitalWrite(NEOPIXEL_I2C_POWER, HIGH);
19+
20+
// TestBed will handle the neopixel swirl for us
21+
TB.neopixelPin = NEOPIXEL_PIN;
22+
TB.neopixelNum = 1;
23+
TB.begin();
24+
25+
// Set WiFi to station mode and disconnect from an AP if it was previously connected
26+
WiFi.mode(WIFI_STA);
27+
WiFi.disconnect();
28+
}
29+
30+
// the loop routine runs over and over again forever:
31+
uint8_t wheelColor=0;
32+
void loop() {
33+
if (wheelColor == 0) {
34+
// Test I2C!
35+
Serial.print("I2C port ");
36+
TB.theWire = &Wire;
37+
TB.printI2CBusScan();
38+
39+
// Test WiFi Scan!
40+
// WiFi.scanNetworks will return the number of networks found
41+
int n = WiFi.scanNetworks();
42+
Serial.print("WiFi AP scan done...");
43+
if (n == 0) {
44+
Serial.println("no networks found");
45+
} else {
46+
Serial.print(n);
47+
Serial.println(" networks found");
48+
for (int i = 0; i < n; ++i) {
49+
// Print SSID and RSSI for each network found
50+
Serial.print(i + 1);
51+
Serial.print(": ");
52+
Serial.print(WiFi.SSID(i));
53+
Serial.print(" (");
54+
Serial.print(WiFi.RSSI(i));
55+
Serial.print(")");
56+
Serial.println((WiFi.encryptionType(i) == WIFI_AUTH_OPEN)?" ":"*");
57+
delay(10);
58+
}
59+
}
60+
Serial.println("");
61+
}
62+
63+
TB.setColor(TB.Wheel(wheelColor++)); // swirl NeoPixel
64+
65+
delay(5);
66+
}

Factory_Tests/QTPy_ESP32C3_FactoryTest/.esp32.test.only

Whitespace-only changes.
Lines changed: 61 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,61 @@
1+
// SPDX-FileCopyrightText: 2022 Limor Fried for Adafruit Industries
2+
//
3+
// SPDX-License-Identifier: MIT
4+
5+
#include <Arduino.h>
6+
#include <Adafruit_NeoPixel.h>
7+
#include "Adafruit_TestBed.h"
8+
#include <WiFi.h>
9+
extern Adafruit_TestBed TB;
10+
11+
#define NEOPIXEL_PIN 2
12+
13+
void setup() {
14+
Serial.begin(115200);
15+
//while (! Serial) delay(10);
16+
17+
Serial.println("QT Py ESP32 C3!");
18+
19+
TB.neopixelPin = NEOPIXEL_PIN;
20+
TB.neopixelNum = 1;
21+
TB.begin();
22+
TB.setColor(0xFF0000);
23+
delay(50);
24+
TB.setColor(0x00FF00);
25+
delay(50);
26+
TB.setColor(0x0000FF);
27+
delay(50);
28+
}
29+
30+
uint8_t j = 0;
31+
32+
void loop() {
33+
TB.setColor(TB.Wheel(j++));
34+
delay(10);
35+
36+
if (j == 255) {
37+
TB.setColor(GREEN);
38+
Serial.println("scan start");
39+
// WiFi.scanNetworks will return the number of networks found
40+
int n = WiFi.scanNetworks();
41+
Serial.println("scan done");
42+
if (n == 0) {
43+
Serial.println("no networks found");
44+
} else {
45+
Serial.print(n);
46+
Serial.println(" networks found");
47+
for (int i = 0; i < n; ++i) {
48+
// Print SSID and RSSI for each network found
49+
Serial.print(i + 1);
50+
Serial.print(": ");
51+
Serial.print(WiFi.SSID(i));
52+
Serial.print(" (");
53+
Serial.print(WiFi.RSSI(i));
54+
Serial.print(")");
55+
Serial.println((WiFi.encryptionType(i) == WIFI_AUTH_OPEN)?" ":"*");
56+
delay(10);
57+
}
58+
}
59+
Serial.println("");
60+
}
61+
}

0 commit comments

Comments
 (0)