File tree Expand file tree Collapse file tree 2 files changed +10
-1
lines changed Expand file tree Collapse file tree 2 files changed +10
-1
lines changed Original file line number Diff line number Diff line change @@ -343,6 +343,8 @@ void PS3BT::ACLData(uint8_t* ACLData) {
343
343
if (PS3Connected || PS3MoveConnected || PS3NavigationConnected) {
344
344
/* Read Report */
345
345
if (l2capinbuf[8 ] == 0xA1 ) { // HID_THDR_DATA_INPUT
346
+ lastMessageTime = millis (); // Store the last message time
347
+
346
348
if (PS3Connected || PS3NavigationConnected)
347
349
ButtonState = (uint32_t )(l2capinbuf[11 ] | ((uint16_t )l2capinbuf[12 ] << 8 ) | ((uint32_t )l2capinbuf[13 ] << 16 ));
348
350
else if (PS3MoveConnected)
Original file line number Diff line number Diff line change @@ -179,6 +179,11 @@ class PS3BT : public BluetoothService {
179
179
*/
180
180
void moveSetRumble (uint8_t rumble);
181
181
182
+ /* * Used to get the millis() of the last message */
183
+ uint32_t getLastMessageTime () {
184
+ return lastMessageTime;
185
+ };
186
+
182
187
/* *
183
188
* Used to call your own function when the controller is successfully initialized.
184
189
* @param funcOnInit Function to call.
@@ -214,10 +219,12 @@ class PS3BT : public BluetoothService {
214
219
uint8_t remote_name[30 ]; // First 30 chars of remote name
215
220
bool activeConnection; // Used to indicate if it's already has established a connection
216
221
217
- /* variables used by high level L2CAP task */
222
+ /* Variables used by high level L2CAP task */
218
223
uint8_t l2cap_state;
219
224
uint32_t l2cap_event_flag; // L2CAP flags of received Bluetooth events
220
225
226
+ uint32_t lastMessageTime; // Variable used to store the millis value of the last message.
227
+
221
228
unsigned long timer;
222
229
223
230
uint32_t ButtonState;
You can’t perform that action at this time.
0 commit comments