test_check_delay
This commit is contained in:
@@ -5,6 +5,7 @@ extern uint32_t startTime;
|
||||
bool IsEvseInput();
|
||||
bool CheckUnplugged();
|
||||
bool CheckTimeout();
|
||||
bool CheckDelay();
|
||||
void CalcTotals();
|
||||
void DisableAll();
|
||||
void EvseRead();
|
||||
|
||||
Binary file not shown.
@@ -81,6 +81,15 @@ bool CheckTimeout()
|
||||
return timeout > 0 && (now - startTime) > timeout;
|
||||
}
|
||||
|
||||
bool CheckDelay()
|
||||
{
|
||||
uint32_t now = rtc_get_counter_val();
|
||||
uint32_t start = Param::GetInt(Param::timedly) * 60;
|
||||
|
||||
return start <= 0 || (now - startTime) > start;
|
||||
}
|
||||
|
||||
|
||||
void EvseRead()
|
||||
{
|
||||
const int threshProxType1 = 2200;
|
||||
|
||||
@@ -93,14 +93,6 @@ static bool CheckChargerFaults()
|
||||
(active3 && ((Param::GetInt(Param::c3flag) & FLAG_FAULT) || timeouts[2]));
|
||||
}
|
||||
|
||||
static bool CheckDelay()
|
||||
{
|
||||
uint32_t now = rtc_get_counter_val();
|
||||
uint32_t start = Param::GetInt(Param::timedly) * 60;
|
||||
|
||||
return start <= 0 || (now - startTime) > start;
|
||||
}
|
||||
|
||||
static void CalcAcCurrentLimit()
|
||||
{
|
||||
int configuredChargers = Param::GetInt(Param::chargerena);
|
||||
|
||||
@@ -21,6 +21,7 @@ int main() {
|
||||
(TestCase){"test_disable_all", test_disable_all},
|
||||
(TestCase){"test_calc_totals", test_calc_totals},
|
||||
(TestCase){"test_check_timeout", test_check_timeout},
|
||||
(TestCase){"test_check_delay", test_check_delay},
|
||||
(TestCase){"test_evse_read", test_evse_read},
|
||||
(TestCase){"test_check_start_condition", test_check_start_condition},
|
||||
(TestCase){"test_check_voltage", test_check_voltage},
|
||||
|
||||
Binary file not shown.
@@ -52,6 +52,29 @@ void test_check_timeout()
|
||||
assert(res);
|
||||
}
|
||||
|
||||
void test_check_delay()
|
||||
{
|
||||
bool res;
|
||||
startTime = 11;
|
||||
|
||||
//after delay
|
||||
Param::SetInt(Param::test_time, 14 * 60);
|
||||
Param::SetInt(Param::timedly, 13);
|
||||
res = CheckDelay();
|
||||
assert(res);
|
||||
|
||||
//before delay
|
||||
Param::SetInt(Param::test_time, 12 * 60);
|
||||
res = CheckDelay();
|
||||
assert(!res);
|
||||
|
||||
//start time changes result
|
||||
startTime = 1100;
|
||||
res = CheckDelay();
|
||||
assert(res);
|
||||
}
|
||||
|
||||
|
||||
void test_evse_read()
|
||||
{
|
||||
// INP_MANUAL
|
||||
|
||||
Reference in New Issue
Block a user