Skip to content

sendString sending random characters #105

@jacobrosenthal

Description

@jacobrosenthal

Protocol 2.3

Using unmodified echostring example

I send "hi" to it from my host implementation, the actual bits that get sent in hex are
f0716800 6900f7

its supposed to echo back, and I get back f0716800 69000200f7

an extra 20, a space?

Sometimes a lot more characters

hi«xºœ�Ⱥ=iΩy◊Á<⁄�“w Pü˘�∂˚9‰yn+qÍΩ„<Ä~Sf¨V˚

This is the echostring write

void stringCallback(char *myString)
{
Firmata.sendString(mystring");
}

If I modify callback to send "hi" instead of the string it received
void stringCallback(char *myString)
{
Firmata.sendString("hi");
}

it sends correct data
f0716800 6900f7

If I alter the callback to print the size and bytes of the string it received
Serial.println(sizeof(myString));
for( int i = 0; i<sizeof(myString); i++)
{
Serial.print(*myString+i,HEX);
}

I get 2 characters, h and i in hex
2
6869

so sendString when sent a string is happy, but when sent a character is doing something odd

There it is:

sendSysex(command, strlen(string), (byte *)string);

Should be sizeof, which jives with working with strings, but not with character buffers like in the echo example.

Patch incoming

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions