ESP32: автозапуск Add Homeserver для отладки

This commit is contained in:
AidarKC 2026-06-23 18:56:33 +04:00
parent c91b52cfd2
commit 017d568aea
2 changed files with 36 additions and 2 deletions

View File

@ -363,6 +363,9 @@ static String gRegisterConfirmBalanceLine;
static String gRegisterConfirmPdaLine; static String gRegisterConfirmPdaLine;
static String gRegisterConfirmHomeserverLine; static String gRegisterConfirmHomeserverLine;
static bool gRegisterConfirmCanSubmit = false; static bool gRegisterConfirmCanSubmit = false;
static bool gAutoHomeserverDebugPending = true;
static bool gAutoHomeserverDebugRunning = false;
static bool gAutoHomeserverDebugDone = false;
static String gRegisterResultMessage; static String gRegisterResultMessage;
static String gRegisterResultDetails; static String gRegisterResultDetails;
static bool gRegisterResultSuccess = false; static bool gRegisterResultSuccess = false;
@ -628,6 +631,7 @@ static bool awaitTransactionConfirmation(const String &signatureB58, String &mes
static bool registerHomeserverOnSolana(String &messageOut); static bool registerHomeserverOnSolana(String &messageOut);
static void executeRegisterAccountFlow(const char *triggerSource, bool showResultScreen); static void executeRegisterAccountFlow(const char *triggerSource, bool showResultScreen);
static bool updateHomeserverSessionOnSolana(bool requireExisting, String &messageOut); static bool updateHomeserverSessionOnSolana(bool requireExisting, String &messageOut);
static void maybeAutoRunHomeserverAddDebug();
static void loadRegisterDiagDetailsFromPrefs(); static void loadRegisterDiagDetailsFromPrefs();
static void saveRegisterDiagDetailsToPrefs(const String &details); static void saveRegisterDiagDetailsToPrefs(const String &details);
static void clearRegisterDiagDetailsFromPrefs(); static void clearRegisterDiagDetailsFromPrefs();
@ -1492,6 +1496,7 @@ static void markAccountStateDirty() {
gRegisterResultMessage = ""; gRegisterResultMessage = "";
gRegisterResultDetails = ""; gRegisterResultDetails = "";
gRegisterResultSuccess = false; gRegisterResultSuccess = false;
gAutoHomeserverDebugPending = true;
clearShineSessionState(true); clearShineSessionState(true);
gShineStatusLine = "SHiNE: account not configured"; gShineStatusLine = "SHiNE: account not configured";
} }
@ -3428,6 +3433,34 @@ static bool updateHomeserverSessionOnSolana(bool requireExisting, String &messag
return true; return true;
} }
static void maybeAutoRunHomeserverAddDebug() {
if (!gAutoHomeserverDebugPending || gAutoHomeserverDebugRunning || gAutoHomeserverDebugDone) {
return;
}
if (WiFi.status() != WL_CONNECTED) {
return;
}
if (!gSecretConfigured || !gHomeserverPdaCanAdd || !gShowHomeserverPdaActionButton) {
return;
}
gAutoHomeserverDebugPending = false;
gAutoHomeserverDebugRunning = true;
gAutoHomeserverDebugDone = true;
gRegisterTriggerSource = "auto-boot-homeserver-add";
Serial.println("AUTO_HOMESERVER_ADD_BEGIN");
String updateMessage;
bool ok = updateHomeserverSessionOnSolana(false, updateMessage);
if (ok) {
Serial.println("AUTO_HOMESERVER_ADD_OK");
} else {
Serial.print("AUTO_HOMESERVER_ADD_FAIL: ");
Serial.println(updateMessage);
}
gAutoHomeserverDebugRunning = false;
}
static bool parseShineUserPdaBytes(const std::vector<uint8_t> &bytes, ShinePdaUserState &outState, String &errorOut) { static bool parseShineUserPdaBytes(const std::vector<uint8_t> &bytes, ShinePdaUserState &outState, String &errorOut) {
outState = ShinePdaUserState{}; outState = ShinePdaUserState{};
errorOut = ""; errorOut = "";
@ -7170,6 +7203,7 @@ void loop() {
} }
manageWifiReconnect(); manageWifiReconnect();
manageAccountPdaRefresh(); manageAccountPdaRefresh();
maybeAutoRunHomeserverAddDebug();
manageShineConnection(); manageShineConnection();
if (gBalanceAutoRefreshPending && gSecretConfigured && WiFi.status() == WL_CONNECTED) { if (gBalanceAutoRefreshPending && gSecretConfigured && WiFi.status() == WL_CONNECTED) {

View File

@ -1,2 +1,2 @@
client.version=1.2.249 client.version=1.2.250
server.version=1.2.234 server.version=1.2.235