I tracked down the error and found out this:
When I call one of the callback functions in on_message, the photon blinks red (hard fault).
When I comment them out, everything works.
Also, calling other functions on the object (like getUUID) work.
What am I doing wrong and why doesn’t the compiler see it?
void Bremo::on_message(char* topic, uint8_t* payload, unsigned int length) //char* topic, byte* payload, unsigned int length // TODO ?
{
//TODO switch case topic
//on_session(); // ERROR HERE
//on_phase(); // ERROR HERE
//on_stop(); // ERROR HERE
Serial.println(getUUID()); // THIS WORKS (NO ERROR) //TODO remove (just for test)
}
@kenvernaillen, it all depends on what on_session(), on_phase() and on_stop() do! You could be killing the stack or dividing by zero or a creating a recursive loop. It would help if you posted the code for those.
@kenvernaillen, the pre-processor maybe doing weird voodoo here. The functions in question are declared after the construction of the Instance object. This would explain why the class function getUUID works but not the others. I suggest putting those function declarations before the instantiation to see if that helps.