mocked timer test, EvseRead
This commit is contained in:
@@ -58,3 +58,79 @@ static bool CheckTimeout()
|
||||
return timeout > 0 && (now - startTime) > timeout;
|
||||
}
|
||||
|
||||
static void EvseRead()
|
||||
{
|
||||
const int threshProxType1 = 2200;
|
||||
const int threshProx = 3700;
|
||||
const int thresh13A = 3200;
|
||||
const int thresh20A = 2800;
|
||||
const int thresh32A = 1800;
|
||||
const int thresh63A = 1000;
|
||||
int val = AnaIn::cablelim.Get();
|
||||
|
||||
if (timer_get_flag(TIM3, TIM_SR_CC2IF))
|
||||
{
|
||||
//The relationship between duty cycle and maximum current is linear
|
||||
//until 85% = 51A. Above that it becomes non-linear but that is not
|
||||
//relevant for our 10kW charger.
|
||||
float evselim = timer_get_ic_value(TIM3, TIM_IC2) / 10;
|
||||
evselim *= 0.666666f;
|
||||
Param::SetFloat(Param::evselim, evselim);
|
||||
}
|
||||
else
|
||||
{
|
||||
//If no PWM detected, set limit to 0
|
||||
Param::SetInt(Param::evselim, 0);
|
||||
}
|
||||
|
||||
if (Param::GetInt(Param::inputype) == INP_TYPE2 ||
|
||||
Param::GetInt(Param::inputype) == INP_TYPE2_3P ||
|
||||
Param::GetInt(Param::inputype) == INP_TYPE2_AUTO)
|
||||
{
|
||||
if (val > threshProx)
|
||||
{
|
||||
Param::SetInt(Param::proximity, 0);
|
||||
Param::SetInt(Param::cablelim, 0);
|
||||
}
|
||||
else
|
||||
{
|
||||
Param::SetInt(Param::proximity, 1);
|
||||
|
||||
if (val > thresh13A)
|
||||
{
|
||||
Param::SetInt(Param::cablelim, 13);
|
||||
}
|
||||
else if (val > thresh20A)
|
||||
{
|
||||
Param::SetInt(Param::cablelim, 20);
|
||||
}
|
||||
else if (val > thresh32A)
|
||||
{
|
||||
Param::SetInt(Param::cablelim, 32);
|
||||
}
|
||||
else if (val > thresh63A)
|
||||
{
|
||||
Param::SetInt(Param::cablelim, 63);
|
||||
}
|
||||
}
|
||||
}
|
||||
else if (Param::GetInt(Param::inputype) == INP_TYPE1)
|
||||
{
|
||||
if (val > threshProxType1)
|
||||
{
|
||||
Param::SetInt(Param::proximity, 0);
|
||||
Param::SetInt(Param::cablelim, 0);
|
||||
}
|
||||
else
|
||||
{
|
||||
Param::SetInt(Param::proximity, 1);
|
||||
Param::SetInt(Param::cablelim, 40);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
Param::SetInt(Param::proximity, 0);
|
||||
Param::SetInt(Param::cablelim, 32);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -108,6 +108,9 @@
|
||||
VALUE_ENTRY(c3udc, "V", 2035 ) \
|
||||
VALUE_ENTRY(c3idc, "A", 2036 ) \
|
||||
VALUE_ENTRY(test_time, "s", 2037 ) \
|
||||
VALUE_ENTRY(test_timer_flag, "X", 2038 ) \
|
||||
VALUE_ENTRY(test_timer_icvalue, "X", 2039 ) \
|
||||
// TODO: How to hide this in interface?
|
||||
|
||||
|
||||
/***** Enum String definitions *****/
|
||||
|
||||
Reference in New Issue
Block a user