MCPcopy Create free account
hub / github.com/SpacehuhnTech/espwebtool / erase

Function erase

src/App.js:122–147  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

120
121 // Erase firmware on ESP
122 const erase = async () => {
123 setConfirmErase(false)
124 setFlashing(true)
125 toast(`Erasing flash memory. Please wait...`, { position: 'top-center', toastId: 'erase', autoClose: false })
126
127 try {
128 const stamp = Date.now()
129
130 addOutput(`Start erasing`)
131 const interval = setInterval(() => {
132 addOutput(`Erasing flash memory. Please wait...`)
133 }, 3000)
134
135 await espStub.eraseFlash()
136
137 clearInterval(interval)
138 addOutput(`Finished. Took ${Date.now() - stamp}ms to erase.`)
139 toast.update('erase', { render: 'Finished erasing memory.', type: toast.TYPE.INFO, autoClose: 3000 })
140 } catch (e) {
141 addOutput(`ERROR!\n${e}`)
142 toast.update('erase', { render: `ERROR!\n${e}`, type: toast.TYPE.ERROR, autoClose: 3000 })
143 console.error(e)
144 } finally {
145 setFlashing(false)
146 }
147 }
148
149 // Flash Firmware
150 const program = async () => {

Callers

nothing calls this directly

Calls 1

addOutputFunction · 0.85

Tested by

no test coverage detected