Skip to content

ESP8266 gateway crashes when configuration reply received from child node #343

Closed
@mitchmitchell

Description

I am testing sending a configuration message to a subordinate node of my ESP8266 gateway device to setIsMetric to one and back to zero. The gateway device handles the message sent to it fine and relays it to the subordinate HyTiny which successfully changes its mode to metric and back as expected. However when the gateway receives the reply message from the HyTiny board it crashes. The message the HyTiny sends is:

SEND D=0 I=200 C=0 T=48 S= I=0 F=0.00
1240480 TSF:MSG:SEND,102-102-0-0,s=200,c=1,t=48,pt=5,l=4,sg=0,ft=0,st=OK:22

When the gateway receives this message it crashes in the call to strtok_r at line or near line 191 at the statement below because at that point the value of the pointer string is zero.

_child_id = atoi(strtok_r(const_cast<char*>(string), ",", &ptr));

This is in the function:

// contructor, tokenize a request in the format "child_id,function,value"
Request::Request(int recipient_child_id, const char* string) {

I'm afraid I don't have much to add at this point, I only just realized the crash was happening on the reply from the HyTiny rather than on the message to the gateway from the controller.

I will look further into the code to try and understand how the reply is getting constructed.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions