Skip to content

Commit 2f8981a

Browse files
committed
add sleep
1 parent 8ac5cc0 commit 2f8981a

2 files changed

Lines changed: 13 additions & 3 deletions

File tree

src/containers/Terminal/index.tsx

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ import { MODAL_TYPE } from '@interfaces/animation/enums'
22
import { NOTIFICATION_TYPE } from '@interfaces/notifications/enums'
33
import Terminal from '@pages/Terminal'
44
import { useNavigate } from '@solidjs/router'
5+
import { logger } from '@src/logger'
56
import { download } from '@src/utils'
67
import { addNotification } from '@store/actions/notifications/addNotification'
78
import { getFirmwareLogs } from '@store/actions/terminal/getFirmwareLogs'
@@ -64,7 +65,13 @@ export const TerminalContainer = () => {
6465
})
6566
return
6667
}
67-
download(detailedLogs().toString(), 'esp-web-tools-logs.txt')
68+
download(
69+
`
70+
${detailedLogs().toString()}
71+
------------------------------ LOGGER ------------------------
72+
${logger.getLogs()}`,
73+
'esp-web-tools-logs.txt',
74+
)
6875
}}
6976
onClickBack={() => {
7077
navigate('/')

src/esp/espApiCore.ts

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -392,6 +392,8 @@ export class EspApiCore {
392392
): Promise<string> {
393393
await this._switchDeviceMode(port, 'wifi')
394394

395+
await sleep(1000)
396+
395397
const commands = [
396398
{ command: COMMAND.SET_MDNS, data: { hostname: mdns } },
397399
{
@@ -401,6 +403,7 @@ export class EspApiCore {
401403
]
402404

403405
await this._sendCommands({ portName: port, commands })
406+
await sleep(1500)
404407
await this._sendCommands({ portName: port, commands: [{ command: COMMAND.CONNECT_WIFI }] })
405408

406409
const response: string = await invoke(ESP_COMMAND.GET_WIFI_CONNECTION_STATUS, {
@@ -419,11 +422,11 @@ export class EspApiCore {
419422

420423
const connectionStatus = data[COMMAND.GET_WIFI_STATUS]
421424

422-
if (!connectionStatus || connectionStatus.status !== 'success') {
425+
if (!connectionStatus || connectionStatus?.status !== 'success') {
423426
throw new Error('Failed to setup wireless connection')
424427
}
425428

426-
if (connectionStatus.data.status !== 'connected') {
429+
if (connectionStatus?.data?.status !== 'connected') {
427430
throw new Error('Failed to setup wireless connection')
428431
}
429432

0 commit comments

Comments
 (0)