controller-legacy/src/runners/test.c
Tobias Reisinger 9602e6e937 remove: lmdb
add: sqlite
add: new commands
2020-08-24 16:00:08 +02:00

35 lines
1,022 B
C

#include <unistd.h>
#include <runners.h>
#include <logger.h>
#include <drivers.h>
#include <drivers.h>
void
runner_test()
{
// from x down to 0 to turn all relays off in the end
for(uint_fast8_t i = 0; i < global_config.relay_count; ++i)
{
for(int test_run = 2; test_run >= 0; --test_run)
{
int is_active = test_run % 2;
if(global_config.relay_configs[i].inverted)
{
is_active = !is_active;
}
switch(global_config.relay_configs[i].driver)
{
case RELAY_DRIVER_GPIO:
driver_gpio_set(global_config.relay_configs[i].pin, is_active);
break;
case RELAY_DRIVER_PIFACE:
driver_piface_set(global_config.relay_configs[i].pin, is_active);
break;
default:
LOGGER_WARNING("relay %d is not using a driver\n", i);
}
sleep(1);
}
}
}