Particle function call data - last byte missing

Hello,
I have setup a particle function in my code. When I trigger particle function call like

particle function call lampname myfunc hello

The data I get on particle is hell. The last byte is missing always. I am printing the value received in the particle function directly. Any ideas?

Thanks
Dheeraj

Rather curious…it works for me.

Code:

int myfunc(String infoRcvd) {

  Serial.println(infoRcvd);
  return 1;
}

void setup() {
  Serial.begin(9600);
  Particle.function("myfunc", myfunc);
}

void loop() {

}

Result from particle function:

$ particle function call testPhoton myfunc hello
1

Result from Serial:

$ particle serial monitor --follow
Polling for available serial device...
Opening serial monitor for com port: "/dev/cu.usbmodem1411"
Serial monitor opened successfully:
hello
1 Like

Showing your firmware code (at least the function) may be good :sunglasses:

My bad. I should have posted the code,

Here is my particle function

int setValue(
        const char * value )
{ 
    Serial.printf("value: %s\n", value);
    return 0;
}

Prints with last byte missing

Particle.function() callbacks do not take a const char* parameter.
https://docs.particle.io/reference/firmware/photon/#particle-function-

2 Likes