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) {
155
155
156
156
void BraccioClass::pd_thread () {
157
157
start_pd_burst = millis ();
158
+ size_t last_time_ask_pps = 0 ;
158
159
while (1 ) {
159
160
auto ret = pd_events.wait_any (0xFF );
160
161
if ((ret & 1 ) && (millis () - start_pd_burst > 1000 )) {
161
- PD_UFP.set_PPS (PPS_V (7.2 ), PPS_A (2.0 ));
162
162
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 );
164
164
}
165
165
if (ret & 2 ) {
166
166
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 );
168
168
}
169
169
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
+ }
170
174
PD_UFP.run ();
171
175
i2c_mutex.unlock ();
172
176
if (PD_UFP.is_power_ready () && PD_UFP.is_PPS_ready ()) {
You can’t perform that action at this time.
0 commit comments