I would like to enable PP_AUTO in all builds. However with no cable/resistor attached it is stuck in State A.
PP_AUTO_AMPACITY — Allow Charging With No Cable Connected
Problem
When PP_AUTO_AMPACITY is enabled and no cable is connected (PP pin open/floating), the ADC reads ~1023. The lookup table finds no match and ReadPPMaxAmps() returns 0. AutoSetCurrentCapacity() treats 0 as invalid and returns 1 (error), causing StateTransitionReqFunc to force the state back to EVSE_STATE_A, blocking charging even when a vehicle is present on the pilot.
The root issue is that 0 is overloaded — it means both "short circuit on PP pin" (ADC ≤ 47, genuinely invalid) and "open circuit, no cable" (ADC > 819, no PP resistor present).
Fix — Distinguish Open Circuit from Short Circuit
AutoCurrentCapacityController.h
Add #define PP_AMPS_ABSENT 0xFF as a sentinel value for open-circuit PP pin.
AutoCurrentCapacityController.cpp — ReadPPMaxAmps()
Initialise amps = PP_AMPS_ABSENT instead of 0. The lookup loop sets a real value on a matched break. If the loop falls through without a match (ADC > 819, open circuit), amps remains PP_AMPS_ABSENT. The short-circuit case (ADC ≤ 47) still returns 0 because it matches the {0, 0} table entry on break.
AutoCurrentCapacityController.cpp — AutoSetCurrentCapacity()
Add a three-way branch:
PP_AMPS_ABSENT (0xFF) → no cable/PP resistor present, charge at configured capacity, return 0 (success)
amps > 0 → valid PP resistor found, cap current and return 0 (success)
amps == 0 → short on PP pin, block charging, return 1 (error)
AutoCurrentCapacityController.h — after the PP_AMPS typedef:
#define PP_AMPS_ABSENT 0xFF
AutoCurrentCapacityController.cpp — ReadPPMaxAmps(), change the initialiser:
// default to absent; loop break sets a real value, fall-through means open circuit
uint8_t amps = PP_AMPS_ABSENT;
AutoCurrentCapacityController.cpp — replace AutoSetCurrentCapacity() body:
uint8_t AutoCurrentCapacityController::AutoSetCurrentCapacity()
{
uint8_t amps = ReadPPMaxAmps();
if (amps == PP_AMPS_ABSENT) {
// open circuit - no cable present, charge at configured capacity
return 0;
}
else if (amps) {
if (g_EvseController.GetCurrentCapacity() > ppMaxAmps) {
g_EvseController.SetCurrentCapacity(ppMaxAmps,1,1);
}
return 0;
}
else {
// ADC near zero - short on PP pin, block charging
return 1;
}
}
I would like to enable PP_AUTO in all builds. However with no cable/resistor attached it is stuck in State A.
PP_AUTO_AMPACITY — Allow Charging With No Cable Connected
Problem
When PP_AUTO_AMPACITY is enabled and no cable is connected (PP pin open/floating), the ADC reads ~1023. The lookup table finds no match and ReadPPMaxAmps() returns 0. AutoSetCurrentCapacity() treats 0 as invalid and returns 1 (error), causing StateTransitionReqFunc to force the state back to EVSE_STATE_A, blocking charging even when a vehicle is present on the pilot.
The root issue is that 0 is overloaded — it means both "short circuit on PP pin" (ADC ≤ 47, genuinely invalid) and "open circuit, no cable" (ADC > 819, no PP resistor present).
Fix — Distinguish Open Circuit from Short Circuit
AutoCurrentCapacityController.h
Add #define PP_AMPS_ABSENT 0xFF as a sentinel value for open-circuit PP pin.
AutoCurrentCapacityController.cpp — ReadPPMaxAmps()
Initialise amps = PP_AMPS_ABSENT instead of 0. The lookup loop sets a real value on a matched break. If the loop falls through without a match (ADC > 819, open circuit), amps remains PP_AMPS_ABSENT. The short-circuit case (ADC ≤ 47) still returns 0 because it matches the {0, 0} table entry on break.
AutoCurrentCapacityController.cpp — AutoSetCurrentCapacity()
Add a three-way branch:
PP_AMPS_ABSENT (0xFF) → no cable/PP resistor present, charge at configured capacity, return 0 (success)
amps > 0 → valid PP resistor found, cap current and return 0 (success)
amps == 0 → short on PP pin, block charging, return 1 (error)
AutoCurrentCapacityController.h — after the PP_AMPS typedef:
#define PP_AMPS_ABSENT 0xFFAutoCurrentCapacityController.cpp — ReadPPMaxAmps(), change the initialiser:
AutoCurrentCapacityController.cpp — replace AutoSetCurrentCapacity() body: