Changed comments, variable names and filenames to be in English

This commit is contained in:
2021-08-30 19:04:07 +02:00
parent 6bc23c92fe
commit 0833762006
11 changed files with 153 additions and 162 deletions

58
main.c
View File

@@ -1,44 +1,44 @@
#include "idozites.h"
#include "mozgatas_demo.h"
#include "timing.h"
#include "moving.h"
#include <stdio.h>
#define FILEPATH "menetrend.txt"
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
* REDŐNY AUTOMATA
* SHUTTER AUTOMATA
* ---------------
* C program az itthoni redőnyök automatizálására egy kiszuperált router és egy kompatibilis távirányító segítségével.
* A programot egy időzítő (Cron) hívja meg fix időközönként.
* Egy helyi fájlból, a menetrend.txt-ből olvassa ki a felhúzások és lehúzások idejét, ha annyi az idő, fel/lehúzza,
* ez egy heti menetrendet képes tárolni és végrehajtani.
* GPIO-kkal vezérli a távirányító gombmátrixát.
* A programot OpenWrt 19.07-re fordítom. HW: D-Link DIR-600. (fordítási környezethez:$ source openwrt.config)
* 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.
* The program is compiled to openwrt 19.07.8; HW: D-Link DIR-600 rev.B6E
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
int main ()
{
redony ercsi13[] = {
shutter ercsi13[] = {
{
1, 0, 0 //fiúszoba
1, 0, 0, 0, 0, 27, 0 //fiúszoba
},
{
2, 0, 0 //lányszoba
2, 0, 0, 0, 0, 27, 0 //lányszoba
},
{
3, 0, 0 //nappali bal
3, 0, 0, 0, 0, 27, 0 //nappali bal
},
{
4, 0, 0 //nappali jobb
4, 0, 0, 0, 0, 27, 0 //nappali jobb
},
{
5, 0, 0 //szülői szoba
5, 0, 0, 0, 0, 27, 0 //szülői szoba
},
{
6, 0, 0 //konyha
6, 0, 0, 0, 0, 18, 0 //konyha
},
{
7, 0, 0 //előtető (lehúzás = kieresztés, felhúzás = behúzás)
7, 0, 0, 0, 0, 33, 0 //előtető (lehúzás = kieresztés, felhúzás = behúzás)
}
};
//beolvassuk minden redőny időpontját
//scan the schedule
for (int i = 0; i < 7; ++i)
{
FILE *schedule = fopen (FILEPATH, "r");
@@ -47,16 +47,24 @@ int main ()
fclose (schedule);
}
/*
//exportáljuk a gpio-kat, hogy tudjuk használni őket
export ();
*/
reset ();
byte ch = 1; //remote defaults to ch 1
//leellenőrizzük az időpontokat, minden redőny úgy mozog, ahhogy azt megmondtuk neki.
//check timings and act accordingly
for (int i = 0; i < 7; ++i)
{
set_ch (&ercsi13[i]);
press_button (check_timing (&ercsi13[i]));
set_ch (&ercsi13[i], &ch);
switch (check_timing (&ercsi13[i]))
{
case up:press_button (up);
break;
case stop:break;
case down:lower (&ercsi13[i]);
break;
case prev:
case next:break;
};
}
return 0;
}