From 80f79cc863f23147da0cdfeae5808f3cbadcacbe Mon Sep 17 00:00:00 2001 From: Derisis13 Date: Fri, 19 Nov 2021 01:09:30 +0100 Subject: [PATCH] Deleted debug files, added new header to main.c --- main.c | 13 ++++++------ moving_debug.c | 54 -------------------------------------------------- moving_debug.h | 21 -------------------- 3 files changed, 7 insertions(+), 81 deletions(-) delete mode 100644 moving_debug.c delete mode 100644 moving_debug.h diff --git a/main.c b/main.c index 027e838..86cbb73 100755 --- a/main.c +++ b/main.c @@ -1,17 +1,18 @@ #include "timing.h" #include "moving.h" #include -#define FILEPATH "menetrend.txt" +#define FILEPATH "schedule.txt" #define N_of_Shutters 7 #define rolltimelist {23, 23, 23, 23, 16, 23, 33} /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * SHUTTER AUTOMATA * ----------------- - * C program for automating remote controlled shutters via an openwrt router and a paired remote. - * This program needs to be called by Cron in few minute intervals. - * Raise and lowering times as well as the desired lowering percentage is read from a local file (menetrend.txt), and is - * executed; the schedule contains one full week. - * The program uses GPIO2 for resetting the remote and GPIO17-21 for controlling the remote. + * C program for automating remote controlled shutters via an embedded linux platform and a paired remote. + * This program needs to be called by a scheduler (like Cron) in few minute intervals. + * Raise and lowering times are defined in the rolltimelist macro. The N_of_Shutters macro contains the f + * well as the desired lowering percentages are read from a local file (schedule.txt), and + * are executed; the schedule contains one full week. + * . * The program is compiled to openwrt 19.07.8; HW: D-Link DIR-600 rev.B6E * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ int main () diff --git a/moving_debug.c b/moving_debug.c deleted file mode 100644 index 699fac9..0000000 --- a/moving_debug.c +++ /dev/null @@ -1,54 +0,0 @@ -// -// Created by lacko on 19/08/2021. -// - -#include "moving_debug.h" -#include - -void set_ch (shutter *r, byte *channel) -{ - while (*channel != r->ch) - { - if (*channel > r->ch) - { - press_button (prev); - (*channel)--; - } - else if (*channel < r->ch) - { - press_button (next); - (*channel)++; - } - } -} - -//reset láb active low, de negatív logikával van bekötve -void reset () -{ - printf ("remote reset\n"); -} - -void press_button (buttons b) -{ - switch (b) - { - case up: printf ("up\n"); - break; - case down: printf ("down\n"); - break; - case stop: printf ("stop\n"); - break; - case prev: printf ("previous\n"); - break; - case next: printf ("next ch\n"); - break; - default: printf ("hiba\n"); - } -} - -void lower (shutter *r) -{ - press_button (down); - printf ("sleeping %d usecs", r->percentage * r->rolltime_down * 10000); - press_button (stop); -} \ No newline at end of file diff --git a/moving_debug.h b/moving_debug.h deleted file mode 100644 index 889ec22..0000000 --- a/moving_debug.h +++ /dev/null @@ -1,21 +0,0 @@ -// -// Created by lacko on 19/08/2021. -// - -#ifndef _MOVING_DEBUG_H_ -#define _MOVING_DEBUG_H_ -#include "shutter.h" - -//set to the desired channel on the remote -void set_ch (shutter *r, byte *channel); - -//activates the gpio given to it and thus "presses" the button -void press_button (buttons b); - -//resets the remote so we start from ch 1 -void reset (); - -//lowers the shutter to the percentage level described in the shutter structure -void lower (shutter *r); - -#endif //_MOVING_DEBUG_H_