Skip to content

Commit

Permalink
speed up ble + add gif timer
Browse files Browse the repository at this point in the history
  • Loading branch information
spectrenoir06 committed Jun 10, 2023
1 parent 3379aaa commit afc5d43
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion src/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
};


Expand Down Expand Up @@ -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':
Expand Down Expand Up @@ -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]);
Expand Down

0 comments on commit afc5d43

Please sign in to comment.