From afc5d4332bb666c00a99146b43d0bb02a42e5e99 Mon Sep 17 00:00:00 2001 From: Antoine Doussaud Date: Sat, 10 Jun 2023 12:48:50 +0200 Subject: [PATCH] speed up ble + add gif timer --- src/main.cpp | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/src/main.cpp b/src/main.cpp index db8d7ae..de1f993 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -260,15 +260,21 @@ void set_all_pixel(uint8_t r, uint8_t g, uint8_t b, uint8_t w) { uint8_t change_anim = 0; int timeout_var = 0; #define timeout_time 3000; // ms + int time_reveice = 0; class MyServerCallbacks : public NimBLEServerCallbacks { - void onConnect(NimBLEServer* pServer) { + void onConnect(NimBLEServer* pServer, ble_gap_conn_desc *desc) { deviceConnected = true; + pServer->updateConnParams(desc->conn_handle, 0x6, 0x6, 0, 100); }; void onDisconnect(NimBLEServer* pServer) { deviceConnected = false; } + + void onMTUChange (uint16_t MTU, ble_gap_conn_desc *desc) { + Serial.printf("MTU change: %d\n", MTU); + } }; @@ -370,6 +376,7 @@ void set_all_pixel(uint8_t r, uint8_t g, uint8_t b, uint8_t w) { f_tmp.write(rxValue[i]); } timeout_var = millis() + timeout_time; + time_reveice = millis(); } break; case 'P': @@ -410,6 +417,7 @@ void set_all_pixel(uint8_t r, uint8_t g, uint8_t b, uint8_t w) { anim = ANIM_START; f_tmp.close(); timeout_var = 0; + Serial.printf("time to receive gig: %dms\n", millis() - time_reveice); } else { for (int i = 0; i < rxValue.length(); i++) { f_tmp.write(rxValue[i]);