fix: gpio pins and modes

This commit is contained in:
Tobias Reisinger 2020-04-18 13:28:23 +02:00
parent 82f43080ac
commit fd2f5acbb3
3 changed files with 10 additions and 9 deletions

View file

@ -15,12 +15,12 @@ inverted = 0
[relay-2] [relay-2]
driver = gpio driver = gpio
pin = 0 pin = 5
inverted = 1 inverted = 1
[relay-3] [relay-3]
driver = gpio driver = gpio
pin = 2 pin = 4
inverted = 1 inverted = 1
[relay-4] [relay-4]
@ -30,25 +30,25 @@ inverted = 1
[relay-5] [relay-5]
driver = gpio driver = gpio
pin = 15 pin = 2
inverted = 1 inverted = 1
[relay-6] [relay-6]
driver = gpio driver = gpio
pin = 16 pin = 1
inverted = 1 inverted = 1
[relay-7] [relay-7]
driver = gpio driver = gpio
pin = 1 pin = 0
inverted = 1 inverted = 1
[relay-8] [relay-8]
driver = gpio driver = gpio
pin = 4 pin = 16
inverted = 1 inverted = 1
[relay-9] [relay-9]
driver = gpio driver = gpio
pin = 5 pin = 15
inverted = 1 inverted = 1

View file

@ -10,5 +10,6 @@ driver_gpio_set(int pin, int value)
// disable "unused parameter" warning (happens when using wiring_debug) // disable "unused parameter" warning (happens when using wiring_debug)
(void)pin; (void)pin;
(void)value; (void)value;
pinMode(pin, OUTPUT);
digitalWrite(pin, value); digitalWrite(pin, value);
} }

View file

@ -9,9 +9,9 @@ void
runner_test(controller_t *controller) runner_test(controller_t *controller)
{ {
// from x down to 0 to turn all relays off in the end // from x down to 0 to turn all relays off in the end
for(int test_run = 2; test_run >= 0; --test_run) for(uint_fast8_t i = 0; i < controller->relay_count; ++i)
{ {
for(uint_fast8_t i = 0; i < controller->relay_count; ++i) for(int test_run = 2; test_run >= 0; --test_run)
{ {
int is_active = test_run % 2; int is_active = test_run % 2;
if(global_config.relay_configs[i].inverted) if(global_config.relay_configs[i].inverted)