From 9d1486acdc7e8e387582dc4e553b82fa7a0d6495 Mon Sep 17 00:00:00 2001 From: Derisis13 Date: Fri, 19 Nov 2021 01:04:01 +0100 Subject: [PATCH] Created a #define for the reset gpio --- moving.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/moving.c b/moving.c index 514ea35..3183a41 100644 --- a/moving.c +++ b/moving.c @@ -7,6 +7,8 @@ #include #include //project is to be compiled to openwrt +#define RESETPIN "/sys/class/gpio/gpio2/value" + void set_ch (shutter *r, byte *channel) { while (*channel != r->ch) @@ -27,11 +29,11 @@ void set_ch (shutter *r, byte *channel) //doing negative logic as reset is active low and GPIO2 is 1 on startup void reset () { - FILE *gpio2 = fopen ("/sys/class/gpio/gpio2/value", "w"); + FILE *gpio2 = fopen (RESETPIN, "w"); fprintf (gpio2, "0"); fclose (gpio2); sleep (1); - gpio2 = fopen ("/sys/class/gpio/gpio2/value", "w"); + gpio2 = fopen (RESETPIN, "w"); fprintf (gpio2, "1"); fclose (gpio2); sleep (3); @@ -58,4 +60,4 @@ void lower (shutter *r) press_button (down); usleep (r->percentage * r->rolltime_down * 10000); press_button (stop); -} \ No newline at end of file +}