@libs-scripts-mep/grav-fw-pvi 3.0.0 → 3.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. package/grav-fw-pvi.js +18 -11
  2. package/package.json +1 -1
package/grav-fw-pvi.js CHANGED
@@ -52,21 +52,21 @@ export default class GravaFW {
52
52
  FWLink.PVIEventObserver.remove(id)
53
53
  clearTimeout(timeOutGravacao)
54
54
 
55
- resolve({ success: true, msg: logGravacao })
55
+ resolve({ success: true, msg: "Gravação bem sucedida", dirFirm: dirFirm })
56
56
 
57
57
  } else if (param[0].includes(`ERROR : Cannot communicate with the tool`)) {
58
58
 
59
59
  FWLink.PVIEventObserver.remove(id)
60
60
  clearTimeout(timeOutGravacao)
61
61
 
62
- resolve({ success: null, msg: `Gravador não respondeu` })
62
+ resolve({ success: null, msg: `Gravador não respondeu`, dirFirm: dirFirm })
63
63
 
64
64
  } else if (param[0].includes(`(API) ERROR`)) {
65
65
 
66
66
  FWLink.PVIEventObserver.remove(id)
67
67
  clearTimeout(timeOutGravacao)
68
68
 
69
- resolve({ success: null, msg: `Não foi possível realizar a gravação` })
69
+ resolve({ success: null, msg: `Não foi possível realizar a gravação`, dirFirm: dirFirm })
70
70
 
71
71
  }
72
72
 
@@ -180,21 +180,28 @@ export default class GravaFW {
180
180
  FWLink.PVIEventObserver.remove(id)
181
181
  clearTimeout(timeOutGravacao)
182
182
 
183
- resolve({ success: true, msg: logGravacao })
183
+ resolve({ success: true, msg: "Gravação bem sucedida", dirProject: dirProject })
184
184
 
185
185
  } else if (param[0].includes(`Cannot find the specified tool.`)) {
186
186
 
187
187
  FWLink.PVIEventObserver.remove(id)
188
188
  clearTimeout(timeOutGravacao)
189
189
 
190
- resolve({ success: null, msg: `Gravador não respondeu` })
190
+ resolve({ success: false, msg: `Gravador não respondeu`, dirProject: dirProject })
191
191
 
192
192
  } else if (param[0].includes(`Error: No project file specifed.`)) {
193
193
 
194
194
  FWLink.PVIEventObserver.remove(id)
195
195
  clearTimeout(timeOutGravacao)
196
196
 
197
- resolve({ success: false, msg: `Projeto informado é inválido` })
197
+ resolve({ success: false, msg: `Projeto informado é inválido`, dirProject: dirProject })
198
+
199
+ } else if (param[0].includes(`A framing error occurred while receiving data`)) {
200
+
201
+ FWLink.PVIEventObserver.remove(id)
202
+ clearTimeout(timeOutGravacao)
203
+
204
+ resolve({ success: false, msg: `Falha ao receber dados do microcontrolador`, dirProject: dirProject })
198
205
 
199
206
  }
200
207
 
@@ -241,7 +248,7 @@ export default class GravaFW {
241
248
  if (logGravacao.includes(`O.K.`)) {
242
249
 
243
250
  clearTimeout(timeOutGravacao)
244
- resolve({ success: true, msg: `Gravado com successo, caminho: ${dirProject}` })
251
+ resolve({ success: true, msg: dirProject })
245
252
 
246
253
  } else if (logGravacao.includes(`Cannot connect to target.`)) {
247
254
 
@@ -288,7 +295,7 @@ export default class GravaFW {
288
295
  return new Promise((resolve) => {
289
296
 
290
297
  if (!AddressFilePath) {
291
- resolve({ success: false, msg: "Caminho de arquivo para gravação não especificado" }); return
298
+ resolve({ success: false, msg: "Caminho de arquivo para gravação não especificado", AddressFilePath: AddressFilePath }); return
292
299
  }
293
300
 
294
301
  let portsFound = null, tryingPorts = [], lastTimeMsg = new Date().getTime()
@@ -298,7 +305,7 @@ export default class GravaFW {
298
305
  if (new Date().getTime() - lastTimeMsg > betweenMsgTimeout) {
299
306
  clearInterval(betweenMsgMonitor)
300
307
  FWLink.PVIEventObserver.remove(id)
301
- resolve({ success: false, msg: "esptool.py encontrou um problema e teve que ser finalizado." }); return
308
+ resolve({ success: false, msg: "esptool.py encontrou um problema e teve que ser finalizado.", AddressFilePath: AddressFilePath }); return
302
309
  }
303
310
 
304
311
  }, 1000)
@@ -321,7 +328,7 @@ export default class GravaFW {
321
328
  } else if (info.includes("failed to connect")) {
322
329
  if (tryingPorts.length >= portsFound) {
323
330
  FWLink.PVIEventObserver.remove(id)
324
- resolve({ success: false, msg: "Gravador não conseguiu se conectar com o ESP32" }); return
331
+ resolve({ success: false, msg: "Gravador não conseguiu se conectar com o ESP32", AddressFilePath: AddressFilePath }); return
325
332
  }
326
333
 
327
334
  } else if (info.includes("%")) {
@@ -330,7 +337,7 @@ export default class GravaFW {
330
337
  } else if (info.includes("Hard resetting via RTS pin...")) {
331
338
  sessionStorage.getItem(sessionStorageTag) == null ? sessionStorage.setItem(sessionStorageTag, tryingPorts.pop()) : null
332
339
  FWLink.PVIEventObserver.remove(id)
333
- resolve({ success: true, msg: "Gravação bem sucedida" })
340
+ resolve({ success: true, msg: "Gravação bem sucedida", AddressFilePath: AddressFilePath })
334
341
  console.timeEnd("WriteFirmware")
335
342
  }
336
343
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@libs-scripts-mep/grav-fw-pvi",
3
- "version": "3.0.0",
3
+ "version": "3.1.0",
4
4
  "description": "Auxilia na gravação de microcontroladores por linha de comando através do PVI",
5
5
  "main": "grav-fw-pvi.js",
6
6
  "scripts": {