From 0c530484a5002bd4f21d71c75cff32f321e5f162 Mon Sep 17 00:00:00 2001 From: Seil0 Date: Tue, 31 May 2016 15:26:06 +0200 Subject: [PATCH] Add files via upload --- ActionPi.cpp | 761 +++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 761 insertions(+) create mode 100644 ActionPi.cpp diff --git a/ActionPi.cpp b/ActionPi.cpp new file mode 100644 index 0000000..64bef6a --- /dev/null +++ b/ActionPi.cpp @@ -0,0 +1,761 @@ +/* + * ActionPi.cpp + * + * Copyright 2016 + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, + * MA 02110-1301, USA. + * + * + */ +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + + +using namespace std; + +string removeSpaces(string input); +string removeEdnl(string input); +string removeDp(string input); +string editFolder(string input); +string editDatName(string input); +string gibDateiName(); +string getFolderName(); +void videoAufnehmen(); +int fotoAufnehmen(); +void liveAusgabe(); +void videoAbspeichern(); +void initialisierung(); +void blinken(); +void herunterfahren(); +void programmBeenden(); +void convert(); +void creatNewFolder(); +void creatDCIM(); +bool ordnerExistiert(string pfad); +void pruefeNewFolder(string input); +void rueckschau(string input); +void setStandardWerte(); +void einstellungen(); +void einstellungErhoehen(); +void einstellungVerringern(); +void zuruecksetzten(); +void iso(int richtung); +void helligkeit(int richtung); +void kontrast(int richtung); +void saettigung(int richtung); +void verschlusszeit(int richtung); + + +void setISO ( int iso ); +void setBrightness ( unsigned int brightness ); +void setContrast ( int contrast ); +void setSaturation ( int saturation ); +void setExposureCompensation ( int val ); +void setShutterSpeed ( unsigned int ss ); + + +int getMODI(); +int getREC(); +int getEx1(); +int getEx2(); +int getEx3(); + +#define LED RPI_V2_GPIO_P1_13 +#define MODI RPI_V2_GPIO_P1_22 +#define REC RPI_V2_GPIO_P1_18 +#define Ex1 RPI_V2_GPIO_P1_16 +#define Ex2 RPI_V2_GPIO_P1_15 +#define Ex3 RPI_V2_GPIO_P1_11 + +int valMODI; +int valREC; +int valEx1; +int valEx2; +int valEx3; + +int valISO; +int valHelligkeit; +int valKontrast; +int valSaettigung; +int valVerschlusszeit; +int zaehlerISO = 1; +int zaehlerHelligkeit = 1; +int zaehlerKontrast = 1; +int zaehlerSaettigung = 2; +int zaehlerVerschlusszeit = 4; + +int einstellung = 0; // 0=Verschlusszeit;1=ISO;2=Kontrast;3=Helligkeit;4=Sättigung; +int wieLangeGedrueckt = 0; + +bool aktiv = true; +bool videoAufnahme = false; +bool liveBildWirdAngezeigt = false; + +int main(int argc, char **argv) +{ + creatDCIM(); //prüft ob DCIM Ordner existiert, sollt er nicht existieren wird er erstellt + creatNewFolder(); //prüft ob Datums-Ordner existiert, sollt er nicht existieren wird er erstellt + if (!bcm2835_init()) + return 1; + initialisierung(); + setStandardWerte(); + while (aktiv) + { + if(videoAufnahme && getMODI() ) + { + videoAbspeichern(); + } + if(!liveBildWirdAngezeigt) + { + liveAusgabe(); // Live-Ausgabe wird gestartet + } + if(getREC()) + { + //REC Taster gedrückt + if(getMODI()) + { + //Fotomodus + fotoAufnehmen(); + } + else{ + //Videomodus + if(!videoAufnahme) + { + videoAufnehmen(); + delay(1000); // mindestens 1sec Video + } + else{ + videoAbspeichern(); + } + } +} + if(getMODI()){ + einstellungen(); + einstellungErhoehen(); + einstellungVerringern(); + zuruecksetzten(); + } + delay(100); + programmBeenden(); // prüft ob das Programm beendet werden soll + herunterfahren(); // prüft ob der Pi heruntergefahren werden soll +} //while Ende + bcm2835_close(); + return 0; +} + +void zuruecksetzten() +{ + if(getEx2()){ + if(wieLangeGedrueckt < 20){ + wieLangeGedrueckt = wieLangeGedrueckt +1; + //cout<