@libs-scripts-mep/grav-fw-pvi 1.2.0 → 1.3.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.
- package/grav-fw-pvi.js +26 -31
- package/package.json +1 -1
package/grav-fw-pvi.js
CHANGED
|
@@ -139,45 +139,40 @@ class GravaFW {
|
|
|
139
139
|
static Renesas(dirProject = null, callback = () => { }, timeOut = 5000) {
|
|
140
140
|
|
|
141
141
|
if (dirProject != null) {
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
console.log(`%cLog Program:\n\n${result}`, ' color: #00EE66')
|
|
155
|
-
callback(true, result)
|
|
156
|
-
|
|
157
|
-
} else if (result.includes(`Cannot find the specified tool.`)) {
|
|
158
|
-
|
|
159
|
-
console.log(`%cLog Program:\n\n${result}`, ' color: #EE0033')
|
|
142
|
+
const eventObserverId = pvi.FWLink.globalDaqMessagesObservers.add((msg, [renesasOutLog]) => {
|
|
143
|
+
console.log(`%cLog Program: ${renesasOutLog}`, ' color: #B0E0E6')
|
|
144
|
+
|
|
145
|
+
if (renesasOutLog != undefined) {
|
|
146
|
+
if (renesasOutLog.includes(`Operation completed.`)) {
|
|
147
|
+
pvi.FWLink.globalDaqMessagesObservers.remove(eventObserverId)
|
|
148
|
+
clearTimeout(timeoutGravacao)
|
|
149
|
+
callback(true, `Gravação bem-sucedida: ${dirProject}`)
|
|
150
|
+
} else if (renesasOutLog.includes(`Cannot find the specified tool.`)) {
|
|
151
|
+
pvi.FWLink.globalDaqMessagesObservers.remove(eventObserverId)
|
|
152
|
+
clearTimeout(timeoutGravacao)
|
|
160
153
|
callback(null, `Gravador não respondeu`)
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
console.log(`%cLog Program:\n\n${result}`, ' color: #EE0033')
|
|
154
|
+
} else if (renesasOutLog.includes(`Error: No project file specifed.`)) {
|
|
155
|
+
pvi.FWLink.globalDaqMessagesObservers.remove(eventObserverId)
|
|
156
|
+
clearTimeout(timeoutGravacao)
|
|
165
157
|
callback(false, `Projeto informado é inválido`)
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
158
|
+
} else if (renesasOutLog.includes(`The device is not responding.`)) {
|
|
159
|
+
pvi.FWLink.globalDaqMessagesObservers.remove(eventObserverId)
|
|
160
|
+
clearTimeout(timeoutGravacao)
|
|
161
|
+
callback(false, `Sem resposta do microcontrolador`)
|
|
162
|
+
} else if (renesasOutLog.includes(`A framing error occurred while receiving data`)) {
|
|
163
|
+
pvi.FWLink.globalDaqMessagesObservers.remove(eventObserverId)
|
|
164
|
+
clearTimeout(timeoutGravacao)
|
|
165
|
+
callback(false, `Falha ao receber dados do microcontrolador`)
|
|
172
166
|
}
|
|
173
167
|
}
|
|
174
|
-
},
|
|
168
|
+
}, "sniffer.exec")
|
|
175
169
|
|
|
176
|
-
let
|
|
177
|
-
|
|
170
|
+
let timeoutGravacao = setTimeout(() => {
|
|
171
|
+
pvi.FWLink.globalDaqMessagesObservers.remove(eventObserverId)
|
|
178
172
|
callback(false, `Tempo de gravação excedido`)
|
|
179
173
|
}, timeOut)
|
|
180
174
|
|
|
175
|
+
pvi.runInstructionS("EXEC", [`${pvi.runInstructionS("GETRESOURCESPATH", [])}/Renesas/RFPV3.Console.exe`, dirProject, "true", "true"])
|
|
181
176
|
} else {
|
|
182
177
|
callback(false, `Caminho do firmware não informado`)
|
|
183
178
|
}
|