Bluetooth serial out using arduino for printing images faces an issue of data loss when wifi not connected.
Posted: Fri Jan 29, 2021 7:13 am
byte receivedBytes;
while(SerialBT.available()>0)
{
receivedBytes = SerialBT.read();
recBuff[Recv_count] = receivedBytes;
Recv_count++;
bluetooth_rx_complt = 1;
if(Recv_count == 8192)
{
recBuff[Recv_count] ='\0';
Serial.write((const uint8_t*)recBuff,/Recv_count);
Serial.flush();
Recv_count = 0;
memset(recBuff,0,sizeof(recBuff));
state = FREE;
}
}
if(bluetooth_rx_complt)
{
recBuff[Recv_count] ='\0';
data_Sout_count = Recv_count;
Recv_count = 0;
bluetooth_rx_complt = 0;
Serial.write((const uint8_t*)recBuff,data_Sout_count);
return 1;
}
return 0;
Can it possible to serial out( Serial.write() ) when a large data is coming to the receiver queue of Bluetooth. I actually declared the Bluetooth queue as 27200(in bytes) now. I printed images with some play store applications successfully, but when large images comes it could only print almost 80 or 90% of original images when wifi(STA) is in disconnected stage.Is any one have suggestion over this issue?
I send 500kb text file through RAW Bt apk from playstore but it prints almost 300kb not full data.
while(SerialBT.available()>0)
{
receivedBytes = SerialBT.read();
recBuff[Recv_count] = receivedBytes;
Recv_count++;
bluetooth_rx_complt = 1;
if(Recv_count == 8192)
{
recBuff[Recv_count] ='\0';
Serial.write((const uint8_t*)recBuff,/Recv_count);
Serial.flush();
Recv_count = 0;
memset(recBuff,0,sizeof(recBuff));
state = FREE;
}
}
if(bluetooth_rx_complt)
{
recBuff[Recv_count] ='\0';
data_Sout_count = Recv_count;
Recv_count = 0;
bluetooth_rx_complt = 0;
Serial.write((const uint8_t*)recBuff,data_Sout_count);
return 1;
}
return 0;
Can it possible to serial out( Serial.write() ) when a large data is coming to the receiver queue of Bluetooth. I actually declared the Bluetooth queue as 27200(in bytes) now. I printed images with some play store applications successfully, but when large images comes it could only print almost 80 or 90% of original images when wifi(STA) is in disconnected stage.Is any one have suggestion over this issue?
I send 500kb text file through RAW Bt apk from playstore but it prints almost 300kb not full data.