Hi - the code looks good, but can you try E.getAddressOf(rx, true); - to require a flat string?
My guess is it'll then error with RX not a flat string, in which case you need to add rx = E.toString(rx) at the start to make it 'flat'.
I believe it's because rx that is passed to the function may not be flat (by default fragmented strings, which are faster to allocate, are used). For stuff like this, trace(rx) might help to give you some clues to the actual variable type.
Espruino is a JavaScript interpreter for low-power Microcontrollers. This site is both a support community for Espruino and a place to share what you are working on.
Hi - the code looks good, but can you try
E.getAddressOf(rx, true);
- to require a flat string?My guess is it'll then error with
RX not a flat string
, in which case you need to addrx = E.toString(rx)
at the start to make it 'flat'.I believe it's because
rx
that is passed to the function may not beflat
(by default fragmented strings, which are faster to allocate, are used). For stuff like this,trace(rx)
might help to give you some clues to the actual variable type.