@libs-scripts-mep/grav-fw-pvi 2.2.1 → 2.3.1
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.
- package/grav-fw-pvi.js +14 -8
- package/package.json +1 -1
package/grav-fw-pvi.js
CHANGED
|
@@ -10,6 +10,12 @@ class GravaFW {
|
|
|
10
10
|
|
|
11
11
|
return new Promise(async (resolve) => {
|
|
12
12
|
|
|
13
|
+
let validationMsg = ``
|
|
14
|
+
|
|
15
|
+
if (dirFirm != null && dirOpt != null) { validationMsg = `Verify OPTION BYTE succeeds` }
|
|
16
|
+
else if (dirFirm != null) { validationMsg = `Verifying PROGRAM MEMORY succeeds` }
|
|
17
|
+
else if (dirOpt != null) { validationMsg = `Verify OPTION BYTE succeeds` }
|
|
18
|
+
|
|
13
19
|
let ObjWriteSTM8 = await defineWriteSTM8(dirFirm, dirOpt, objArguments)
|
|
14
20
|
|
|
15
21
|
let logGravacao = ""
|
|
@@ -23,7 +29,7 @@ class GravaFW {
|
|
|
23
29
|
|
|
24
30
|
if (param[0] != undefined) {
|
|
25
31
|
|
|
26
|
-
if (param[0].includes(
|
|
32
|
+
if (param[0].includes(validationMsg)) {
|
|
27
33
|
|
|
28
34
|
PVI.FWLink.globalDaqMessagesObservers.remove(id)
|
|
29
35
|
clearTimeout(timeOutGravacao)
|
|
@@ -42,7 +48,7 @@ class GravaFW {
|
|
|
42
48
|
PVI.FWLink.globalDaqMessagesObservers.remove(id)
|
|
43
49
|
clearTimeout(timeOutGravacao)
|
|
44
50
|
|
|
45
|
-
resolve({ sucess: null, msg: `Não foi possível
|
|
51
|
+
resolve({ sucess: null, msg: `Não foi possível realizar a gravação` })
|
|
46
52
|
|
|
47
53
|
}
|
|
48
54
|
|
|
@@ -99,7 +105,7 @@ class GravaFW {
|
|
|
99
105
|
const Device = objArguments.Device != undefined ? `-Device=${objArguments.Device}` : ""
|
|
100
106
|
const NbTools = objArguments.NbTools != undefined ? `-NbTools=${objArguments.NbTools} ` : "-NbTools=1 "
|
|
101
107
|
const Tool_ID = objArguments.Tool_ID != undefined ? `-Tool_ID=${objArguments.Tool_ID} ` : "-Tool_ID=0 "
|
|
102
|
-
const BoardName = objArguments.BoardName != undefined ? `-BoardName=${objArguments.BoardName} ` : "-BoardName=ST-LINK "
|
|
108
|
+
const BoardName = objArguments.BoardName != undefined ? `-BoardName=${objArguments.BoardName} ` : "-BoardName=ST-LINK "
|
|
103
109
|
|
|
104
110
|
const FileData = objArguments.FileData != undefined ? `-FileOption=${objArguments.FileData} ` : ""
|
|
105
111
|
const FileProg = dirFirm != null ? `-FileProg=${dirFirm.replace(/[\\]/g, `\/`).replace(/\.stp|\.STP/, `.HEX`)} ` : ""
|
|
@@ -233,13 +239,13 @@ class GravaFW {
|
|
|
233
239
|
* @param {boolean} isBatFile true = firmware esta em .bat / false = firmware esta em .bin
|
|
234
240
|
* @param {number} betweenMsgTimeout timeout maximo para inatividade na comunicação com o ESP32
|
|
235
241
|
*/
|
|
236
|
-
static async ESP32(sessionStorageTag,
|
|
242
|
+
static async ESP32(sessionStorageTag, AddressFilePath, isBatFile, betweenMsgTimeout) {
|
|
237
243
|
|
|
238
244
|
return new Promise((resolve) => {
|
|
239
245
|
|
|
240
246
|
console.time("WriteFirmware")
|
|
241
247
|
|
|
242
|
-
if (!
|
|
248
|
+
if (!AddressFilePath) {
|
|
243
249
|
resolve({ sucess: false, msg: "Caminho de arquivo para gravação não especificado" }); return
|
|
244
250
|
}
|
|
245
251
|
|
|
@@ -296,11 +302,11 @@ class GravaFW {
|
|
|
296
302
|
|
|
297
303
|
sessionStorage.getItem(sessionStorageTag) != null ? port = `-p${sessionStorage.getItem(sessionStorageTag)}` : null
|
|
298
304
|
|
|
299
|
-
const args = `${espToolPath} ${port} -b 480600 --before default_reset --after hard_reset --chip esp32 write_flash --flash_mode dio --flash_size detect --flash_freq 40m
|
|
305
|
+
const args = `${espToolPath} ${port} -b 480600 --before default_reset --after hard_reset --chip esp32 write_flash --flash_mode dio --flash_size detect --flash_freq 40m ${AddressFilePath}`
|
|
300
306
|
|
|
301
307
|
if (isBatFile) {
|
|
302
|
-
console.log(`Executando batch: ${
|
|
303
|
-
pvi.runInstructionS("EXEC", [
|
|
308
|
+
console.log(`Executando batch: ${AddressFilePath} args: ${port}`)
|
|
309
|
+
pvi.runInstructionS("EXEC", [AddressFilePath, port, "true", "true", "true"])
|
|
304
310
|
} else {
|
|
305
311
|
console.log(`Executando python: ${pythonPath} args: ${args}`)
|
|
306
312
|
pvi.runInstructionS("EXEC", [pythonPath, args, "true", "true", "true"])
|