Forum >Bluno iOS write 'buffer'
Bluno iOS write 'buffer'

I want to update some variables on the Bluno from iOS but writes seem to build up in a buffer and drain slowly.
Here I'm sending the value from a UISlider, as a 4 byte packet, but only after checking bReadyToWrite.
If I change the UISlider, TX/RX will flash for a few seconds after as the 'buffer' empties making update very unresponsive.
[code]- (IBAction)speedChanged:(UISlider *)sender {
if (self.blunoDevice.bReadyToWrite)
{
short int value = (sender.value - 0.5f) * 65535;
NSData *dataPacket = [self dataPacketWithTag:TAG_SPEED value:value];
[self.blunoManager writeDataToDevice:dataPacket Device:self.blunoDevice];
}
}[/code]
[code]void loop()
{
if (Serial.available() >= PACKET_SIZE) {
if (Serial.read() == HEADER) { // 1st byte
char tag = Serial.read(); // 2nd byte
if(tag == TAG_SPEED)
{
val = Serial.read() << 8 ; // 3rd Byte - data MSB
val += Serial.read(); // 4th Byte - data LSB
Serial.print("Speed:"); // Hundreds of these coming through very slowly.
Serial.print(val);
Serial.print("\n");
}
}
}
}[/code]
Can I speed this up somehow? Or at least find out when Bluno is REALLY ready for another write?
Here I'm sending the value from a UISlider, as a 4 byte packet, but only after checking bReadyToWrite.
If I change the UISlider, TX/RX will flash for a few seconds after as the 'buffer' empties making update very unresponsive.
[code]- (IBAction)speedChanged:(UISlider *)sender {
if (self.blunoDevice.bReadyToWrite)
{
short int value = (sender.value - 0.5f) * 65535;
NSData *dataPacket = [self dataPacketWithTag:TAG_SPEED value:value];
[self.blunoManager writeDataToDevice:dataPacket Device:self.blunoDevice];
}
}[/code]
[code]void loop()
{
if (Serial.available() >= PACKET_SIZE) {
if (Serial.read() == HEADER) { // 1st byte
char tag = Serial.read(); // 2nd byte
if(tag == TAG_SPEED)
{
val = Serial.read() << 8 ; // 3rd Byte - data MSB
val += Serial.read(); // 4th Byte - data LSB
Serial.print("Speed:"); // Hundreds of these coming through very slowly.
Serial.print(val);
Serial.print("\n");
}
}
}
}[/code]
Can I speed this up somehow? Or at least find out when Bluno is REALLY ready for another write?