Operation replace list item cannot accept the arguments

I got through the previous posted issues regarding this topic without any success.
My app sends $RCAN commands via terminal BT connection to an external device and get back text lines like shown above this error message ($RCAN,188,...,OK), reading the cell voltages of a 14s li battery pack.
grafik
There are four such messages (8/8/8/4 data bytes), called with a startCell value, a "Zeiger" is calculated to point to the corresponding list item.
The block firing this error message calculates values from hex coded long voltages (battery back) and store them in a 14 items static list.


I cannot see any fault.
The commands are fired in sequence and strings are read back. With the BT.stringsReceived event the buggy block is called with the corresponding startCell value. In general, all four calls abort like shown.
If I click the btn_DEBUG, the DEBUG block sends four very similar test text strings to the block in sequence and finally calls the display task to the screen. Here, I get no faults at all if I start this on the beginning. But after I got the error message while processing real data, the debug call is faulty, too.

What's wrong with it? Maybe the strings coming back are delayed or in disorder, but this may drop some values without malform them. The shown values (as far as I understand, [0] for the actual list item value, [13] for the list index and [4.067] for the voltage value) are fine and predictable right.

I have no idea what is going wrong.

CellVoltages is 0 and index is 13...
The replace list item block expects a list to be able to replace items. . And that list should have minimum 13 items

use Do it to debug your blocks, see also tip 4 here App Inventor: How to Learn | Pura Vida Apps
see also Live Development, Testing, and Debugging Tools
Taifun


Trying to push the limits! Snippets, Tutorials and Extensions from Pura Vida Apps by icon24 Taifun.

I like the Make A List block for initializing lists. You can add extra sockets using the blue button. From what I can't see, you will need at least 13 sockets with default (0?) values for that global list variable.

Jay, that debug options I missed, THX. I'll have a look at it the next days.
Of course there's a static list declaration of "global CellVoltages" including 14 items, initialized with math zero. As stated, my "debug" option (simulating 4 received strings) works and would not if I hadn't a proper initialized list?
The <15 comparison is to prevent to access non-existing items on the list same as to prevent errors, because the last "188" answer has only 6 bytes of data; the ugly way.
btw some label.text statements are for diagnostics only

(Canned Reply: ABG- Export & Upload .aia)
Export your .aia file and upload it here.

export_and_upload_aia

.

thx, I know the procedure. I am thinking about to share the whole project, because it's not mine :-). but consider this the next days.

By now, the question is more how to debug this error myself (rather seldom, I think).

"Do it" is offered only in call statements? Cannot find it elsewhere.

btw if someone have an idea how to setup the MIT AI to start always in English to get rid of the German translations like "mache" (do), "kürze" (trim), ...

1 Like

You can use Do it on all blocks

Try to set the language to English

Taifun

Unlike it is shown in articles and tutorials, Do it appears only in right click menus on "call" statements, nowhere else. Checked Chrome and Firefox in both German and English...
?
And setting language to English lasts for the actual session only, I did hope this setting is stored anywhere, cookies are allowed on this site. Next start is German.
Maybe its simple a thing of my location. Setting the whole browser language may help (didnt check this yet), but this is not useful for other sites.
Maybe a separate Chrome profil can help.

You are mistaken:

a couple of examples

image

image

are you running the companion app when you test ?

Somehow I got it finally (I think). "Do it" now appears only on real executable statements and is greyed out if the companion isn't running.

Many thanks for all help and hints. Further development is now stopped - the scooter I try to correspond with is now out of function due to a massive electronic failure, and I am not sure if I want to bring it back to life at all.
So, do not stay tuned here ... :frowning:

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.