Commit Diff


commit - 57d0d88199e0a78e3882bfe944f85e0d76d97c3a
commit + e7d90f974045001043e2aa0741f19aceac52e6ff
blob - 8f8f5ce9e6aba78afae7e8fee28a5ccf16b0b479
blob + ca2042ff7c5d30a846a792812497f0d1790a58eb
--- src/main.rs
+++ src/main.rs
@@ -6,7 +6,11 @@ use ble_esp32c3::gatt::*;
 use once_cell::sync::Lazy;
 
 // maximum buffer size allowed (ATT_DATA = ATT_MAX_SIZE - ATT_HEADER_SIZE = 517 - 5 = 512)
-const BUFFER_LEN: usize = 512;
+// NOTE: 512 is the maximum amount of data able to be transmitted with one command, but this gets
+// split up into three packets of sizes 251, 251, and 17 bytes. With this, 234 bytes of potential
+// data per packet are lost every three packets, limiting the amount of data sent per time interval.
+// in order to maximise this throughput, at max 512 - 17 = 495 bytes are being sent per command.
+const BUFFER_LEN: usize = 495;
 
 const SERVICE_UUID: [u8; 16] = 0x061f8f7050293e727e62a46aa61cda68u128.to_le_bytes();
 const BUFFER_READY_UUID: [u8; 16] = 0x78844add576bb4cd3c40f1f3d536a38au128.to_le_bytes();