Suggestions mostly corrected
This commit is contained in:
@@ -21,7 +21,6 @@
|
||||
#include "int_n.h"
|
||||
#include <pd.h>
|
||||
#include <stdbool.h>
|
||||
#include "Settings.h"
|
||||
|
||||
bool PolicyEngine::pdNegotiationComplete;
|
||||
int PolicyEngine::current_voltage_mv;
|
||||
@@ -619,12 +618,13 @@ void PolicyEngine::PPSTimerCallback() {
|
||||
}
|
||||
}
|
||||
|
||||
bool PolicyEngine::NegotiationTimeoutReached() {
|
||||
if (systemSettings.PDNegTimeout == 0){
|
||||
bool PolicyEngine::NegotiationTimeoutReached(uint8_t timeout) {
|
||||
if (timeout == 0){
|
||||
return false;
|
||||
}
|
||||
|
||||
if (xTaskGetTickCount() > (TICKS_SECOND/10 * systemSettings.PDNegTimeout)) {
|
||||
if (xTaskGetTickCount() > (TICKS_100MS * timeout)) {
|
||||
state = PESinkSourceUnresponsive;
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
@@ -33,10 +33,10 @@ public:
|
||||
static void handleMessage(union pd_msg *msg);
|
||||
// Returns true if headers indicate PD3.0 compliant
|
||||
static bool isPD3_0();
|
||||
static bool setupCompleteOrTimedOut() {
|
||||
static bool setupCompleteOrTimedOut(uint8_t timeout) {
|
||||
if (pdNegotiationComplete)
|
||||
return true;
|
||||
if (PolicyEngine::NegotiationTimeoutReached())
|
||||
if (PolicyEngine::NegotiationTimeoutReached(timeout))
|
||||
return true;
|
||||
if (state == policy_engine_state::PESinkSourceUnresponsive)
|
||||
return true;
|
||||
@@ -48,16 +48,12 @@ public:
|
||||
static bool pdHasNegotiated() {
|
||||
if (state == policy_engine_state::PESinkSourceUnresponsive)
|
||||
return false;
|
||||
if (pdNegotiationComplete)
|
||||
return true;
|
||||
if (PolicyEngine::NegotiationTimeoutReached())
|
||||
return false;
|
||||
return true;
|
||||
}
|
||||
// Call this periodically, at least once every second
|
||||
static void PPSTimerCallback();
|
||||
|
||||
static bool NegotiationTimeoutReached();
|
||||
static bool NegotiationTimeoutReached(uint8_t timeout);
|
||||
|
||||
enum class Notifications {
|
||||
PDB_EVT_PE_RESET = EVENT_MASK(0),
|
||||
|
||||
Reference in New Issue
Block a user