escape sequence for special hex values #4656
Replies: 1 comment
-
Posted at 2015-05-03 by DrAzzy \x20 is unneccessary escaping, because it's a normal space, hence doesn't need an escape. Ascii code 0x20 (32) is space. Posted at 2015-05-03 by AntiCat 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? Posted at 2015-05-05 by @gfwilliams 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:
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
Posted at 2015-05-07 by AntiCat The alternative forms look nice! Thank your for the suggestion. |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
Posted at 2015-05-02 by AntiCat
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?
Beta Was this translation helpful? Give feedback.
All reactions