Repository navigation
P0 Studio: reliable ESP32-P4 reconnect and truthful firmware detection on startup #247
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: fix/studio-auto-sync-10s-evidence-20261018
Are you sure you want to change the base?
Changes from all commits
3852e31
96cb887
90910e0
738ad52
8d28b31
e5ce452
11c333f
ae235dd
a6b304c
07749bd
3b6a33d
24ea405
a6890b2
f3e4456
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -56,8 +56,16 @@ SmartSessionController::SmartSessionController(QObject* parent) : QObject(parent | |
| connect(&discoveryTimer_, &QTimer::timeout, this, [this] { | ||
| if (!started_ || device_ == nullptr || updateRequested_ || blankBoardDetected_ || setupError_) return; | ||
| if (firmware_ != nullptr && firmware_->busy()) return; | ||
| if (device_->identificationState() == DeviceController::IdentificationState::Unidentified) return; | ||
| // A slow serial reply is NOT evidence that firmware is absent. | ||
| // Retry semantic discovery after a bounded 5s cool-down; do not | ||
| // endlessly hold the single COM port or auto-flash a live board. | ||
| if (device_->identificationState() == DeviceController::IdentificationState::Unidentified) { | ||
| if (manualRecoveryArmed_) return; | ||
| ++unidentifiedDiscoveryTicks_; | ||
| if (unidentifiedDiscoveryTicks_ < 2) return; | ||
| } | ||
| if (!device_->deviceVerified() && !device_->discovering() && !device_->connected()) { | ||
| unidentifiedDiscoveryTicks_ = 0; | ||
|
Comment on lines
+64
to
+68
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
When a non-ARStack or permanently unresponsive serial device remains visible, every terminal AGENTS.md reference: AGENTS.md:L80-L84 Useful? React with 👍 / 👎. |
||
| static_cast<void>(startDeviceDiscovery()); | ||
| } | ||
| }); | ||
|
|
@@ -841,7 +849,10 @@ void SmartSessionController::refreshRecoveryOfferFromIdentity() { | |
| return; | ||
| } | ||
|
|
||
| if (recoveryPending_) { | ||
| // Semantic timeout on an auto-detected port proves *nothing* about | ||
| // flash contents. Present firmware recovery only after the operator | ||
| // explicitly selected this port. ROM chip checks still precede flash. | ||
| if (recoveryPending_ || !manualRecoveryArmed_) { | ||
| blankBoardDetected_ = false; | ||
| blankBoardPort_.clear(); | ||
| return; | ||
|
|
@@ -865,6 +876,7 @@ void SmartSessionController::clearBlankBoardContext() { | |
| blankBoardDetected_ = false; | ||
| blankBoardPort_.clear(); | ||
| manualRecoveryArmed_ = false; | ||
| unidentifiedDiscoveryTicks_ = 0; | ||
| setupError_ = false; | ||
| setupErrorStatus_.clear(); | ||
| } | ||
|
|
@@ -1177,8 +1189,8 @@ void SmartSessionController::reconcile() { | |
|
|
||
| if (blankBoardDetected_) { | ||
| setPresentation( | ||
| QStringLiteral("FIRMWARE REQUIRED"), | ||
| QStringLiteral("ESP32-P4 candidate %1 did not answer the current semantic identity after bounded attempts. Studio can install the bundled firmware after ROM chip/revision verification.") | ||
| QStringLiteral("FIRMWARE RECOVERY"), | ||
| QStringLiteral("Manually selected port %1 did not answer ARStack IDENTIFY. Firmware status is UNKNOWN. Retry connection first; optional recovery requires ROM chip/revision verification.") | ||
| .arg(blankBoardPort_), | ||
| false, | ||
| false); | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Changing only
DeviceIoWorkerto 5 attempts/1100 ms leavesDeviceController::identityMaxAttempts()andidentityRetryIntervalMs()at 3/650. Consequently,checkFirmwareContract()makes bothboundedIdentifyPolicyandworkerPolicyAlignedfalse and exits with code 11; the Studio Qt, native-preview, and release workflows all invoke--check-firmware-contract, so this change breaks those required checks on every platform. Update the controller-side contract and its assertions together with these worker values.AGENTS.md reference: AGENTS.md:L230-L236
Useful? React with 👍 / 👎.