From 4822336bb931d0a70568f7c8873c516de502f9af Mon Sep 17 00:00:00 2001 From: nischram Date: Mon, 7 Jun 2021 20:50:31 +0200 Subject: [PATCH] =?UTF-8?q?V2.00=20Issue=20#52=20Updatef=C3=A4higkeit=20ve?= =?UTF-8?q?rbessert?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - Issue #52 parameter.h im .gitignore aktiviert und parameter.h.temp eingebunden - Schriftgröße fest auf 8x16 umgestellt - Bei der Anzeige für Strom wurde die erste 0 nach dem Komma nicht angezeigt - In der Ansicht Aktor / DHT die Schrift für Größe 8x16 angepasst - Nur Programme die laufen werden beim ./stop beendet - Changelog archiviert --- .gitignore | 2 + Changelog_Archiv/README.markdown | 27 +++ External/Aktor.h | 66 +++--- External/LedMain.c | 4 +- External/dht.h | 26 +-- External/gruenSave.c | 5 +- GuiMain.c | 15 +- Makefile | 18 +- README.markdown | 79 ++++--- Rscp/RWData.cpp | 290 -------------------------- Rscp/RWData.h | 308 ++++++++++++++++++++++++++-- Rscp/RscpSet.cpp | 5 +- Rscp/wbCheckHM.c | 12 +- RscpMain.cpp | 5 +- Watchdog.cpp | 5 +- checkPara.h | 40 ++++ copyPara.c | 45 ++++ define.h | 20 ++ funktion.h | 25 ++- parameter.h => parameter.h.temp | 38 ++-- parameterHM.h => parameterHM.h.temp | 0 screenSave.c | 34 +-- screenSaveHM.c | 10 +- start.c | 6 +- stop.c | 10 +- 25 files changed, 634 insertions(+), 461 deletions(-) delete mode 100644 Rscp/RWData.cpp create mode 100644 checkPara.h create mode 100644 copyPara.c rename parameter.h => parameter.h.temp (93%) rename parameterHM.h => parameterHM.h.temp (100%) mode change 100755 => 100644 screenSaveHM.c diff --git a/.gitignore b/.gitignore index 47e4007..b35556e 100644 --- a/.gitignore +++ b/.gitignore @@ -3,3 +3,5 @@ .metadata/ RemoteSystemsTempFiles/.project +parameter.h +parameterHM.h diff --git a/Changelog_Archiv/README.markdown b/Changelog_Archiv/README.markdown index 6eababe..b4f3ac5 100644 --- a/Changelog_Archiv/README.markdown +++ b/Changelog_Archiv/README.markdown @@ -1,4 +1,31 @@ # Changelog Archiv +V1.92 30.05.2021 [Issue #60](https://github.com/nischram/E3dcGui/issues/60) Tracker 1 zeigt Strom und Spannung falsch +- [Issue #60](https://github.com/nischram/E3dcGui/issues/60) Fehler behoben + +V1.92 28.05.2021 in Version V1.91 das Programm "Rscp/wbCheckHM" vergessen +- Programm angepasst und die Funktion senden von HM zu WB erweitert um Stop und Phasen + +V1.91 28.05.2021 [Issue #58](https://github.com/nischram/E3dcGui/issues/58) Notstrom-Reserve des Speichers +- Für [Issue #58](https://github.com/nischram/E3dcGui/issues/58) kann nun die Reserve aktiviert oder eingestellt werden +- Für [Issue #59](https://github.com/nischram/E3dcGui/issues/59) Stop-Button im Setup-Menü +- Für [Issue #55](https://github.com/nischram/E3dcGui/issues/55) zur Wallbox kann jetzt die Anzahl der Phasen vorgewählt werden +- Für [Issue #56](https://github.com/nischram/E3dcGui/issues/56) kann jetzt eine Ladung gestoppt werden + +V1.90 23.05.2021 [Issue #58](https://github.com/nischram/E3dcGui/issues/58) Schriftgröße der Leistungswerte +- Für Issue #58 Schriftgöße angepasset + +V1.89 03.05.2021 Wallbox Daten an HM senden und auslesen +- Wallbox-Werte an die HM senden +- Wallbox-Parameter aus HM lesen und an WB senden + +V1.88 03.04.2021 Anleitung überarbeitet + +V1.87 29.03.2021 Wallbox anzeigen o. steuern / Fehlerbehebung +- Wallbox-Menü zur Anzeige und Steuerung +- Fehlerkorrektur im Setup-Menü +- kleine Fehlerkorrekturen +- Changelog archiviert + V1.86 13.02.2021 Fehlerkorrektur für neuere Rasbain Versionen [Issue #48](https://github.com/nischram/E3dcGui/issues/48) - Issue #48 - Anpassungen an der README diff --git a/External/Aktor.h b/External/Aktor.h index 490f32b..7e8c673 100644 --- a/External/Aktor.h +++ b/External/Aktor.h @@ -276,52 +276,52 @@ int drawAktorFrame(int AktorTyp, int AktorPowerOn, int AktorPowerOff, char *designation, char *AktorName, int Line) { char OUT[56]; - drawSquare(405,Line-20,363,60,GREY); - drawCorner(405,Line-20,363,60,WHITE); - drawSquare(405+120,Line-17,240,54,WHITE); - drawCorner(405+120,Line-17,240,54,GREY); - put_string(405+6, Line+4, designation, WHITE); + drawSquare(405,Line-20,363,68,GREY); + drawCorner(405,Line-20,363,68,WHITE); + drawSquare(405+120,Line-17,240,62,WHITE); + drawCorner(405+120,Line-17,240,62,GREY); + put_string(405+6, Line, designation, WHITE); if (AktorTyp > 0){ - createData(565-30, Line-36, AktorName); + put_string(565-30, Line-18, AktorName, GREY); if (AktorTyp >= 11){ snprintf (OUT, (size_t)100, "On: %s", AktorTimerOn); - createData(565+90, Line-22, OUT); + put_string(565+90, Line-3, OUT, GREY); snprintf (OUT, (size_t)100, "Off: %s", AktorTimerOff); - createData(565+90, Line-10, OUT); + put_string(565+90, Line+12, OUT, GREY); } if (AktorTyp == 1 || AktorTyp == 11){ - put_string(405+6, Line-14, "\232berschuss", WHITE); + put_string(405+6, Line-16, "\232berschuss", WHITE); snprintf (OUT, (size_t)100, "On: %i W", AktorPowerOn); - createData(565-30, Line-22, OUT); + put_string(565-30, Line-3, OUT, GREY); snprintf (OUT, (size_t)100, "Off: Bezug"); - createData(565-30, Line-10, OUT); + put_string(565-30, Line+12, OUT, GREY); snprintf (OUT, (size_t)100, "Min On: %i Off: %i Minuten", AktorMinOn, AktorMinOff); - createData(565-30, Line+2, OUT); + put_string(565-30, Line+27, OUT, GREY); } else if (AktorTyp == 2 || AktorTyp == 12){ - put_string(405+6, Line-14, "Solar", WHITE); + put_string(405+6, Line-16, "Solar", WHITE); snprintf (OUT, (size_t)100, "On: %i W", AktorPowerOn); - createData(565-30, Line-22, OUT); + put_string(565-30, Line-3, OUT, GREY); snprintf (OUT, (size_t)100, "Off: %i W", AktorPowerOff); - createData(565-30, Line-10, OUT); + put_string(565-30, Line+12, OUT, GREY); snprintf (OUT, (size_t)100, "Min On: %i Off: %i Minuten", AktorMinOn, AktorMinOff); - createData(565-30, Line+2, OUT); + put_string(565-30, Line+27, OUT, GREY); } else if (AktorTyp == 3 || AktorTyp == 13){ - put_string(405+6, Line-14, "Battery", WHITE); + put_string(405+6, Line-16, "Battery", WHITE); snprintf (OUT, (size_t)100, "On: > %i %%", AktorPercentOn); - createData(565-30, Line-22, OUT); + put_string(565-30, Line-3, OUT, GREY); snprintf (OUT, (size_t)100, "Off: < %i %%", AktorPercentOff); - createData(565-30, Line-10, OUT); + put_string(565-30, Line+12, OUT, GREY); snprintf (OUT, (size_t)100, "Min On: %i Off: %i Minuten", AktorMinOn, AktorMinOff); - createData(565-30, Line+2, OUT); + put_string(565-30, Line+27, OUT, GREY); } else if (AktorTyp == 10){ - put_string(405+6, Line-14, "Zeit", WHITE); + put_string(405+6, Line-16, "Zeit", WHITE); snprintf (OUT, (size_t)100, "On: %s", AktorTimerOn); - createData(565-30, Line-22, OUT); + put_string(565-30, Line-3, OUT, GREY); snprintf (OUT, (size_t)100, "Off: %s", AktorTimerOff); - createData(565-30, Line-10, OUT); + put_string(565-30, Line+12, OUT, GREY); } } return 1; @@ -369,15 +369,15 @@ int makeAktorFrame() { if (useAktor == 1){ drawAktorFrame(Aktor1Typ, Aktor1PowerOn, Aktor1PowerOff, Aktor1PercentOn, Aktor1PercentOff, - Aktor1TimerOn, Aktor1TimerOff, Aktor1MinOn, Aktor1MinOff, "Aktor 1", Aktor1Name, R1); + Aktor1TimerOn, Aktor1TimerOff, Aktor1MinOn, Aktor1MinOff, "Aktor 1", Aktor1Name, RP1); drawAktorFrame(Aktor2Typ, Aktor2PowerOn, Aktor2PowerOff, Aktor2PercentOn, Aktor2PercentOff, - Aktor2TimerOn, Aktor2TimerOff, Aktor2MinOn, Aktor2MinOff, "Aktor 2", Aktor2Name, R2); + Aktor2TimerOn, Aktor2TimerOff, Aktor2MinOn, Aktor2MinOff, "Aktor 2", Aktor2Name, RP2); drawAktorFrame(Aktor3Typ, Aktor3PowerOn, Aktor3PowerOff, Aktor3PercentOn, Aktor3PercentOff, - Aktor3TimerOn, Aktor3TimerOff, Aktor3MinOn, Aktor3MinOff, "Aktor 3", Aktor3Name, R3); + Aktor3TimerOn, Aktor3TimerOff, Aktor3MinOn, Aktor3MinOff, "Aktor 3", Aktor3Name, RP3); drawAktorFrame(Aktor4Typ, Aktor4PowerOn, Aktor4PowerOff, Aktor4PercentOn, Aktor4PercentOff, - Aktor4TimerOn, Aktor4TimerOff, Aktor4MinOn, Aktor4MinOff, "Aktor 4", Aktor4Name, R4); + Aktor4TimerOn, Aktor4TimerOff, Aktor4MinOn, Aktor4MinOff, "Aktor 4", Aktor4Name, RP4); drawAktorFrame(Aktor5Typ, Aktor5PowerOn, Aktor5PowerOff, Aktor5PercentOn, Aktor5PercentOff, - Aktor5TimerOn, Aktor5TimerOff, Aktor5MinOn, Aktor5MinOff, "Aktor 5", Aktor5Name, R5); + Aktor5TimerOn, Aktor5TimerOff, Aktor5MinOn, Aktor5MinOff, "Aktor 5", Aktor5Name, RP5); return 1; } return 0; @@ -388,11 +388,11 @@ int makeAktorState() int PowerGrid = readRscp(PosGrid); int PowerPVI = readRscp(PosPVI); int BatterySOC = readRscp(PosSOC); - drawAktorState(Aktor1Typ, Aktor1Prio, Aktor1Pin, R1, PowerGrid, PowerPVI, BatterySOC); - drawAktorState(Aktor2Typ, Aktor2Prio, Aktor2Pin, R2, PowerGrid, PowerPVI, BatterySOC); - drawAktorState(Aktor3Typ, Aktor3Prio, Aktor3Pin, R3, PowerGrid, PowerPVI, BatterySOC); - drawAktorState(Aktor4Typ, Aktor4Prio, Aktor4Pin, R4, PowerGrid, PowerPVI, BatterySOC); - drawAktorState(Aktor5Typ, Aktor5Prio, Aktor5Pin, R5, PowerGrid, PowerPVI, BatterySOC); + drawAktorState(Aktor1Typ, Aktor1Prio, Aktor1Pin, RP1, PowerGrid, PowerPVI, BatterySOC); + drawAktorState(Aktor2Typ, Aktor2Prio, Aktor2Pin, RP2, PowerGrid, PowerPVI, BatterySOC); + drawAktorState(Aktor3Typ, Aktor3Prio, Aktor3Pin, RP3, PowerGrid, PowerPVI, BatterySOC); + drawAktorState(Aktor4Typ, Aktor4Prio, Aktor4Pin, RP4, PowerGrid, PowerPVI, BatterySOC); + drawAktorState(Aktor5Typ, Aktor5Prio, Aktor5Pin, RP5, PowerGrid, PowerPVI, BatterySOC); return 1; } return 0; diff --git a/External/LedMain.c b/External/LedMain.c index 9c9451a..f1f95a6 100644 --- a/External/LedMain.c +++ b/External/LedMain.c @@ -52,7 +52,7 @@ #include #include #include -#include "../parameter.h" +#include "../checkPara.h" #include "../Frame/framebuffer.c" #include "../Frame/DrawImage.h" #include "../Frame/DrawCorner.c" @@ -381,6 +381,8 @@ int PVI_TRACKER_Color() int main(void) { + //Parameter einbinden, checken oder default setzen + checkDefinePara(0); ws2811_return_t ret; setup_handlers(); diff --git a/External/dht.h b/External/dht.h index 9c98c37..cb754be 100644 --- a/External/dht.h +++ b/External/dht.h @@ -167,11 +167,11 @@ int drawDHTState(int DHTUse, int DHTPin, int DHTPosition, char *DHTName, int Lin } drawSquare(45+120,Line-17,225,54,WHITE); drawCorner(45+120,Line-17,225,54,GREY); - createData(205-30, Line-28, DHTName); + put_string(205-30, Line-18, DHTName, GREY); snprintf (OUT, (size_t)100, "Temperatur %.1f %cC", DHTTemp, 248); - createData(205-30, Line-16, OUT); + put_string(205-30, Line-3, OUT, GREY); snprintf (OUT, (size_t)100, "Luftfeuchtigkeit %.1f %%", DHTHum); - createData(205-30, Line-4, OUT); + put_string(205-30, Line+12, OUT, GREY); } else { drawSquare(45+80, Line,20,20,LTGREY); @@ -182,11 +182,11 @@ int drawDHTState(int DHTUse, int DHTPin, int DHTPosition, char *DHTName, int Lin int makeDHTFrame() { if (useDHT == 1){ - drawDHTFrame(DHT1Use, "Sensor 1", R1); - drawDHTFrame(DHT2Use, "Sensor 2", R2); - drawDHTFrame(DHT3Use, "Sensor 3", R3); - drawDHTFrame(DHT4Use, "Sensor 4", R4); - drawDHTFrame(DHT5Use, "Sensor 5", R5); + drawDHTFrame(DHT1Use, "Sensor 1", RP1); + drawDHTFrame(DHT2Use, "Sensor 2", RP2); + drawDHTFrame(DHT3Use, "Sensor 3", RP3); + drawDHTFrame(DHT4Use, "Sensor 4", RP4); + drawDHTFrame(DHT5Use, "Sensor 5", RP5); return 1; } return 0; @@ -198,15 +198,15 @@ int makeDHTState() drawSquare(760,440,20,20,LIGHT_RED); drawCorner(760,440,20,20,WHITE); saveDHT(DHT1Use, DHT1Position, DHT1Pin); - drawDHTState(DHT1Use, DHT1Pin, DHT1Position, DHT1Name, R1); + drawDHTState(DHT1Use, DHT1Pin, DHT1Position, DHT1Name, RP1); saveDHT(DHT2Use, DHT2Position, DHT2Pin); - drawDHTState(DHT2Use, DHT2Pin, DHT2Position, DHT2Name, R2); + drawDHTState(DHT2Use, DHT2Pin, DHT2Position, DHT2Name, RP2); saveDHT(DHT3Use, DHT3Position, DHT3Pin); - drawDHTState(DHT3Use, DHT3Pin, DHT3Position, DHT3Name, R3); + drawDHTState(DHT3Use, DHT3Pin, DHT3Position, DHT3Name, RP3); saveDHT(DHT4Use, DHT4Position, DHT4Pin); - drawDHTState(DHT4Use, DHT4Pin, DHT4Position, DHT4Name, R4); + drawDHTState(DHT4Use, DHT4Pin, DHT4Position, DHT4Name, RP4); saveDHT(DHT5Use, DHT5Position,DHT5Pin); - drawDHTState(DHT5Use, DHT5Pin, DHT5Position, DHT5Name, R5); + drawDHTState(DHT5Use, DHT5Pin, DHT5Position, DHT5Name, RP5); //Read Daten Ende (grüner Punkt unten rechts) drawSquare(760,440,20,20,GREEN); drawCorner(760,440,20,20,WHITE); diff --git a/External/gruenSave.c b/External/gruenSave.c index 365b2e1..d2f1c6f 100644 --- a/External/gruenSave.c +++ b/External/gruenSave.c @@ -8,7 +8,7 @@ #include #include #include -#include "../parameter.h" +#include "../checkPara.h" #include "../Frame/framebuffer.c" #include "../Frame/DrawImage.h" #include "../Frame/DrawCorner.c" @@ -27,6 +27,9 @@ void readWriteSendGB(char *name, char *unit, char *para, int pos, int ise) } void main() { + //Parameter einbinden, checken oder default setzen + checkDefinePara(0); + char value[128]; readWriteSendGB("Verbrauch", "l", GB_CONSUMPTION, PosGB_CONSUMPTION, ISE_GB_CONSUMPTION); readWriteSendGB("Regenerationsschritt", " ", GB_CURRENT_REGENERATION, PosGB_CURRENT_REGENERATION, ISE_GB_CURRENT_REGENERATION); diff --git a/GuiMain.c b/GuiMain.c index 73317a6..f6f00a4 100644 --- a/GuiMain.c +++ b/GuiMain.c @@ -17,16 +17,10 @@ gcc -g -o GuiMain GuiMain.c -lwiringPi #include #include #include -#include "parameter.h" -#include "parameterHM.h" +#include "checkPara.h" #include "Frame/touch.h" #include "Frame/touch.c" -#ifdef FONT_8X8 - #include "Frame/framebuffer.c" -#endif -#ifdef FONT_8X16 - #include "Frame/framebuffer8x16.c" -#endif +#include "Frame/framebuffer.c" #include "Frame/DrawSkala.c" #include "Frame/DrawLine.c" #include "Frame/DrawSOC.c" @@ -43,6 +37,9 @@ gcc -g -o GuiMain GuiMain.c -lwiringPi //#################################### int main(){ + //Parameter einbinden, checken oder default setzen + checkDefinePara(0); + picturePosition(); writeScreen(ScreenCounter, 0); makeAktor(); @@ -63,7 +60,7 @@ int main(){ int rawX, rawY, rawPressure, scaledX, scaledY; - int GuiTime, change = 0, changeStop = 0, saveGBstate = 0; + int GuiTime, change = 1, changeStop = 0, saveGBstate = 0; char batch[256], OUT [100],Path[100],Value[20],writeTxt[20],TimestampHM[20],RscpTimestamp[40],weatherTime[64], gruenTime[24], changepf[20]; char TAG_EMS_OUT_DATE[20], TAG_EMS_OUT_TIME[20], serialnumber[17]; int counter, ScreenSaverCounter, HistoryCounter = 15, SmartCounter = 0; diff --git a/Makefile b/Makefile index dd6fc1c..92185de 100644 --- a/Makefile +++ b/Makefile @@ -1,5 +1,6 @@ CXX ?=g++ CC ?=gcc +ROOT_CP=copyPara ROOT_WD=watchdog ROOT_SS=screenSave ROOT_SSHM=screenSaveHM @@ -11,10 +12,13 @@ ROOT_RM=RscpMain ROOT_RSET=Rscp/RscpSet ROOT_WBCK=Rscp/wbCheckHM ROOT_HISTORY=S10history/S10history +ROOT_LM=External/LedMain ROOT_TT=Frame/touchtest -all: $(ROOT_WD) $(ROOT_SS) $(ROOT_SSHM) $(ROOT_GM) $(ROOT_GB) $(ROOT_START) $(ROOT_STOP) $(ROOT_RM) $(ROOT_RSET) $(ROOT_HISTORY) $(ROOT_TT) +all: $(ROOT_CP) $(ROOT_WD) $(ROOT_SS) $(ROOT_SSHM) $(ROOT_GM) $(ROOT_START) $(ROOT_STOP) $(ROOT_RM) $(ROOT_RSET) $(ROOT_HISTORY) +$(ROOT_CP): cleanCP + $(CC) -O1 copyPara.c -o $@ $(ROOT_WD): cleanWD $(CXX) -O1 Watchdog.cpp -o $@ $(ROOT_SS): cleanSS @@ -30,16 +34,20 @@ $(ROOT_START): cleanSTART $(ROOT_STOP): cleanSTOP $(CC) -O1 stop.c -o $@ $(ROOT_RM): cleanRM - $(CXX) -O3 RscpMain.cpp Rscp/RscpProtocol.cpp Rscp/AES.cpp Rscp/SocketConnection.cpp Rscp/RWData.cpp -o $@ + $(CXX) -O3 RscpMain.cpp Rscp/RscpProtocol.cpp Rscp/AES.cpp Rscp/SocketConnection.cpp -o $@ $(ROOT_RSET): cleanRSet - $(CXX) -O3 Rscp/RscpSet.cpp Rscp/RscpProtocol.cpp Rscp/AES.cpp Rscp/SocketConnection.cpp Rscp/RWData.cpp -o $@ + $(CXX) -O3 Rscp/RscpSet.cpp Rscp/RscpProtocol.cpp Rscp/AES.cpp Rscp/SocketConnection.cpp -o $@ $(ROOT_WBCK): cleanWBCK $(CC) -O1 Rscp/wbCheckHM.c -o $@ $(ROOT_HISTORY): cleanHISTORY - $(CXX) -O3 S10history/S10history.cpp S10history/RscpReader.cpp Rscp/RscpProtocol.cpp Rscp/AES.cpp Rscp/SocketConnection.cpp Rscp/RWData.cpp -o $@ + $(CXX) -O3 S10history/S10history.cpp S10history/RscpReader.cpp Rscp/RscpProtocol.cpp Rscp/AES.cpp Rscp/SocketConnection.cpp -o $@ +$(ROOT_LM): cleanLM + $(CC) -O1 External/LedMain.c rpi_ws281x/mailbox.c rpi_ws281x/ws2811.c rpi_ws281x/pwm.c rpi_ws281x/pcm.c rpi_ws281x/dma.c rpi_ws281x/rpihw.c -o $@ -lwiringPi $(ROOT_TT): cleanTT $(CC) -O1 Frame/touchtest.c -o $@ +cleanCP: + -rm $(ROOT_CP) $(VECTOR) cleanWD: -rm $(ROOT_WD) $(VECTOR) cleanSS: @@ -62,5 +70,7 @@ cleanWBCK: -rm $(ROOT_WBCK) $(VECTOR) cleanHISTORY: -rm $(ROOT_HISTORY) $(VECTOR) +cleanLM: + -rm $(ROOT_LM) $(VECTOR) cleanTT: -rm $(ROOT_TT) $(VECTOR) diff --git a/README.markdown b/README.markdown index d769705..6c15d65 100644 --- a/README.markdown +++ b/README.markdown @@ -1,5 +1,5 @@ # E3DC to Homematic mit GUI -[Stand: V1.93 30.05.2021](https://github.com/nischram/E3dcGui#changelog) +[Stand: V2.00 06.06.2021](https://github.com/nischram/E3dcGui#changelog) Hier beschreibe ich, wie du dein S10 Hauskraftwerk von E3DC an eine Homematic Hausautomation anbinden kannst. @@ -61,21 +61,33 @@ git clone git://github.com/nischram/E3dcGui.git ~/E3dcGui ``` ### Einstellungen vornehmen -In der Datei „parameter.h“ im Ordner E3dcGui kann nun alles eingestellt werden, was du zum nutzen der Software benötigst. Entweder öffnet man die Datei mit einem externen Editor. Hier können diverse Editoren zum Einsatz kommen, ich nutze auf meinem Mac „Atom“ und lade die Datei mit „Cyberduck“ runter. Unter Windows ist das runterladen und bearbeiten z.B. mit WinSCP möglich. Alternativ kann man die Datei direkt auf dem Raspberry bearbeiten, dies beschreibe ich jetzt. -Alle Befehle müssen mit Groß- und Kleinschreibung korrekt übernommen werden. -Zuerst mit folgendem Befehl in den Ordner E3dcGui wechseln: - +Die Einstellungen die für deine individuelle Anwendung nötig ist, musst du in der "parameter.h" vornehmen. Bei der ersten Installation solltest du die Datei "parameter.h.temp" kopieren und dann deine Einstellung vornehmen. Parallel wir auch die parameterHM.h benötig und hierfür steht die "parameterHM.h.temp" zur Verfügung. +Um nicht versehentlich eine Vorhandene Datei zu überschreiben habe ich ein Programm erstellt mit dem du die Datei "parameter.h" kopieren kannst. +Ins E3dcGui Verzeichnis wechseln: ```shell pi@raspberrypi:~ $ cd E3dcGui ``` +Parameter-Copy Programm kompilieren: +```shell +pi@raspberrypi:~/E3dcGui $ make copyPara +``` +Parameter-Copy Programm starten: +```shell +pi@raspberrypi:~/E3dcGui $ ./copyPara +``` +Nun werden auf Abfrage die beiden Dateien kopiert. Ggf. kannst du die Dateien auch selber kopieren. +__Achtung!__ Nur dann selber kopieren wenn noch keine Datei erstellt ist. +Nun öffnet man die Datei "parameter.h" mit einem externen Editor. Hier können diverse Editoren zum Einsatz kommen, ich nutze auf meinem Mac „Atom“ und lade die Datei mit „Cyberduck“ runter. Unter Windows ist das runterladen und bearbeiten z.B. mit WinSCP möglich. Alternativ kann man die Datei direkt auf dem Raspberry bearbeiten, dies beschreibe ich jetzt. +Alle Befehle müssen mit Groß- und Kleinschreibung korrekt übernommen werden. Öffnen der Datei „parameter.h“ zum bearbeiten mit: ```shell pi@raspberrypi:~/E3dcGui $ nano parameter.h ``` -Es wird jetzt die Datei im Bearbeitungsprogramm „nano“ geöffnet und du kannst die Bearbeitung vornehmen. +Es wird jetzt die Datei im Bearbeitungsprogramm „nano“ geöffnet und du kannst die Bearbeitung vornehmen. +Die Änderungen in der „parameter.h“ speicherst du mit „STRG“ + „O“ und beendet wird der Editor mit „STRG“ + „X“. -Nach dem Bearbeiten müssen die Änderungen gespeichert werden. Die Änderungen in der „parameter.h“ speicherst du mit „STRG“ + „O“ und beendet wird der Editor mit „STRG“ + „X“. +Die "parameterHM.h" muss nur dann bearbeitet werden, wenn die Anzeige für Homematic Variablen genutzt werden soll. Also bei Homematic_GUI = 1. ### Inhalt der „parameter.h“ Da ich in der Datei alles beschrieben habe, gehe ich jetzt nur auf das wichtigste Einstellungen ein. @@ -85,6 +97,7 @@ __Grundfunktionen__: #define GUI 1 #define E3DC_S10 1 #define Homematic_E3DC 1 +#define wallbox 0 #define Homematic_GUI 0 #define wetterGui 1 #define Gruenbeck 0 @@ -95,8 +108,15 @@ __Grundfunktionen__: ``` Hier wird die Nutzung der Applikation definiert, also ob du das Display nutzen willst oder nicht und ob du eine Homematic anbinden willst oder nicht. Wenn du eine Funktion nutzen willst trag bitte eine „1“ ein sonst eine „0“. +### Informationen zum Update +Wenn du __nur__ an der parameter.h und ggf. an der parameterHM.h Änderungen vorgenommen hast, sollte ein update über git möglich sein. +```shell +git pull +``` +Falls ich Äderungen an den oben genanten Dateien gemacht habe werden die parameter.h.temp oder die parameterHM.h.temp aktualisiert. Die Änderungen musst du selbstständig übernehmen. Damit du sehen kannst welche Parameter erforderlich sind, werden die neuen Parameter beim Start mit ./start angezeigt. Innerhalb der Programme werden diese Variablen dann mit einem default Wert gestartet. + ### Zusätliche Software -Vor dem ersten kompilieren der Applikation, musse auf dem Raspberry __WiringPi__ installiert werden. Eine Anleitung habe ich im Wiki unter [WiringPI einrichten](https://github.com/nischram/E3dcGui/wiki/WiringPI). +Vor dem ersten kompilieren der Applikation, muss auf dem Raspberry __WiringPi__ installiert werden. Eine Anleitung habe ich im Wiki unter [WiringPI einrichten](https://github.com/nischram/E3dcGui/wiki/WiringPI). Auch muss zuvor __libcurl4__ installiert werden, wird für die Wetterdaten benötigt (Anleitung siehe unter "2. Wetteranzeige"). ### Speicherort RAMDisk einrichten @@ -331,6 +351,7 @@ Das Makefile ist so aufgebaut, dass jedes Programmteil auch einzeln Kompiliert w ```shell make +make copyPara make watchdog make screenSave make screenSaveHM @@ -341,9 +362,17 @@ make RscpMain make Rscp/RscpSet make Rscp/wbCheckHM make S10history/S10history +make External/LedMain +make External/gruenSave make Frame/touchtest ``` -Diese Möglichkeit erspart zum Teil einiges an Zeit, wenn du eigene Änderungen testen möchtest. +Diese Möglichkeit erspart zum Teil einiges an Zeit, wenn du eigene Änderungen testen möchtest. +Die einzel Aufrufe können auch kombiniert werden, z.B.: `make GuiMain screenSave` +Bei dem Standart `make` werden folgende Porgrammteile __nicht__ automatisch kompiliert: +- External/LedMain +- External/gruenSave +- Frame/touchtest +Diese Programmteile müssen von Hand ausgeführt werden. ## Aktuelle Uhrzeit aus dem Internet holen Wenn der Watchdog den Pi neu startet, bleibt die Uhrzeit des Pi nicht Aktuell. Hier können schon mal ein paar Minuten Abweichung entstehen. @@ -384,6 +413,7 @@ Hier eine tolle Idee das Raspberry-Display in die Wand einzulasse, so dass es b ## Changelog ### Wichtige Ergänzungen +V2.00 06.06.2021 Updatefähigkeit verbessert V1.87 29.03.2021 Wallbox anzeigen o. steuern V1.81 08.09.2020 WetterGui auf OpenWeatherMap.org umgestellt V1.68 10.12.2017 Grünbeck softliQ SC18 eingebunden @@ -397,31 +427,12 @@ Mit folgendem Befehl kann man direkt die Version ohne Display abfragen: `grep "Stand: " README.markdown |cut -d " " -f 2` ### Versionen -V1.92 30.05.2021 [Issue #60](https://github.com/nischram/E3dcGui/issues/60) Tracker 1 zeigt Strom und Spannung falsch -- [Issue #60](https://github.com/nischram/E3dcGui/issues/60) Fehler behoben - -V1.92 28.05.2021 in Version V1.91 das Programm "Rscp/wbCheckHM" vergessen -- Programm angepasst und die Funktion senden von HM zu WB erweitert um Stop und Phasen - -V1.91 28.05.2021 [Issue #58](https://github.com/nischram/E3dcGui/issues/58) Notstrom-Reserve des Speichers -- Für [Issue #58](https://github.com/nischram/E3dcGui/issues/58) kann nun die Reserve aktiviert oder eingestellt werden -- Für [Issue #59](https://github.com/nischram/E3dcGui/issues/59) Stop-Button im Setup-Menü -- Für [Issue #55](https://github.com/nischram/E3dcGui/issues/55) zur Wallbox kann jetzt die Anzahl der Phasen vorgewählt werden -- Für [Issue #56](https://github.com/nischram/E3dcGui/issues/56) kann jetzt eine Ladung gestoppt werden - -V1.90 23.05.2021 [Issue #58](https://github.com/nischram/E3dcGui/issues/58) Schriftgröße der Leistungswerte -- Für Issue #58 Schriftgöße angepasset - -V1.89 03.05.2021 Wallbox Daten an HM senden und auslesen -- Wallbox-Werte an die HM senden -- Wallbox-Parameter aus HM lesen und an WB senden - -V1.88 03.04.2021 Anleitung überarbeitet - -V1.87 29.03.2021 Wallbox anzeigen o. steuern / Fehlerbehebung -- Wallbox-Menü zur Anzeige und Steuerung -- Fehlerkorrektur im Setup-Menü -- kleine Fehlerkorrekturen +V2.00 06.06.2021 [Issue #52](https://github.com/nischram/E3dcGui/issues/52) Updatefähigkeit verbessert +- Issue #52 parameter.h im .gitignore aktiviert und parameter.h.temp eingebunden +- Schriftgröße fest auf 8x16 umgestellt +- Bei der Anzeige für Strom wurde die erste 0 nach dem Komma nicht angezeigt +- In der Ansicht Aktor / DHT die Schrift für Größe 8x16 angepasst +- Nur Programme die laufen werden beim ./stop beendet - Changelog archiviert [Changelog Archiv](https://github.com/nischram/E3dcGui/tree/master/Changelog_Archiv) diff --git a/Rscp/RWData.cpp b/Rscp/RWData.cpp deleted file mode 100644 index fab6678..0000000 --- a/Rscp/RWData.cpp +++ /dev/null @@ -1,290 +0,0 @@ -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include "../parameter.h" - -using namespace std; - -void printsendHM(int CounterHM, int id, float value) -{ - if(Homematic_E3DC == 1){ - if(CounterHM == HM_Intervall && id != 0){ - char batch[128]; - memset(batch, 0x00, sizeof(batch)); - snprintf(batch, sizeof(batch), "curl -s \"http://%s/config/xmlapi/statechange.cgi?ise_id=%i&new_value=%.1f\" > /dev/null 2>&1",HM_IP , id, value); - printf("send to Homematic ISE_ID %i new Value = %.3f\n",id, value); - system(batch); - } - } -} -void printsendCharHM(int CounterHM, int id, char value[32]) -{ - if(Homematic_E3DC == 1){ - if(CounterHM == HM_Intervall && id != 0){ - char batch[128]; - memset(batch, 0x00, sizeof(batch)); - snprintf(batch, sizeof(batch), "curl -s \"http://%s/config/xmlapi/statechange.cgi?ise_id=%i&new_value=%s\" > /dev/null 2>&1",HM_IP , id, value); - printf("send to Homematic ISE_ID %i new Value = %s\n",id, value); - system(batch); - } - } -} -void printsendBitHM(int CounterHM, int id, int Value, int Bit) -{ - if(Homematic_E3DC == 1){ - if(CounterHM == HM_Intervall && id != 0){ - char batch[128]; - memset(batch, 0x00, sizeof(batch)); - bool response = Value&Bit; - if(response){ - snprintf(batch, sizeof(batch), "curl -s \"http://%s/config/xmlapi/statechange.cgi?ise_id=%i&new_value=true\" > /dev/null 2>&1",HM_IP , id); - printf("send to Homematic ISE_ID %i new Value = true\n",id); - } - else { - snprintf(batch, sizeof(batch), "curl -s \"http://%s/config/xmlapi/statechange.cgi?ise_id=%i&new_value=false\" > /dev/null 2>&1",HM_IP , id); - printf("send to Homematic ISE_ID %i new Value = false\n",id); - } - system(batch); - } - } -} -void readWrite900(char *fileName, int NewValue) -{ - int c; - int line[100]; - char read[20]; - char Path [128]; - snprintf (Path, (size_t)128, "/home/pi/E3dcGui/Data/%s.txt", fileName); - fstream datei; - datei.open(Path, ios::in | ios::out); - if (datei.fail()){ - datei.clear(); - datei.open(Path, ios::out); - datei.close(); - cout << "Datei Data/" << fileName << ".txt wurde erstellt!\n"; - datei.clear(); - datei.open(Path, ios::in | ios::out); - } - if (datei.good()){ - for( c = 0; c < 97; ++c ){ - datei.getline(read ,20, '\n'); - if (read == NULL) - snprintf (read, (size_t)20, "0"); - line[c] = atoi(read); - } - datei.clear(); - datei.seekg (0, ios::beg); - for( c = 1; c < 96; ++c ){ - datei << line[c] <<"\n"; - } - datei << NewValue <<"\n"; - datei.close(); - } - else { - cout << "Konnte Datei Data/" << fileName << ".txt nicht erstellen!\n"; - } - return; -} -int writeData(char *Path, int Position, int NewValue, int max) -{ - int c = max; - int out [c]; - char read[128]; - //Lese Wert aus Datei ein - fstream datei; - datei.open(Path, ios::in | ios::out); - if (datei.fail()){ - datei.clear(); - datei.open(Path, ios::out); - datei.close(); - cout << "Datei " << Path << " wurde erstellt!\n"; - datei.clear(); - datei.open(Path, ios::in | ios::out); - } - if (datei.good()){ - for( c = 0; c < max; ++c ){ - datei.getline(read ,128, '\n'); - if (read == NULL) - snprintf (read, (size_t)20, "0"); - out[c] = atoi(read); - } - out[Position] = NewValue; - datei.clear(); - datei.seekg (0, ios::beg); - for( c = 0; c < max; ++c ){ - datei << out[c] << endl; - } - datei.close(); - } - else { - cout << "Konnte Datei " << Path << " nicht erstellen!\n"; - } - return 0; -} -int makeData(char *Path, int NewValue, int max) -{ - int c = max; - ofstream fout; - fout.open(Path); - if (fout.fail()){ - fout.clear(); - fout.open(Path); - fout.close(); - cout << "Datei " << Path << " wurde erstellt!\n"; - fout.clear(); - fout.open(Path); - } - if (fout.good()){ - for( c = 0; c < max; ++c ) - fout << NewValue << endl; - fout.close(); - } - else { - cout << "Konnte Datei " << Path << " nicht erstellen!\n"; - } - return 0; -} -int writeCharData(char *Path, char *CHAR1, char *CHAR2, char *CHAR3) -{ - ofstream fout(Path); - if (fout.is_open()) { - fout << CHAR1 << "\n" << CHAR2 << "\n" << CHAR3 << endl; - fout.close(); - } - else cerr << "Konnte Datei nicht erstellen!\n"; - - return 0; -} -int readData(char *Path, int Position, int max) -{ - int c = max; - int out [c]; - char read[128]; - //Lese Byte aus Datei ein - fstream datei; - datei.open(Path, ios::in); - if (datei.fail()){ - datei.clear(); - datei.open(Path, ios::out); - datei.close(); - cout << "Datei " << Path << " wurde erstellt!\n"; - datei.clear(); - datei.open(Path, ios::in); - } - if (datei.good()){ - for( c = 0; c < max; ++c ){ - datei.getline(read ,128, '\n'); - if (read == NULL) - snprintf (read, (size_t)20, "0"); - out[c] = atoi(read); - } - datei.close(); - } - else { - cout << "Konnte Datei " << Path << " nicht erstellen!\n"; - } - return out[Position]; -} -int writeRscp(int Position, int NewValue) -{ - char PathRscp [128]; - snprintf (PathRscp, (size_t)128, "/mnt/RAMDisk/E3dcRscpData.txt"); - writeData(PathRscp, Position, NewValue, PosMAX); - return 1; -} -int writeCharRscp(char *TAG_EMS_OUT_DATE, char *TAG_EMS_OUT_TIME, char *TAG_EMS_OUT_SERIAL_NUMBER) -{ - char PathRscp [128]; - snprintf (PathRscp, (size_t)128, "/mnt/RAMDisk/E3dcGuiChar.txt"); - writeCharData(PathRscp, TAG_EMS_OUT_DATE, TAG_EMS_OUT_TIME, TAG_EMS_OUT_SERIAL_NUMBER); - return 1; -} -int makeCharRscp() -{ - char TAG_Date [128], TAG_Time [128], serialnumber [128]; - snprintf (TAG_Date, (size_t)128, "01.01.2016"); - snprintf (TAG_Time, (size_t)128, "00:00:00"); - snprintf (serialnumber, (size_t)128, "S10-XXXXXXXXXXXX"); - writeCharRscp(TAG_Date, TAG_Time, serialnumber); - return 1; -} -int writeRscpWb(int Position, int NewValue) -{ - char PathRscpWb [128]; - snprintf (PathRscpWb, (size_t)128, "/mnt/RAMDisk/E3dcRscpWbData.txt"); - writeData(PathRscpWb, Position, NewValue, PosWbMAX); - return 1; -} -int checkBit(int Value, int Bit) -{ - bool response = Value&Bit; - if(response)return 1; - else return 0; -} -int writeUnixtime(int Position, int NewTime) -{ - char PathUnixtime [128]; - snprintf (PathUnixtime, (size_t)128, "/mnt/RAMDisk/Unixtime.txt"); - writeData(PathUnixtime, Position, NewTime, UnixtimeMAX); - return 1; -} -int write900(int Position, char *fileName, int NewValue, int Counter900) -{ - if ( GUI == 1 && E3DC_S10 == 1){ - char Path900 [128]; - snprintf (Path900, (size_t)128, "/mnt/RAMDisk/Rscp900.txt"); - int read900 = readData(Path900, Position, PosMAX900); - NewValue = read900 + NewValue; - if (Counter900 == 900){ - NewValue = NewValue / 900; - readWrite900(fileName, NewValue); - writeData(Path900, Position, 1, PosMAX900); - } - else { - writeData(Path900, Position, NewValue, PosMAX900); - } - } - return 0; -} -int make900() -{ - if ( GUI == 1 && E3DC_S10 == 1){ - char Path [128]; - snprintf (Path, (size_t)128, "/mnt/RAMDisk/Rscp900.txt"); - makeData(Path, 1, PosMAX900); - } - return 1; -} -int writeHistory(int Position, int NewValue, int writedata) -{ - if (writedata == today || writedata == yesterday){ - char filePath[128]; - if (writedata == today){ - snprintf (filePath, (size_t)128, "%s", today_path); - } - else if (writedata == yesterday){ - snprintf (filePath, (size_t)128, "%s", yesterday_path); - } - writeData(filePath, Position, NewValue, dataMax); - return 1; - } - else return 0; -} -int writeHistoryTime(int Position,int AktuellTime, int NewValue, int writedata) -{ - int ret; - if(writedata == today) - ret = writeHistory(Position, AktuellTime, writedata); - else if(writedata == yesterday) - ret = writeHistory(Position, NewValue, writedata); - return ret; -} diff --git a/Rscp/RWData.h b/Rscp/RWData.h index c0ba84b..ed6a8bd 100644 --- a/Rscp/RWData.h +++ b/Rscp/RWData.h @@ -1,24 +1,294 @@ #ifndef __RWData_H_ #define __RWData_H_ -void printsendHM(int CounterHM, int id, float value); -void printsendCharHM(int CounterHM, int id, char value[32]); -void printsendBitHM(int CounterHM, int id, int Value, int Bit); -void readWrite900(char *fileName, int NewValue); -int writeData(char *Path, int Position, int NewValue, int max); -int makeData(char *Path, int NewValue, int max); -int writeCharData(char *Path, char *CHAR1, char *CHAR2, char *CHAR3); -int readData(char *Path, int Position, int max); -int writeRscp(int Position, int NewValue); -int makeRscp(); -int writeCharRscp(char *TAG_EMS_OUT_DATE, char *TAG_EMS_OUT_TIME, char *TAG_EMS_OUT_SERIAL_NUMBER); -int makeCharRscp(); -int writeRscpWb(int Position, int NewValue); -int checkBit(int Value, int Bit); -int writeUnixtime(int Position, int NewTime); -int write900(int Position, char *fileName, int NewValue, int Counter900); -int make900(); -int writeHistory(int Position, int NewValue, int writedata); -int writeHistoryTime(int Position,int AktuellTime, int NewValue, int writedata); +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +using namespace std; + +void printsendHM(int CounterHM, int id, float value) +{ + if(Homematic_E3DC == 1){ + if(CounterHM == HM_Intervall && id != 0){ + char batch[128]; + memset(batch, 0x00, sizeof(batch)); + snprintf(batch, sizeof(batch), "curl -s \"http://%s/config/xmlapi/statechange.cgi?ise_id=%i&new_value=%.1f\" > /dev/null 2>&1",HM_IP , id, value); + printf("send to Homematic ISE_ID %i new Value = %.3f\n",id, value); + system(batch); + } + } +} +void printsendCharHM(int CounterHM, int id, char value[32]) +{ + if(Homematic_E3DC == 1){ + if(CounterHM == HM_Intervall && id != 0){ + char batch[128]; + memset(batch, 0x00, sizeof(batch)); + snprintf(batch, sizeof(batch), "curl -s \"http://%s/config/xmlapi/statechange.cgi?ise_id=%i&new_value=%s\" > /dev/null 2>&1",HM_IP , id, value); + printf("send to Homematic ISE_ID %i new Value = %s\n",id, value); + system(batch); + } + } +} +void printsendBitHM(int CounterHM, int id, int Value, int Bit) +{ + if(Homematic_E3DC == 1){ + if(CounterHM == HM_Intervall && id != 0){ + char batch[128]; + memset(batch, 0x00, sizeof(batch)); + bool response = Value&Bit; + if(response){ + snprintf(batch, sizeof(batch), "curl -s \"http://%s/config/xmlapi/statechange.cgi?ise_id=%i&new_value=true\" > /dev/null 2>&1",HM_IP , id); + printf("send to Homematic ISE_ID %i new Value = true\n",id); + } + else { + snprintf(batch, sizeof(batch), "curl -s \"http://%s/config/xmlapi/statechange.cgi?ise_id=%i&new_value=false\" > /dev/null 2>&1",HM_IP , id); + printf("send to Homematic ISE_ID %i new Value = false\n",id); + } + system(batch); + } + } +} +void readWrite900(char *fileName, int NewValue) +{ + int c; + int line[100]; + char read[20]; + char Path [128]; + snprintf (Path, (size_t)128, "/home/pi/E3dcGui/Data/%s.txt", fileName); + fstream datei; + datei.open(Path, ios::in | ios::out); + if (datei.fail()){ + datei.clear(); + datei.open(Path, ios::out); + datei.close(); + cout << "Datei Data/" << fileName << ".txt wurde erstellt!\n"; + datei.clear(); + datei.open(Path, ios::in | ios::out); + } + if (datei.good()){ + for( c = 0; c < 97; ++c ){ + datei.getline(read ,20, '\n'); + if (read == NULL) + snprintf (read, (size_t)20, "0"); + line[c] = atoi(read); + } + datei.clear(); + datei.seekg (0, ios::beg); + for( c = 1; c < 96; ++c ){ + datei << line[c] <<"\n"; + } + datei << NewValue <<"\n"; + datei.close(); + } + else { + cout << "Konnte Datei Data/" << fileName << ".txt nicht erstellen!\n"; + } + return; +} +int writeData(char *Path, int Position, int NewValue, int max) +{ + int c = max; + int out [c]; + char read[128]; + //Lese Wert aus Datei ein + fstream datei; + datei.open(Path, ios::in | ios::out); + if (datei.fail()){ + datei.clear(); + datei.open(Path, ios::out); + datei.close(); + cout << "Datei " << Path << " wurde erstellt!\n"; + datei.clear(); + datei.open(Path, ios::in | ios::out); + } + if (datei.good()){ + for( c = 0; c < max; ++c ){ + datei.getline(read ,128, '\n'); + if (read == NULL) + snprintf (read, (size_t)20, "0"); + out[c] = atoi(read); + } + out[Position] = NewValue; + datei.clear(); + datei.seekg (0, ios::beg); + for( c = 0; c < max; ++c ){ + datei << out[c] << endl; + } + datei.close(); + } + else { + cout << "Konnte Datei " << Path << " nicht erstellen!\n"; + } + return 0; +} +int makeData(char *Path, int NewValue, int max) +{ + int c = max; + ofstream fout; + fout.open(Path); + if (fout.fail()){ + fout.clear(); + fout.open(Path); + fout.close(); + cout << "Datei " << Path << " wurde erstellt!\n"; + fout.clear(); + fout.open(Path); + } + if (fout.good()){ + for( c = 0; c < max; ++c ) + fout << NewValue << endl; + fout.close(); + } + else { + cout << "Konnte Datei " << Path << " nicht erstellen!\n"; + } + return 0; +} +int writeCharData(char *Path, char *CHAR1, char *CHAR2, char *CHAR3) +{ + ofstream fout(Path); + if (fout.is_open()) { + fout << CHAR1 << "\n" << CHAR2 << "\n" << CHAR3 << endl; + fout.close(); + } + else cerr << "Konnte Datei nicht erstellen!\n"; + + return 0; +} +int readData(char *Path, int Position, int max) +{ + int c = max; + int out [c]; + char read[128]; + //Lese Byte aus Datei ein + fstream datei; + datei.open(Path, ios::in); + if (datei.fail()){ + datei.clear(); + datei.open(Path, ios::out); + datei.close(); + cout << "Datei " << Path << " wurde erstellt!\n"; + datei.clear(); + datei.open(Path, ios::in); + } + if (datei.good()){ + for( c = 0; c < max; ++c ){ + datei.getline(read ,128, '\n'); + if (read == NULL) + snprintf (read, (size_t)20, "0"); + out[c] = atoi(read); + } + datei.close(); + } + else { + cout << "Konnte Datei " << Path << " nicht erstellen!\n"; + } + return out[Position]; +} +int writeRscp(int Position, int NewValue) +{ + char PathRscp [128]; + snprintf (PathRscp, (size_t)128, "/mnt/RAMDisk/E3dcRscpData.txt"); + writeData(PathRscp, Position, NewValue, PosMAX); + return 1; +} +int writeCharRscp(char *TAG_EMS_OUT_DATE, char *TAG_EMS_OUT_TIME, char *TAG_EMS_OUT_SERIAL_NUMBER) +{ + char PathRscp [128]; + snprintf (PathRscp, (size_t)128, "/mnt/RAMDisk/E3dcGuiChar.txt"); + writeCharData(PathRscp, TAG_EMS_OUT_DATE, TAG_EMS_OUT_TIME, TAG_EMS_OUT_SERIAL_NUMBER); + return 1; +} +int makeCharRscp() +{ + char TAG_Date [128], TAG_Time [128], serialnumber [128]; + snprintf (TAG_Date, (size_t)128, "01.01.2016"); + snprintf (TAG_Time, (size_t)128, "00:00:00"); + snprintf (serialnumber, (size_t)128, "S10-XXXXXXXXXXXX"); + writeCharRscp(TAG_Date, TAG_Time, serialnumber); + return 1; +} +int writeRscpWb(int Position, int NewValue) +{ + char PathRscpWb [128]; + snprintf (PathRscpWb, (size_t)128, "/mnt/RAMDisk/E3dcRscpWbData.txt"); + writeData(PathRscpWb, Position, NewValue, PosWbMAX); + return 1; +} +int checkBit(int Value, int Bit) +{ + bool response = Value&Bit; + if(response)return 1; + else return 0; +} +int writeUnixtime(int Position, int NewTime) +{ + char PathUnixtime [128]; + snprintf (PathUnixtime, (size_t)128, "/mnt/RAMDisk/Unixtime.txt"); + writeData(PathUnixtime, Position, NewTime, UnixtimeMAX); + return 1; +} +int write900(int Position, char *fileName, int NewValue, int Counter900) +{ + if ( GUI == 1 && E3DC_S10 == 1){ + char Path900 [128]; + snprintf (Path900, (size_t)128, "/mnt/RAMDisk/Rscp900.txt"); + int read900 = readData(Path900, Position, PosMAX900); + NewValue = read900 + NewValue; + if (Counter900 == 900){ + NewValue = NewValue / 900; + readWrite900(fileName, NewValue); + writeData(Path900, Position, 1, PosMAX900); + } + else { + writeData(Path900, Position, NewValue, PosMAX900); + } + } + return 0; +} +int make900() +{ + if ( GUI == 1 && E3DC_S10 == 1){ + char Path [128]; + snprintf (Path, (size_t)128, "/mnt/RAMDisk/Rscp900.txt"); + makeData(Path, 1, PosMAX900); + } + return 1; +} +int writeHistory(int Position, int NewValue, int writedata) +{ + if (writedata == today || writedata == yesterday){ + char filePath[128]; + if (writedata == today){ + snprintf (filePath, (size_t)128, "%s", today_path); + } + else if (writedata == yesterday){ + snprintf (filePath, (size_t)128, "%s", yesterday_path); + } + writeData(filePath, Position, NewValue, dataMax); + return 1; + } + else return 0; +} +int writeHistoryTime(int Position,int AktuellTime, int NewValue, int writedata) +{ + int ret; + if(writedata == today) + ret = writeHistory(Position, AktuellTime, writedata); + else if(writedata == yesterday) + ret = writeHistory(Position, NewValue, writedata); + return ret; +} #endif // __RWData_H_ diff --git a/Rscp/RscpSet.cpp b/Rscp/RscpSet.cpp index b0064c2..1c8dfa7 100644 --- a/Rscp/RscpSet.cpp +++ b/Rscp/RscpSet.cpp @@ -9,6 +9,7 @@ g++ -O3 RscpMain.cpp Rscp/RscpProtocol.cpp Rscp/AES.cpp Rscp/SocketConnection.cp #include "../Rscp/RscpTags.h" #include "../Rscp/SocketConnection.h" #include "../Rscp/AES.h" +#include "../checkPara.h" #include "../Rscp/RWData.h" #include #include @@ -17,7 +18,6 @@ g++ -O3 RscpMain.cpp Rscp/RscpProtocol.cpp Rscp/AES.cpp Rscp/SocketConnection.cp #include #include #include -#include "../parameter.h" static int iSocket = -1; static int iAuthenticated = 0; @@ -404,6 +404,9 @@ static void mainLoop(void) int main(int argc, char *argv[]) { + //Parameter einbinden, checken oder default setzen + checkDefinePara(0); + // Set Mode if (strcmp(argv[1], "-wb")==0) { printf("Wallbox Set Parameter\n"); diff --git a/Rscp/wbCheckHM.c b/Rscp/wbCheckHM.c index 3113a25..e5fc6cd 100644 --- a/Rscp/wbCheckHM.c +++ b/Rscp/wbCheckHM.c @@ -13,15 +13,10 @@ #include #include #include -#include "../parameter.h" +#include "../checkPara.h" #include "../Frame/touch.h" #include "../Frame/touch.c" -#ifdef FONT_8X8 - #include "../Frame/framebuffer.c" -#endif -#ifdef FONT_8X16 - #include "../Frame/framebuffer8x16.c" -#endif +#include "../Frame/framebuffer.c" #include "../Frame/DrawSkala.c" #include "../Frame/DrawLine.c" #include "../Frame/DrawSOC.c" @@ -32,6 +27,9 @@ //#################################### int main(){ + //Parameter einbinden, checken oder default setzen + checkDefinePara(0); + char OUT[128]; char wallboxSendNow[20], wallboxSendMode[20], wallboxSendCurrent[20], wallboxSendBtC[20], wallboxSendBbC[20], wallboxSendStop[20], wallboxSendPhC[20]; char WbMode[24],WbBtC[24],WbBbC[24],WbSet[24]; diff --git a/RscpMain.cpp b/RscpMain.cpp index 6777a08..004235f 100644 --- a/RscpMain.cpp +++ b/RscpMain.cpp @@ -17,7 +17,7 @@ g++ -O3 RscpMain.cpp Rscp/RscpProtocol.cpp Rscp/AES.cpp Rscp/SocketConnection.cp #include #include #include -#include "parameter.h" +#include "checkPara.h" static int iSocket = -1; static int iAuthenticated = 0; @@ -955,6 +955,9 @@ static void mainLoop(void) int main() { + //Parameter einbinden, checken oder default setzen + checkDefinePara(0); + //Dateien erstellen makeCharRscp(); writeRscp(PosPVI, 0); diff --git a/Watchdog.cpp b/Watchdog.cpp index 82ecd9f..0ca2b64 100644 --- a/Watchdog.cpp +++ b/Watchdog.cpp @@ -9,7 +9,7 @@ g++ -O1 Watchdog.cpp -o watchdog #include #include #include -#include "parameter.h" +#include "checkPara.h" #define WDfail 0 #define WDwait 1 @@ -138,6 +138,9 @@ int ping (char* respons) int main() { + //Parameter einbinden, checken oder default setzen + checkDefinePara(0); + int counterReboot = 0,counterRebootHM = 0,counterRebootGUI = 0,resetCounter = 0; int resetTime = resetMin *60 / sleepTimeWD; int jump = 0; diff --git a/checkPara.h b/checkPara.h new file mode 100644 index 0000000..7643b2f --- /dev/null +++ b/checkPara.h @@ -0,0 +1,40 @@ +#ifndef __CHECKPARA_H_ +#define __CHECKPARA_H_ + +#include "/home/pi/E3dcGui/parameter.h" +#include "/home/pi/E3dcGui/parameterHM.h" + +void checkDefine(int print){ +/* +// Nach diesem Beispiel wird eine neue Variable in der "parameter.h geprüft oder ein default Wert gesetzt". + #ifndef GUI + #define GUI 1 + if(print == 1){ + printf("Der Parameter \"GUI\" ist in der \"parameter.h\" nicht vorhanden.\n"); + printf(" Als default wurde für \"GUI\" folgender Wert gesetzt: %i\n", GUI); + sleep(2); + } + #endif +*/ +} + +void checkDefineHM(int print){ +/* +// Nach diesem Beispiel wird eine neue Variable in der "parameterHM.h geprüft oder ein default Wert gesetzt". + #ifndef ISE_TEST + #define ISE_TEST 7 + if(print == 1){ + printf("Der Parameter \"ISE_TEST\" ist in der \"parameterHM.h\" nicht vorhanden.\n"); + printf(" Als default wurde für \"ISE_TEST\" folgender Wert gesetzt: %i\n", ISE_TEST); + sleep(2); + } + #endif +*/ +} + +void checkDefinePara(int print){ + //Parameter Checken oder default setzen + checkDefine(print); + if(Homematic_GUI == 1) checkDefineHM(print); +} +#endif // __CHECKPARA_H_ diff --git a/copyPara.c b/copyPara.c new file mode 100644 index 0000000..af2ac96 --- /dev/null +++ b/copyPara.c @@ -0,0 +1,45 @@ +#include +#include +#include +#include +#include +#include +#include +#include + +int main(int argc, char *argv[]) +{ + char c, d; + + if( access( "/home/pi/E3dcGui/parameter.h", F_OK ) != -1){ + printf("Datei parameter.h ist vorhanden.\n"); + } + else{ + printf("Fehler: parameter.h ist nicht vorhanden.\n Du musst die Datei erstellen.\n"); + printf("Oder soll jetzt kopiert werden? [j/n] :"); + c = getchar(); + if(c == 'j' || c == 'J' || c == 'y' || c == 'Y'){ + system("cp parameter.h.temp parameter.h"); + printf("Die Datei wurde aus der 'parameter.h.temp' kopiert\n und kann nun bearbeitet werden.\n"); + } + else { + printf("Du musst nun die Datei selber erstelln,\n z.B. mit 'cp parameter.h.temp parameter.h'\n"); + } + } + + if( access( "/home/pi/E3dcGui/parameterHM.h", F_OK ) != -1){ + printf("Datei parameterHM.h ist vorhanden.\n"); + } + else{ + printf("Fehler: parameterHM.h ist nicht vorhanden.\n Du musst die Datei erstellen.\n"); + printf("Oder soll jetzt kopiert werden? [j/n] :"); + d = getchar(); + if(d == 'j' || d == 'J' || d == 'y' || d == 'Y'){ + system("cp parameterHM.h.temp parameterHM.h"); + printf("Die Datei wurde aus der 'parameterHM.h.temp' kopiert\n und kann nun bearbeitet werden.\n"); + } + else { + printf("Du musst nun die Datei selber erstelln,\n z.B. mit 'cp parameterHM.h.temp parameterHM.h'\n"); + } + } +} diff --git a/define.h b/define.h index 12fba04..a6ee7ed 100644 --- a/define.h +++ b/define.h @@ -281,6 +281,26 @@ #define DHT5Position 12 //!! #define DHT11MAX 15 //!! +//Spalten +#define SP0 40 //!! +#define SP1 120 //!! +#define SP2 200 //!! +#define SP3 280 //!! +#define SP4 360 //!! +#define SP5 450 //!! +#define SP6 530 //!! +#define SP7 610 //!! +#define SP8 690 //!! +//Reihen +#define RP1 110 //!! +#define RP2 182 //!! +#define RP3 254 //!! +#define RP4 326 //!! +#define RP5 398 //!! +//Größe +#define FPw 50 //!! +#define FPhw 25 //!! + //####################################### #endif // __DEFINE_H_ diff --git a/funktion.h b/funktion.h index bc8419d..b90feb1 100644 --- a/funktion.h +++ b/funktion.h @@ -248,7 +248,7 @@ int drawMainScreen() DrawImage("Wallbox", Picture5, PictureLine1); DrawImage("MonitorImage", Picture6, PictureLine1); } - if(useAktor == 1 && useDHT == 1) + if(useAktor == 1 || useDHT == 1) DrawImage("SmartImage", Picture7, PictureLine1); if(Homematic_GUI ==1) DrawImage("HMImage", Picture8, PictureLine1); @@ -316,7 +316,7 @@ int drawNumber(int x, int y, int input, int typ, int col){ input = input - c * 100; } int d = input / 10; - if(d > 0 || num == 1){ + if(d > 0 || num == 1 || typ == AMP){ drawNo(x,y,d,col); num = 1; } @@ -695,10 +695,27 @@ int madeBy(char *OUT){ } //Killen der Applikationen +int pidCheck(char process[20]) +{ + char line[8], batch[100]; + int pid = 0; + snprintf(batch, sizeof(batch), "pidof -s %s", process); + FILE *cmd = popen(batch, "r"); + fgets(line, 8, cmd); + pid = strtoul(line, NULL, 10); + pclose(cmd); + //printf("PID of %s %ld\n", process, pid); + return pid; +} + int killall() { - system("killall -9 GuiMain RscpMain watchdog wbCheckHM"); - system("sudo killall LedMain"); + if(pidCheck("GuiMain") != 0) system("killall -9 GuiMain"); + if(pidCheck("RscpMain") != 0) system("killall -9 RscpMain"); + if(pidCheck("watchdog") != 0) system("killall -9 watchdog"); + if(pidCheck("wbCheckHM") != 0) system("killall -9 wbCheckHM"); + if(pidCheck("LedMain") != 0) system("sudo killall gruenSave"); + if(pidCheck("gruenSave") != 0) system("killall gruenSave"); } //Hintergrundbeleuhtung ausschalten diff --git a/parameter.h b/parameter.h.temp similarity index 93% rename from parameter.h rename to parameter.h.temp index 5ef0e0f..daf71e4 100644 --- a/parameter.h +++ b/parameter.h.temp @@ -8,7 +8,6 @@ #define GUI 1 //Wichtig! // Wenn die RSCP-Applikation ohne Display genutzt werden soll 0, wenn das Display genutzt wird 1 #define framebuffer_File "/dev/fb0" //Wichtig wenn GUI=1! // Deitei in der die Parameter zum Display gespeichert werden Speicherort abfragen "ls /dev/" meistens "fb0" #define touch_File "/dev/input/event0" //Wichtig wenn GUI=1! // Deitei in der die Parameter zur Touchfunktion gespeichert werden Speicherort abfragen "ls /dev/input/" meistens "event0" kann aber variieren wenn Tastatur / Maus angeschschlossen sind. Auslesen der Datei mit: "udevadm info --name=/dev/input/eventX --attribute-walk" X ersetzen mit 0...7 etc. -#define FONT_8X16 // Schriftgöße einstellen "FONT_8X8" = Normal, "FONT_8X16" = Größer //####################################### //### E3DC S10 Einstellungen ### @@ -21,27 +20,28 @@ #define AES_PASS "1234567890" // RSCP-Schlüssel wie am Display vom S10 eingestellt //####################################### //### Homematic Einstellungen für RSCP-Applikation ### -#define Homematic_E3DC 1 //Wichtig! // Sollen die Daten zur Homematic gesendet werden? Daten senden 1 eintragen sonst 0 +#define Homematic_E3DC 0 //Wichtig! // Sollen die Daten zur Homematic gesendet werden? Daten senden 1 eintragen sonst 0 #define HM_IP "192.168.178.yyy" // IP-Adresse von der Homematic #define HM_Intervall 30 // Sendeintervall der E3DC Daten zur Homematic und Abfrageintevall für Display // ISE-ID der diversen Systemvariablen -#define TAG_EMS_ISE_POWER_PV 38872 -#define TAG_EMS_ISE_POWER_BAT 38873 -#define TAG_EMS_ISE_POWER_HOME 38874 -#define TAG_EMS_ISE_POWER_GRID 38947 -#define TAG_EMS_ISE_POWER_NET_IN 38875 // Die Homematic kann keine negativen Werte auswerten somit wird NetIn und NetOut benötigt -#define TAG_EMS_ISE_POWER_NET_OUT 38876 -#define TAG_BAT_ISE_SOC 38878 -#define TAG_EMS_ISE_UNIXTIME 38946 +#define TAG_EMS_ISE_POWER_PV 0 // ISE_ID_POWER_PV +#define TAG_EMS_ISE_POWER_BAT 0 // ISE_ID_POWER_BAT +#define TAG_EMS_ISE_POWER_HOME 0 // ISE_ID_POWER_HOME +#define TAG_EMS_ISE_POWER_GRID 0 // ISE_ID_POWER_GRID + // Die Homematic kann keine negativen Werte nicht so gut auswerten somit wird NetIn und NetOut eine Option. +#define TAG_EMS_ISE_POWER_NET_IN 0 // ISE_ID_POWER_NET_IN +#define TAG_EMS_ISE_POWER_NET_OUT 0 // ISE_ID_POWER_NET_OUT +#define TAG_BAT_ISE_SOC 0 // ISE_ID_SOC +#define TAG_EMS_ISE_UNIXTIME 0 // ISE_ID_UNIXTIME #define sendTime 0 // Wenn der Zeitstempel gesendet werden soll =1; wenn die HM diesen Berechnen soll =0 -#define ISE_TIMESTAMP_HM 39619 +#define ISE_TIMESTAMP_HM 0 // ISE_ID_TIMESTAMP_HM //Wenn vorhandene Bitte für Additional (Externe-Quelle) ein 1, sonst 0 eintragen. #define Additional 0 -#define TAG_EMS_ISE_POWER_ADD 38877 +#define TAG_EMS_ISE_POWER_ADD 0 // ISE_ID_POWER_ADD //Wenn vorhandene Bitte für die Wallbox ein 1, sonst 0 eintragen. #define Wallbox 0 -#define TAG_EMS_ISE_POWER_WB_ALL 38879 -#define TAG_EMS_ISE_POWER_WB_SOLAR 38880 +#define TAG_EMS_ISE_POWER_WB_ALL 0 // ISE_ID_POWER_WB_ALL +#define TAG_EMS_ISE_POWER_WB_SOLAR 0 // ISE_ID_POWER_WB_SOLAR #define TAG_EMS_ISE_WB_CURRENT 0 // ISE_ID Maximaler Ladestrom #define TAG_EMS_ISE_WB_MODE 0 // ISE_ID Sonnenmodus / Mischmodus #define TAG_EMS_ISE_WB_CHARGE 0 // ISE_ID Auto lädt / Auto lädt nicht @@ -63,15 +63,15 @@ #define Seriennummer 0 #define Autarky 0 #define Eigenstrom 0 -#define TAG_EMS_ISE_SERIAL_NUMBER 38881 -#define TAG_EMS_ISE_AUTARKY 38882 -#define TAG_EMS_ISE_SELFCON 38883 +#define TAG_EMS_ISE_SERIAL_NUMBER 0 // ISE_ID_SERIAL_NUMBER +#define TAG_EMS_ISE_AUTARKY 0 // ISE_ID_AUTARKY +#define TAG_EMS_ISE_SELFCON 0 // ISE_ID_SELFCON //Wieviele Tracker am Wechselrichter sind belegt, 1 oder 2 #define PVI_TRACKER 2 //Weclche Werte sollen vom Tracker/ von den Trackern abgefragt werden #define TRACKER_POWER 1 -#define TAG_EMS_ISE_TRACKER_1 38884 -#define TAG_EMS_ISE_TRACKER_2 38885 +#define TAG_EMS_ISE_TRACKER_1 0 // ISE_ID_TRACKER_1 +#define TAG_EMS_ISE_TRACKER_2 0 // ISE_ID_TRACKER_2 #define TRACKER_VOLTAGE 1 #define TRACKER_CURRENT 1 //Abfragen der History Values diff --git a/parameterHM.h b/parameterHM.h.temp similarity index 100% rename from parameterHM.h rename to parameterHM.h.temp diff --git a/screenSave.c b/screenSave.c index 57dd0c2..745106c 100644 --- a/screenSave.c +++ b/screenSave.c @@ -10,8 +10,7 @@ gcc -g -o screenSave screenSave.c #include #include #include -#include "parameter.h" -#include "parameterHM.h" +#include "checkPara.h" #include "Frame/touch.h" #include "Frame/touch.c" #include "Frame/framebuffer.c" @@ -21,6 +20,9 @@ gcc -g -o screenSave screenSave.c int main() { + //Parameter einbinden, checken oder default setzen + checkDefinePara(0); + picturePosition(); makeScreen(); makeLegende(); @@ -117,25 +119,25 @@ int main() int buttonCordsHistory[4] = {360,410,80,25}; int buttonTimerHistory = mymillis(); - int buttonCordsSD[4] = {S1,R2-20,180,30}; + int buttonCordsSD[4] = {SP1,RP2-20,180,30}; int buttonTimerSD = mymillis(); - int buttonCordsSDN[4] = {S1,R2-20,180,30}; + int buttonCordsSDN[4] = {SP1,RP2-20,180,30}; int buttonTimerSDN = mymillis(); - int buttonCordsSRS[4] = {S1,R3-20,180,30}; + int buttonCordsSRS[4] = {SP1,RP3-20,180,30}; int buttonTimerSRS = mymillis(); - int buttonCordsHRS[4] = {S1,R4-20,180,30}; + int buttonCordsHRS[4] = {SP1,RP4-20,180,30}; int buttonTimerHRS = mymillis(); - int buttonCordsSStop[4] = {S1,R5-20,180,30}; + int buttonCordsSStop[4] = {SP1,RP5-20,180,30}; int buttonTimerSStop = mymillis(); - int buttonCordsBrigh25[4] = {(S4+105),(R1),(Fw+6),(21+3)}; + int buttonCordsBrigh25[4] = {(SP4+105),(RP1),(FPw+6),(21+3)}; int buttonTimerBrigh25 = mymillis(); - int buttonCordsBrigh76[4] = {(S4+160),(R1),(Fw+6),(21+3)}; + int buttonCordsBrigh76[4] = {(SP4+160),(RP1),(FPw+6),(21+3)}; int buttonTimerBrigh76 = mymillis(); - int buttonCordsBrigh150[4] = {(S4+215),(R1),(Fw+6),(21+3)}; + int buttonCordsBrigh150[4] = {(SP4+215),(RP1),(FPw+6),(21+3)}; int buttonTimerBrigh150 = mymillis(); - int buttonCordsBrigh255[4] = {(S4+270),(R1),(Fw+6),(21+3)}; + int buttonCordsBrigh255[4] = {(SP4+270),(RP1),(FPw+6),(21+3)}; int buttonTimerBrigh255 = mymillis(); - int buttonCordsPIR[4] = {(S6-20), R2,(Fw+6),(21+3)}; + int buttonCordsPIR[4] = {(SP6-20), RP2,(FPw+6),(21+3)}; int buttonTimerPIR = mymillis(); int buttonCordsLeSOC[4] = {364,438,50,30}; @@ -704,13 +706,15 @@ int main() WbCurrent = readRscpWb(PosWbCurrent); if(readRscpWb(PosWbMode)==0) snprintf (WbMode, (size_t)128, "-mix"); else snprintf (WbMode, (size_t)128, "-sonne"); - if(readRscpWb(PosWbBtC)==1) snprintf (WbBtC, (size_t)128, "-BtCno"); + if(readRscpWb(PosWbBtC)==1) { + snprintf (WbBtC, (size_t)128, "-BtCno"); + if(readRscpWb(PosWbBbC)==0) snprintf (WbBbC, (size_t)128, "-BbCno"); + else snprintf (WbBbC, (size_t)128, "-BbCyes"); + } else { snprintf (WbBtC, (size_t)128, "-BtCyes"); snprintf (WbBbC, (size_t)128, "-BbCno"); } - if(readRscpWb(PosWbBbC)==0) snprintf (WbBbC, (size_t)128, "-BbCno"); - else snprintf (WbBbC, (size_t)128, "-BbCyes"); snprintf (OUT, (size_t)128, "/home/pi/E3dcGui/Rscp/RscpSet -wb %s %i %s %s -no &", WbMode, WbCurrent, WbBtC, WbBbC); system(OUT); sleep(2); diff --git a/screenSaveHM.c b/screenSaveHM.c old mode 100755 new mode 100644 index d0a75dd..a2128cf --- a/screenSaveHM.c +++ b/screenSaveHM.c @@ -10,8 +10,7 @@ gcc -g -o screenSaveHM screenSaveHM.c #include #include #include -#include "parameter.h" -#include "parameterHM.h" +#include "checkPara.h" #include "Frame/touch.h" #include "Frame/touch.c" #include "Frame/framebuffer.c" @@ -34,8 +33,11 @@ int main() int screenChange; - system("fbset -fb /dev/fb0 -depth 16"); //Umschalten auf 16Bit Display - system("setterm -cursor off"); //Courser Abschalten + //Umschalten auf 16Bit Display + char OUT[128]; + snprintf (OUT, (size_t)128, "fbset -fb %s -depth 16", framebuffer_File); + system(OUT); + //system("setterm -cursor off"); //Courser Abschalten int screenShutdown = ShutdownRun; diff --git a/start.c b/start.c index a65b938..288b7e0 100644 --- a/start.c +++ b/start.c @@ -9,8 +9,7 @@ gcc -g -o start start.c #include #include #include -#include "parameter.h" -#include "parameterHM.h" +#include "checkPara.h" #include "Frame/touch.h" #include "Frame/touch.c" #include "Frame/framebuffer.c" @@ -20,6 +19,9 @@ gcc -g -o start start.c int main() { + //Parameter einbinden, checken oder default setzen + checkDefinePara(1); + sleep(2); if(GUI == 1){ if(E3DC_S10 ==1){ diff --git a/stop.c b/stop.c index 435c96a..9c2cad8 100644 --- a/stop.c +++ b/stop.c @@ -10,8 +10,7 @@ gcc -g -o stop stop.c #include #include #include -#include "parameter.h" -#include "parameterHM.h" +#include "checkPara.h" #include "Frame/touch.h" #include "Frame/touch.c" #include "Frame/framebuffer.c" @@ -21,6 +20,9 @@ gcc -g -o stop stop.c int main() { + //Parameter einbinden, checken oder default setzen + checkDefinePara(0); + signal(SIGINT, INThandler); int xres,yres,x; @@ -47,5 +49,7 @@ int main() killall(); screenOn(); drawSquare(360,3,440,240,BLACK); - system("killall -9 screenSave screenSaveHM"); + system("setterm -cursor on"); + if(pidCheck("screenSaveHM") != 0) system("killall -9 screenSaveHM"); + if(pidCheck("screenSave") != 0) system("killall -9 screenSave"); }