feat(deploy-tab): auto re-pair before deploy if connection lost
This commit is contained in:
parent
87364da0c5
commit
bb19523f65
|
|
@ -87,11 +87,28 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
async function handleDeploy() {
|
async function handleDeploy() {
|
||||||
if (!deployer || !isPaired) {
|
if (!deployer) {
|
||||||
errorMessage = 'Hubungkan perangkat dulu';
|
errorMessage = 'Deployer belum diinisialisasi';
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Auto re-pair if BLE connection is lost
|
||||||
|
if (!deployer.isConnected || !isPaired) {
|
||||||
|
console.log('[DEPLOY] Connection lost, attempting re-pair...');
|
||||||
|
try {
|
||||||
|
deployState = 'pairing';
|
||||||
|
deployMessage = 'Re-connecting to device...';
|
||||||
|
await deployer.pair();
|
||||||
|
isPaired = true;
|
||||||
|
deployState = 'idle';
|
||||||
|
console.log('[DEPLOY] Re-pair successful!');
|
||||||
|
} catch (err: any) {
|
||||||
|
deployState = 'error';
|
||||||
|
errorMessage = 'Re-pair gagal: ' + err.message;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
serialActive = false;
|
serialActive = false;
|
||||||
|
|
||||||
try {
|
try {
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue