|
|
@ -33,7 +33,7 @@ void BLE::update(void) { |
|
|
|
|
|
|
|
|
|
|
|
if(bleGamepad.isConnected()) { |
|
|
|
if((uint32_t)(millis() - last_updated) > 30) { |
|
|
|
if((uint32_t)(millis() - last_updated) > 1) { |
|
|
|
int16_t throttle = map(inputs.throttle, 0, 4096, -32767, 32767); // Throttle
|
|
|
|
int16_t yaw = map(inputs.yaw, 0, 4096, -32767, 32767); // Yaw
|
|
|
|
int16_t pitch = map(inputs.pitch, 0, 4096, -32767, 32767); // Pitch
|
|
|
@ -41,11 +41,20 @@ void BLE::update(void) { |
|
|
|
|
|
|
|
bleGamepad.setAxes(yaw, throttle, roll, pitch, 0, 0, DPAD_CENTERED); |
|
|
|
|
|
|
|
sent_counter_raw++; |
|
|
|
|
|
|
|
last_updated = millis(); |
|
|
|
// Serial.printf("Sent\n");
|
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
// Reset the profiler when hits 1 second mark
|
|
|
|
if((uint32_t)(millis() - last_seconds) > 1000) { |
|
|
|
sent_counter = sent_counter_raw; |
|
|
|
sent_counter_raw = 0; |
|
|
|
last_seconds = millis(); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
BLE ble; |