[SYS] Add serial self test feature (#1964)

Add self testing for Theengs Bridge v1.1 (TBRIDGE02)
This feature enables factory testing
This commit is contained in:
Florian authored and GitHub committed 2024-06-12 08:02:34 -05:00
1 parent e321448db0
commit a74a6ebc06
4 files changed
+145 -7

No files matched your search

+21 -7
View File
@@ -1134,6 +1134,12 @@ void setup() {
# ifdef ESP32_ETHERNET
setup_ethernet_esp32();
# endif
# if SELF_TEST
// Check serial input to trigger a Self Test sequence if required
checkSerial();
# endif
Log.notice(F("No config in flash, launching wifi manager" CR));
// In failSafeMode we don't want to setup wifi manager as it has already been done before
if (!failSafeMode) setupwifi(false);
@@ -1507,6 +1513,7 @@ void setupTLS(int index) {
6 - OTA Update
7 - Parameters changed
8 - not enough memory to pursue
9 - SELFTEST end
*/
void ESPRestart(byte reason) {
delay(1000);
@@ -1862,7 +1869,7 @@ bool loadConfigFromFlash() {
configFile.close();
}
} else {
Log.notice(F("no config file found defining default values" CR));
Log.notice(F("No config file found defining default values" CR));
# ifdef USE_MAC_AS_GATEWAY_NAME
String s = WiFi.macAddress();
sprintf(gateway_name, "%.2s%.2s%.2s%.2s%.2s%.2s",
@@ -2075,14 +2082,21 @@ void setup_ethernet_esp32() {
ETH.config(ip, gateway, subnet, Dns);
ethBeginSuccess = ETH.begin();
# else
Log.trace(F("Spl eth cfg" CR));
Log.notice(F("Spl eth cfg" CR));
ethBeginSuccess = ETH.begin();
# endif
Log.trace(F("Connecting to Ethernet" CR));
while (!ethConnected && failure_number_ntwk <= maxConnectionRetryNetwork) {
delay(500);
Log.trace(F("." CR));
failure_number_ntwk++;
if (ethBeginSuccess) {
Log.notice(F("Ethernet started" CR));
Log.notice(F("OpenMQTTGateway MAC: %s" CR), ETH.macAddress().c_str());
Log.notice(F("OpenMQTTGateway IP: %s" CR), ETH.localIP().toString().c_str());
Log.notice(F("OpenMQTTGateway link speed: %d Mbps" CR), ETH.linkSpeed());
while (!ethConnected && failure_number_ntwk <= maxConnectionRetryNetwork) {
delay(500);
Log.notice(F("." CR));
failure_number_ntwk++;
}
} else {
Log.error(F("Ethernet not started" CR));
}
}