File tree Expand file tree Collapse file tree 1 file changed +7
-3
lines changed Expand file tree Collapse file tree 1 file changed +7
-3
lines changed Original file line number Diff line number Diff line change @@ -155,18 +155,22 @@ void BraccioClass::connectJoystickTo(lv_obj_t* obj) {
155155
156156void BraccioClass::pd_thread () {
157157 start_pd_burst = millis ();
158+ size_t last_time_ask_pps = 0 ;
158159 while (1 ) {
159160 auto ret = pd_events.wait_any (0xFF );
160161 if ((ret & 1 ) && (millis () - start_pd_burst > 1000 )) {
161- PD_UFP.set_PPS (PPS_V (7.2 ), PPS_A (2.0 ));
162162 pd_timer.detach ();
163- pd_timer.attach (mbed::callback (this , &BraccioClass::unlock_pd_semaphore), 1s );
163+ pd_timer.attach (mbed::callback (this , &BraccioClass::unlock_pd_semaphore), 5s );
164164 }
165165 if (ret & 2 ) {
166166 pd_timer.detach ();
167- pd_timer.attach (mbed::callback (this , &BraccioClass::unlock_pd_semaphore), 10ms );
167+ pd_timer.attach (mbed::callback (this , &BraccioClass::unlock_pd_semaphore), 50ms );
168168 }
169169 i2c_mutex.lock ();
170+ if (millis () - last_time_ask_pps > 5000 ) {
171+ PD_UFP.set_PPS (PPS_V (7.2 ), PPS_A (2.0 ));
172+ last_time_ask_pps = millis ();
173+ }
170174 PD_UFP.run ();
171175 i2c_mutex.unlock ();
172176 if (PD_UFP.is_power_ready () && PD_UFP.is_PPS_ready ()) {
You can’t perform that action at this time.
0 commit comments