xreef / LoRa_E32_Series_Library

Arduino LoRa EBYTE E32 device library complete and tested with Arduino, esp8266, esp32, STM32 and Raspberry Pi Pico (rp2040 boards). sx1278/sx1276
https://www.mischianti.org
Other
352 stars 72 forks source link

Re-transmitting problem #10

Closed mrekin closed 4 years ago

mrekin commented 4 years ago

Hi! I'm not familiar with esp8266 and this might be not a problem. I'm trying to realize such code (just to test modules and communication distance)

// If something available
  if (e32ttl100.available() > 1) {
    // read the String message
    ResponseContainer rc = e32ttl100.receiveMessage();
    // Is something goes wrong print error
    if (rc.status.code != 1) {
      Serial.println(rc.status.getResponseDescription());
    } else {
      // Print the data received
      Serial.println("Recieved: ");
      Serial.println(rc.data);
      ResponseStatus rs = e32ttl100.sendMessage(strcat("Resending: ", rc.data.c_str()));

    }
  }

and some thing wrong with rc.data - it contains old messages (looks like some buffer not cleans after reading). Is it my code problem or something else ? Wemos D1 mini + E32-433T20D, normal mode (M0 and M1 set to GND)

xreef commented 4 years ago

Hi, sorry if I response you only now

the usage of strcat create issue, you are going to add on a memory destination without remove It. Try this

// If something available
if (e32ttl100.available() > 1) {
    // read the String message
    ResponseContainer rc = e32ttl100.receiveMessage();
    // Is something goes wrong print error
    if (rc.status.code != 1) {
        Serial.println(rc.status.getResponseDescription());
    } else {
        // Print the data received
        Serial.println("Recieved: ");
        Serial.println(rc.data);
        ResponseStatus rs = e32ttl100.sendMessage("Receiving: " + rc.data);

    }
}

Give me a feedback. Bye Renzo

mrekin commented 4 years ago

Thanks for reply with right direction). Problem was in "sender" device with input buffer.