Now I'm in some deep water here, as a totally beginner in Java Script...
I have copied the code for the input dialog from the script "Dlog start" and modified it for my purpurs.
It went quite well, but suddenly, and for me without any obvious reason, the script stopped to work.
After some frustrating, testing, more frustrating and testing (without knowing what I'm doing or what the error messages means...) it turns out that it works just fine if I just change the name for the storage.getItem!
My best guess is that it is an array that has been messed up some way.
I'm using the EEZ PSU software simulator ver. v1.1 as instrument by the way.
Can someone bring some light over my confusion here...?
The original lines in Dlog start
var defaultValues = storage.getItem("EezDlogValues", {
...
storage.setItem("EezDlogValues", values);
My lines that not working anymore
var defaultValues = storage.getItem("LiPoChargeValues", {
...
storage.setItem("LiPoChargeValues", values);
If I just change the name, the code works...
var defaultValues = storage.getItem("LiPoChargeValuesX", {
...
storage.setItem("LiPoChargeValuesX", values);
The console give me this messages then I try to run the script, but I'm afraid that I'm not able to understand much of it...
Uncaught TypeError: Cannot read property 'toFixed' of undefined
at Object.roundNumber (C:\Program Files\EEZ Studio\resources\app.asar\dist\eez-studio-shared\roundNumber.js:11)
at TimeUnit.formatValue (C:\Program Files\EEZ Studio\resources\app.asar\dist\eez-studio-shared\units.js:19)
at TimeUnit.formatValue (C:\Program Files\EEZ Studio\resources\app.asar\dist\eez-studio-shared\units.js:116)
at GenericDialog.props.dialogDefinition.fields.forEach.fieldProperties (C:\Program Files\EEZ Studio\resources\app.asar\dist\eez-studio-ui\generic-dialog.js:49)
at Array.forEach (<anonymous>)
at new GenericDialog (C:\Program Files\EEZ Studio\resources\app.asar\dist\eez-studio-ui\generic-dialog.js:47)
at zf (C:\Program Files\EEZ Studio\resources\app.asar\node_modules\react-dom\cjs\react-dom.production.min.js:127)
at Wg (C:\Program Files\EEZ Studio\resources\app.asar\node_modules\react-dom\cjs\react-dom.production.min.js:163)
at ah (C:\Program Files\EEZ Studio\resources\app.asar\node_modules\react-dom\cjs\react-dom.production.min.js:176)
at hi (C:\Program Files\EEZ Studio\resources\app.asar\node_modules\react-dom\cjs\react-dom.production.min.js:221)
roundNumber @ C:\Program Files\EEZ Studio\resources\app.asar\dist\eez-studio-shared\roundNumber.js:11
formatValue @ C:\Program Files\EEZ Studio\resources\app.asar\dist\eez-studio-shared\units.js:19
formatValue @ C:\Program Files\EEZ Studio\resources\app.asar\dist\eez-studio-shared\units.js:116
GenericDialog.props.dialogDefinition.fields.forEach.fieldProperties @ C:\Program Files\EEZ Studio\resources\app.asar\dist\eez-studio-ui\generic-dialog.js:49
GenericDialog @ C:\Program Files\EEZ Studio\resources\app.asar\dist\eez-studio-ui\generic-dialog.js:47
zf @ C:\Program Files\EEZ Studio\resources\app.asar\node_modules\react-dom\cjs\react-dom.production.min.js:127
Wg @ C:\Program Files\EEZ Studio\resources\app.asar\node_modules\react-dom\cjs\react-dom.production.min.js:163
ah @ C:\Program Files\EEZ Studio\resources\app.asar\node_modules\react-dom\cjs\react-dom.production.min.js:176
hi @ C:\Program Files\EEZ Studio\resources\app.asar\node_modules\react-dom\cjs\react-dom.production.min.js:221
ii @ C:\Program Files\EEZ Studio\resources\app.asar\node_modules\react-dom\cjs\react-dom.production.min.js:222
Ki @ C:\Program Files\EEZ Studio\resources\app.asar\node_modules\react-dom\cjs\react-dom.production.min.js:238
fi @ C:\Program Files\EEZ Studio\resources\app.asar\node_modules\react-dom\cjs\react-dom.production.min.js:234
uf @ C:\Program Files\EEZ Studio\resources\app.asar\node_modules\react-dom\cjs\react-dom.production.min.js:232
Si @ C:\Program Files\EEZ Studio\resources\app.asar\node_modules\react-dom\cjs\react-dom.production.min.js:252
Ti @ C:\Program Files\EEZ Studio\resources\app.asar\node_modules\react-dom\cjs\react-dom.production.min.js:252
Yi.render @ C:\Program Files\EEZ Studio\resources\app.asar\node_modules\react-dom\cjs\react-dom.production.min.js:260
(anonymous) @ C:\Program Files\EEZ Studio\resources\app.asar\node_modules\react-dom\cjs\react-dom.production.min.js:263
Qi @ C:\Program Files\EEZ Studio\resources\app.asar\node_modules\react-dom\cjs\react-dom.production.min.js:249
aj @ C:\Program Files\EEZ Studio\resources\app.asar\node_modules\react-dom\cjs\react-dom.production.min.js:263
render @ C:\Program Files\EEZ Studio\resources\app.asar\node_modules\react-dom\cjs\react-dom.production.min.js:265
showDialog @ C:\Program Files\EEZ Studio\resources\app.asar\dist\eez-studio-ui\dialog.js:125
Promise @ C:\Program Files\EEZ Studio\resources\app.asar\dist\eez-studio-ui\generic-dialog.js:260
showGenericDialog @ C:\Program Files\EEZ Studio\resources\app.asar\dist\eez-studio-ui\generic-dialog.js:259
resolve @ C:\Program Files\EEZ Studio\resources\app.asar\dist\instrument\window\script.js:23
input @ C:\Program Files\EEZ Studio\resources\app.asar\dist\instrument\window\script.js:22
(anonymous) @ VM536:16
(anonymous) @ C:\Program Files\EEZ Studio\resources\app.asar\dist\eez-studio-shared\script-engines\javascript.js:20
(anonymous) @ C:\Program Files\EEZ Studio\resources\app.asar\dist\eez-studio-shared\script-engines\javascript.js:7
__awaiter @ C:\Program Files\EEZ Studio\resources\app.asar\dist\eez-studio-shared\script-engines\javascript.js:3
run @ C:\Program Files\EEZ Studio\resources\app.asar\dist\eez-studio-shared\script-engines\javascript.js:12
doExecuteShortcut @ C:\Program Files\EEZ Studio\resources\app.asar\dist\instrument\window\script.js:224
executeShortcut @ C:\Program Files\EEZ Studio\resources\app.asar\dist\instrument\window\script.js:253
executeShortcut @ C:\Program Files\EEZ Studio\resources\app.asar\dist\instrument\window\terminal\terminal.js:257
executeShortcut @ C:\Program Files\EEZ Studio\resources\app.asar\dist\instrument\window\terminal\toolbar.js:76
onClick @ C:\Program Files\EEZ Studio\resources\app.asar\dist\eez-studio-ui\action.js:26
da @ C:\Program Files\EEZ Studio\resources\app.asar\node_modules\react-dom\cjs\react-dom.production.min.js:14
ka @ C:\Program Files\EEZ Studio\resources\app.asar\node_modules\react-dom\cjs\react-dom.production.min.js:15
la @ C:\Program Files\EEZ Studio\resources\app.asar\node_modules\react-dom\cjs\react-dom.production.min.js:15
ya @ C:\Program Files\EEZ Studio\resources\app.asar\node_modules\react-dom\cjs\react-dom.production.min.js:17
Ca @ C:\Program Files\EEZ Studio\resources\app.asar\node_modules\react-dom\cjs\react-dom.production.min.js:18
Aa @ C:\Program Files\EEZ Studio\resources\app.asar\node_modules\react-dom\cjs\react-dom.production.min.js:18
Fa @ C:\Program Files\EEZ Studio\resources\app.asar\node_modules\react-dom\cjs\react-dom.production.min.js:21
Gd @ C:\Program Files\EEZ Studio\resources\app.asar\node_modules\react-dom\cjs\react-dom.production.min.js:84
Pi @ C:\Program Files\EEZ Studio\resources\app.asar\node_modules\react-dom\cjs\react-dom.production.min.js:249
Nb @ C:\Program Files\EEZ Studio\resources\app.asar\node_modules\react-dom\cjs\react-dom.production.min.js:39
Jd @ C:\Program Files\EEZ Studio\resources\app.asar\node_modules\react-dom\cjs\react-dom.production.min.js:86
Ri @ C:\Program Files\EEZ Studio\resources\app.asar\node_modules\react-dom\cjs\react-dom.production.min.js:250
Id @ C:\Program Files\EEZ Studio\resources\app.asar\node_modules\react-dom\cjs\react-dom.production.min.js:85
I don't know if this means anything, but sometimes then I just scrolling in the code the console spits out a burst of messages like this.
Uncaught TypeError: Failed to execute 'removeChild' on 'Node': parameter 1 is not of type 'Node'.
at a.scrollLines (index.min.js:1)
at p.$renderChanges (index.min.js:1)
at index.min.js:1
scrollLines @ index.min.js:1
$renderChanges @ index.min.js:1
(anonymous) @ index.min.js:1
requestAnimationFrame (async)
schedule @ index.min.js:1
scrollToY @ index.min.js:1
onScrollTopChange @ index.min.js:1
n._signal @ index.min.js:1
setScrollTop @ index.min.js:1
$computeLayerConfig @ index.min.js:1
$renderChanges @ index.min.js:1
(anonymous) @ index.min.js:1
requestAnimationFrame (async)
schedule @ index.min.js:1
scrollToY @ index.min.js:1
onScrollTopChange @ index.min.js:1
n._signal @ index.min.js:1
setScrollTop @ index.min.js:1
scrollBy @ index.min.js:1
onMouseWheel @ index.min.js:1
n._emit.n._dispatchEvent @ index.min.js:1
onMouseWheel @ index.min.js:1
(anonymous) @ index.min.js:1