-
• #2
\x20 is unneccessary escaping, because it's a normal space, hence doesn't need an escape.
Ascii code 0x20 (32) is space.
-
• #3
Great catch! I haven't looked at it from that angle.
However, I'm using escape sequences like the one above to include parts (2 to 32 bytes) of a binary protocol . They are sent out on the serial interface.
Replacing all printable characters in the sequence would be cumbersome and error prone. Can such warnings be disabled?
-
• #4
I'm afraid they can only be disabled by tweaking the IDE's code at the moment... I guess maybe a more readable (if marginally less efficient) way of writing it might be:
String.fromCharCode(0x10,0x20,0x10)
But it depends where you're sending the data. If it's down SPI/I2C then you can just send an array of values rather than a string. You can even do it with the Serial ports using
write
:Serial1.write([0x10,0x20,0x10])
-
• #5
The alternative forms look nice! Thank your for the suggestion.
Hi
I'm assembling a string of special characters e.g.:
While it works flawlessly on the Espruino the IDE marks \x20 as unnecessary escapement. Note, \x10 is not marked. I assume its a bug in the IDE?