adrien3d / IO_WSSFM10-Arduino

Arduino library for the WSSFM10 Sigfox Module
https://plugblocks.com
MIT License
6 stars 8 forks source link

issue sendReceive #16

Closed anorna closed 3 years ago

anorna commented 3 years ago

When I use this command:

bool statusSR = mySigfox.sendReceive(&p, sizeof(p), valor_recibido);

I get this response

image

But program gets frozen at this point when sigfox backend is ok

image

Same hapen using sendReceiveString

every try I did happens the same

anorna commented 3 years ago

uplink mode runs perfect

image

anorna commented 3 years ago

I fixed de issue, now this function works as I need:

String IO_WSSFM10::sendReceive(const void data, uint8_t size, String response){ uint8_t bytes = (uint8_t*)data; Sigfox.print("AT$SF="); char tmp[3] = {0}; // 2 hex characters + null terminator if(debug){ Serial.print("Bytes:"); } for(uint8_t i= 0; i<size; ++i){ sprintf(tmp, "%02X", bytes[i]); Sigfox.print(tmp); if(debug){ Serial.print(tmp); } } if(debug){ Serial.println(); }

Sigfox.print(",1\r");

while (!Sigfox.available()){
    blink();
}

String res = getData();
response =res 
        ;
if(res.indexOf("OK") >= 0) {
    Serial.println("Message successfully sent");
    Serial.println(res);
    return res;
}

if(debug){
    Serial.print("Status: ");
    Serial.println(res);
}
return "false";

}