mirror of
https://github.com/Derisis13/Shutter.git
synced 2025-12-06 19:32:48 +01:00
Deleted debug files, added new header to main.c
This commit is contained in:
13
main.c
13
main.c
@@ -1,17 +1,18 @@
|
||||
#include "timing.h"
|
||||
#include "moving.h"
|
||||
#include <stdio.h>
|
||||
#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 ()
|
||||
|
||||
@@ -1,54 +0,0 @@
|
||||
//
|
||||
// Created by lacko on 19/08/2021.
|
||||
//
|
||||
|
||||
#include "moving_debug.h"
|
||||
#include <stdio.h>
|
||||
|
||||
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);
|
||||
}
|
||||
@@ -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_
|
||||
Reference in New Issue
Block a user