Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
main.cpp@0:34f429428d45, 2017-03-28 (annotated)
- Committer:
- SimonLie
- Date:
- Tue Mar 28 09:07:49 2017 +0000
- Revision:
- 0:34f429428d45
inital version
Who changed what in which revision?
| User | Revision | Line number | New contents of line |
|---|---|---|---|
| SimonLie | 0:34f429428d45 | 1 | /* Includes */ |
| SimonLie | 0:34f429428d45 | 2 | #include "mbed.h" |
| SimonLie | 0:34f429428d45 | 3 | #include "RTC.h" |
| SimonLie | 0:34f429428d45 | 4 | |
| SimonLie | 0:34f429428d45 | 5 | /* Defines */ |
| SimonLie | 0:34f429428d45 | 6 | #define nWATERINGDURATIONDAY 180 //Sekunden = 3 Minuten |
| SimonLie | 0:34f429428d45 | 7 | #define nWATERINGDURATIONNIGHT 600 //Sekunden = 10 Minuten |
| SimonLie | 0:34f429428d45 | 8 | #define nCHECKBTTNINTERVAL 0.025 |
| SimonLie | 0:34f429428d45 | 9 | #define nCHECKROTARYSWITCHINTERVAL 1 |
| SimonLie | 0:34f429428d45 | 10 | #define nCHECKNIGHTWATERINGINTERVAL 1 |
| SimonLie | 0:34f429428d45 | 11 | |
| SimonLie | 0:34f429428d45 | 12 | /* Funktionsstrukturen */ |
| SimonLie | 0:34f429428d45 | 13 | void vfInit(); |
| SimonLie | 0:34f429428d45 | 14 | void vfQueueCourt(unsigned char bCourtNumber); |
| SimonLie | 0:34f429428d45 | 15 | void vfBttnOnP3(); |
| SimonLie | 0:34f429428d45 | 16 | void vfBttnOnP4(); |
| SimonLie | 0:34f429428d45 | 17 | void vfBttnOnP5(); |
| SimonLie | 0:34f429428d45 | 18 | void vfBttnOnP6(); |
| SimonLie | 0:34f429428d45 | 19 | void vfBttnOnP7(); |
| SimonLie | 0:34f429428d45 | 20 | void vfBttnOnP8(); |
| SimonLie | 0:34f429428d45 | 21 | void vfEndWateringP3(); |
| SimonLie | 0:34f429428d45 | 22 | void vfEndWateringP4(); |
| SimonLie | 0:34f429428d45 | 23 | void vfEndWateringP5(); |
| SimonLie | 0:34f429428d45 | 24 | void vfEndWateringP6(); |
| SimonLie | 0:34f429428d45 | 25 | void vfEndWateringP7(); |
| SimonLie | 0:34f429428d45 | 26 | void vfEndWateringP8(); |
| SimonLie | 0:34f429428d45 | 27 | void vfWaterNextCourt(); |
| SimonLie | 0:34f429428d45 | 28 | void vfShiftCourtQueue(unsigned char bCourtNumber); |
| SimonLie | 0:34f429428d45 | 29 | void vfWateringAllCourts(); |
| SimonLie | 0:34f429428d45 | 30 | void vfResetFlag(); |
| SimonLie | 0:34f429428d45 | 31 | unsigned char bfGetRotarySwitchValue(); |
| SimonLie | 0:34f429428d45 | 32 | void vfCheckBttns(); |
| SimonLie | 0:34f429428d45 | 33 | void vfCheckRotarySwitch(); |
| SimonLie | 0:34f429428d45 | 34 | void vfCheckNightWatering(); |
| SimonLie | 0:34f429428d45 | 35 | |
| SimonLie | 0:34f429428d45 | 36 | /* Pinfunktionen */ |
| SimonLie | 0:34f429428d45 | 37 | /* Button Ein */ |
| SimonLie | 0:34f429428d45 | 38 | DigitalIn diBttnOnP3(PB_15); //Button-Ein für Platz 3 |
| SimonLie | 0:34f429428d45 | 39 | DigitalIn diBttnOnP4(PC_2); //Button-Ein für Platz 4 |
| SimonLie | 0:34f429428d45 | 40 | DigitalIn diBttnOnP5(PC_3); //Button-Ein für Platz 5 |
| SimonLie | 0:34f429428d45 | 41 | DigitalIn diBttnOnP6(PB_12); //Button-Ein für Platz 6 |
| SimonLie | 0:34f429428d45 | 42 | DigitalIn diBttnOnP7(PB_2); //Button-Ein für Platz 7 |
| SimonLie | 0:34f429428d45 | 43 | DigitalIn diBttnOnP8(PB_1); //Button-Ein für Platz 8 |
| SimonLie | 0:34f429428d45 | 44 | /* Button Aus */ |
| SimonLie | 0:34f429428d45 | 45 | DigitalIn diBttnOffP3(PA_11); //Button-Aus für Platz 3 |
| SimonLie | 0:34f429428d45 | 46 | DigitalIn diBttnOffP4(PC_6); //Button-Aus für Platz 4 |
| SimonLie | 0:34f429428d45 | 47 | DigitalIn diBttnOffP5(PC_12); //Button-Aus für Platz 5 |
| SimonLie | 0:34f429428d45 | 48 | DigitalIn diBttnOffP6(PC_5); //Button-Aus für Platz 6 |
| SimonLie | 0:34f429428d45 | 49 | DigitalIn diBttnOffP7(PB_7); //Button-Aus für Platz 7 |
| SimonLie | 0:34f429428d45 | 50 | DigitalIn diBttnOffP8(PC_8); //Button-Aus für Platz 8 |
| SimonLie | 0:34f429428d45 | 51 | /* Relais für LEDs */ |
| SimonLie | 0:34f429428d45 | 52 | DigitalOut doRelaisLEDP3(PA_5); //LED für Platz 3, |
| SimonLie | 0:34f429428d45 | 53 | DigitalOut doRelaisLEDP4(PC_11); //LED für Platz 4, |
| SimonLie | 0:34f429428d45 | 54 | DigitalOut doRelaisLEDP5(PC_9); //LED für Platz 5 |
| SimonLie | 0:34f429428d45 | 55 | DigitalOut doRelaisLEDP6(PC_7); //LED für Platz 6 |
| SimonLie | 0:34f429428d45 | 56 | DigitalOut doRelaisLEDP7(PB_6); //LED für Platz 7 |
| SimonLie | 0:34f429428d45 | 57 | DigitalOut doRelaisLEDP8(PA_7); //LED für Platz 8 |
| SimonLie | 0:34f429428d45 | 58 | /* Relais für Ventile */ |
| SimonLie | 0:34f429428d45 | 59 | DigitalOut doRelaisVentP3(PB_13); //Ventil für Platz 3 |
| SimonLie | 0:34f429428d45 | 60 | DigitalOut doRelaisVentP4(PB_14); //Ventil für Platz 4 |
| SimonLie | 0:34f429428d45 | 61 | DigitalOut doRelaisVentP5(PB_4); //Ventil für Platz 5 |
| SimonLie | 0:34f429428d45 | 62 | DigitalOut doRelaisVentP6(PB_5); //Ventil für Platz 6 |
| SimonLie | 0:34f429428d45 | 63 | DigitalOut doRelaisVentP7(PB_10); //Ventil für Platz 7 |
| SimonLie | 0:34f429428d45 | 64 | DigitalOut doRelaisVentP8(PA_9); //Ventil für Platz 8 |
| SimonLie | 0:34f429428d45 | 65 | /* Schlüsselschalter */ |
| SimonLie | 0:34f429428d45 | 66 | DigitalIn diNightWatering(PC_10); //Schlüsselschalter |
| SimonLie | 0:34f429428d45 | 67 | /* Drehschalter */ |
| SimonLie | 0:34f429428d45 | 68 | DigitalIn diRotarySwitchPin1(PA_1); //Drehschalter Wert 1 |
| SimonLie | 0:34f429428d45 | 69 | DigitalIn diRotarySwitchPin4(PA_4); //Drehschalter Wert 4 |
| SimonLie | 0:34f429428d45 | 70 | DigitalIn diRotarySwitchPin8(PA_0); //Drehschalter Wert 8 |
| SimonLie | 0:34f429428d45 | 71 | DigitalIn diRotarySwitchPin2(PA_10); //Drehschalter Wert 2 |
| SimonLie | 0:34f429428d45 | 72 | |
| SimonLie | 0:34f429428d45 | 73 | Serial pc(USBTX,USBRX); |
| SimonLie | 0:34f429428d45 | 74 | |
| SimonLie | 0:34f429428d45 | 75 | |
| SimonLie | 0:34f429428d45 | 76 | /* Nutzfunktionen */ |
| SimonLie | 0:34f429428d45 | 77 | Timeout toEndWateringP3; |
| SimonLie | 0:34f429428d45 | 78 | Timeout toEndWateringP4; |
| SimonLie | 0:34f429428d45 | 79 | Timeout toEndWateringP5; |
| SimonLie | 0:34f429428d45 | 80 | Timeout toEndWateringP6; |
| SimonLie | 0:34f429428d45 | 81 | Timeout toEndWateringP7; |
| SimonLie | 0:34f429428d45 | 82 | Timeout toEndWateringP8; |
| SimonLie | 0:34f429428d45 | 83 | Timeout toResetFlag; |
| SimonLie | 0:34f429428d45 | 84 | Ticker tkCheckBttns; |
| SimonLie | 0:34f429428d45 | 85 | Ticker tkCheckRotarySwitch; |
| SimonLie | 0:34f429428d45 | 86 | Ticker tkCheckNightWatering; |
| SimonLie | 0:34f429428d45 | 87 | |
| SimonLie | 0:34f429428d45 | 88 | |
| SimonLie | 0:34f429428d45 | 89 | /* Globale Variablen */ |
| SimonLie | 0:34f429428d45 | 90 | unsigned char abCourtQueue[6]={0}; //Warteschlange Bewässerung (immer nur ein Platz wird gewässert) |
| SimonLie | 0:34f429428d45 | 91 | unsigned char bValveState; |
| SimonLie | 0:34f429428d45 | 92 | int i32WateringDurationNight; //Dauer der Bewässerung eines Platzes während der Nacht |
| SimonLie | 0:34f429428d45 | 93 | int i32WateringDurationDay; |
| SimonLie | 0:34f429428d45 | 94 | int i32NightWateringMinute[10]; |
| SimonLie | 0:34f429428d45 | 95 | int i32NightWateringHour[10]; |
| SimonLie | 0:34f429428d45 | 96 | unsigned int abFlagSetzen[6]={0}; |
| SimonLie | 0:34f429428d45 | 97 | unsigned int abFlagZaehler[7]={0}; |
| SimonLie | 0:34f429428d45 | 98 | unsigned int bKeySwitch; |
| SimonLie | 0:34f429428d45 | 99 | unsigned int bNightWateringIsRunning; |
| SimonLie | 0:34f429428d45 | 100 | |
| SimonLie | 0:34f429428d45 | 101 | enum enValveState{ |
| SimonLie | 0:34f429428d45 | 102 | enValveInUse, |
| SimonLie | 0:34f429428d45 | 103 | enValveUnused |
| SimonLie | 0:34f429428d45 | 104 | }; |
| SimonLie | 0:34f429428d45 | 105 | |
| SimonLie | 0:34f429428d45 | 106 | /* Funktionen */ |
| SimonLie | 0:34f429428d45 | 107 | void vfCheckNightWatering(){ |
| SimonLie | 0:34f429428d45 | 108 | unsigned char bSeconds, bMinutes, bHours; |
| SimonLie | 0:34f429428d45 | 109 | int i; |
| SimonLie | 0:34f429428d45 | 110 | if( bKeySwitch == 1 ){ |
| SimonLie | 0:34f429428d45 | 111 | vfGetTime(&bSeconds, &bMinutes, &bHours); |
| SimonLie | 0:34f429428d45 | 112 | for(i = 0; i < 10; i++){ |
| SimonLie | 0:34f429428d45 | 113 | if(i32NightWateringHour[i] == bHours && i32NightWateringMinute[i] == bMinutes && bNightWateringIsRunning == 0){ |
| SimonLie | 0:34f429428d45 | 114 | vfWateringAllCourts(); |
| SimonLie | 0:34f429428d45 | 115 | bNightWateringIsRunning = 1; |
| SimonLie | 0:34f429428d45 | 116 | toResetFlag.attach(&vfResetFlag, 90); //Nach 90 Sekunden wird die Flag resetet |
| SimonLie | 0:34f429428d45 | 117 | } |
| SimonLie | 0:34f429428d45 | 118 | } |
| SimonLie | 0:34f429428d45 | 119 | } |
| SimonLie | 0:34f429428d45 | 120 | } |
| SimonLie | 0:34f429428d45 | 121 | |
| SimonLie | 0:34f429428d45 | 122 | void vfCheckRotarySwitch(){ |
| SimonLie | 0:34f429428d45 | 123 | int i; |
| SimonLie | 0:34f429428d45 | 124 | switch(bfGetRotarySwitchValue()){ |
| SimonLie | 0:34f429428d45 | 125 | default: |
| SimonLie | 0:34f429428d45 | 126 | i32WateringDurationDay = 180; |
| SimonLie | 0:34f429428d45 | 127 | i32WateringDurationNight = 180; //3 Minuten |
| SimonLie | 0:34f429428d45 | 128 | i32NightWateringHour[0] = 23; |
| SimonLie | 0:34f429428d45 | 129 | i32NightWateringMinute[0] = 0; |
| SimonLie | 0:34f429428d45 | 130 | i32NightWateringHour[1] = 4; |
| SimonLie | 0:34f429428d45 | 131 | i32NightWateringMinute[1] = 30; |
| SimonLie | 0:34f429428d45 | 132 | i32NightWateringHour[2] = 7; |
| SimonLie | 0:34f429428d45 | 133 | i32NightWateringMinute[2] = 0; |
| SimonLie | 0:34f429428d45 | 134 | for(i = 3; i < 10; i++){ |
| SimonLie | 0:34f429428d45 | 135 | i32NightWateringMinute[i] = 65; //65 ist unerreichbar |
| SimonLie | 0:34f429428d45 | 136 | i32NightWateringHour[i] = 25; //25 ist unerreichbar |
| SimonLie | 0:34f429428d45 | 137 | } |
| SimonLie | 0:34f429428d45 | 138 | break; |
| SimonLie | 0:34f429428d45 | 139 | case 0: |
| SimonLie | 0:34f429428d45 | 140 | i32WateringDurationDay = 180; |
| SimonLie | 0:34f429428d45 | 141 | i32WateringDurationNight = 180; //3 Minuten |
| SimonLie | 0:34f429428d45 | 142 | i32NightWateringHour[0] = 23; |
| SimonLie | 0:34f429428d45 | 143 | i32NightWateringMinute[0] = 0; |
| SimonLie | 0:34f429428d45 | 144 | i32NightWateringHour[1] = 4; |
| SimonLie | 0:34f429428d45 | 145 | i32NightWateringMinute[1] = 30; |
| SimonLie | 0:34f429428d45 | 146 | i32NightWateringHour[2] = 7; |
| SimonLie | 0:34f429428d45 | 147 | i32NightWateringMinute[2] = 0; |
| SimonLie | 0:34f429428d45 | 148 | for(i = 3; i < 10; i++){ |
| SimonLie | 0:34f429428d45 | 149 | i32NightWateringMinute[i] = 65; //65 ist unerreichbar |
| SimonLie | 0:34f429428d45 | 150 | i32NightWateringHour[i] = 25; //25 ist unerreichbar |
| SimonLie | 0:34f429428d45 | 151 | } |
| SimonLie | 0:34f429428d45 | 152 | break; |
| SimonLie | 0:34f429428d45 | 153 | case 1: |
| SimonLie | 0:34f429428d45 | 154 | i32WateringDurationDay = 180; |
| SimonLie | 0:34f429428d45 | 155 | i32WateringDurationNight = 240; //4 Minuten |
| SimonLie | 0:34f429428d45 | 156 | i32NightWateringHour[0] = 23; |
| SimonLie | 0:34f429428d45 | 157 | i32NightWateringMinute[0] = 0; |
| SimonLie | 0:34f429428d45 | 158 | i32NightWateringHour[1] = 4; |
| SimonLie | 0:34f429428d45 | 159 | i32NightWateringMinute[1] = 30; |
| SimonLie | 0:34f429428d45 | 160 | i32NightWateringHour[2] = 7; |
| SimonLie | 0:34f429428d45 | 161 | i32NightWateringMinute[2] = 0; |
| SimonLie | 0:34f429428d45 | 162 | for(i = 3; i < 10; i++){ |
| SimonLie | 0:34f429428d45 | 163 | i32NightWateringMinute[i] = 65; //65 ist unerreichbar |
| SimonLie | 0:34f429428d45 | 164 | i32NightWateringHour[i] = 25; //25 ist unerreichbar |
| SimonLie | 0:34f429428d45 | 165 | } |
| SimonLie | 0:34f429428d45 | 166 | break; |
| SimonLie | 0:34f429428d45 | 167 | case 2: |
| SimonLie | 0:34f429428d45 | 168 | i32WateringDurationDay = 180; |
| SimonLie | 0:34f429428d45 | 169 | i32WateringDurationNight = 300; //5 Minuten |
| SimonLie | 0:34f429428d45 | 170 | i32NightWateringHour[0] = 23; |
| SimonLie | 0:34f429428d45 | 171 | i32NightWateringMinute[0] = 0; |
| SimonLie | 0:34f429428d45 | 172 | i32NightWateringHour[1] = 4; |
| SimonLie | 0:34f429428d45 | 173 | i32NightWateringMinute[1] = 30; |
| SimonLie | 0:34f429428d45 | 174 | i32NightWateringHour[2] = 7; |
| SimonLie | 0:34f429428d45 | 175 | i32NightWateringMinute[2] = 0; |
| SimonLie | 0:34f429428d45 | 176 | for(i = 3; i < 10; i++){ |
| SimonLie | 0:34f429428d45 | 177 | i32NightWateringMinute[i] = 65; //65 ist unerreichbar |
| SimonLie | 0:34f429428d45 | 178 | i32NightWateringHour[i] = 25; //25 ist unerreichbar |
| SimonLie | 0:34f429428d45 | 179 | } |
| SimonLie | 0:34f429428d45 | 180 | break; |
| SimonLie | 0:34f429428d45 | 181 | case 3: |
| SimonLie | 0:34f429428d45 | 182 | i32WateringDurationDay = 180; |
| SimonLie | 0:34f429428d45 | 183 | i32WateringDurationNight = 180; //3 Minuten |
| SimonLie | 0:34f429428d45 | 184 | i32NightWateringHour[0] = 23; |
| SimonLie | 0:34f429428d45 | 185 | i32NightWateringMinute[0] = 0; |
| SimonLie | 0:34f429428d45 | 186 | i32NightWateringHour[1] = 4; |
| SimonLie | 0:34f429428d45 | 187 | i32NightWateringMinute[1] = 30; |
| SimonLie | 0:34f429428d45 | 188 | for(i = 2; i < 10; i++){ |
| SimonLie | 0:34f429428d45 | 189 | i32NightWateringMinute[i] = 65; //65 ist unerreichbar |
| SimonLie | 0:34f429428d45 | 190 | i32NightWateringHour[i] = 25; //25 ist unerreichbar |
| SimonLie | 0:34f429428d45 | 191 | } |
| SimonLie | 0:34f429428d45 | 192 | break; |
| SimonLie | 0:34f429428d45 | 193 | case 4: |
| SimonLie | 0:34f429428d45 | 194 | i32WateringDurationDay = 180; |
| SimonLie | 0:34f429428d45 | 195 | i32WateringDurationNight = 240; //4 Minuten |
| SimonLie | 0:34f429428d45 | 196 | i32NightWateringHour[0] = 23; |
| SimonLie | 0:34f429428d45 | 197 | i32NightWateringMinute[0] = 0; |
| SimonLie | 0:34f429428d45 | 198 | i32NightWateringHour[1] = 4; |
| SimonLie | 0:34f429428d45 | 199 | i32NightWateringMinute[1] = 30; |
| SimonLie | 0:34f429428d45 | 200 | for(i = 2; i < 10; i++){ |
| SimonLie | 0:34f429428d45 | 201 | i32NightWateringMinute[i] = 65; //65 ist unerreichbar |
| SimonLie | 0:34f429428d45 | 202 | i32NightWateringHour[i] = 25; //25 ist unerreichbar |
| SimonLie | 0:34f429428d45 | 203 | } |
| SimonLie | 0:34f429428d45 | 204 | break; |
| SimonLie | 0:34f429428d45 | 205 | case 5: |
| SimonLie | 0:34f429428d45 | 206 | i32WateringDurationDay = 180; |
| SimonLie | 0:34f429428d45 | 207 | i32WateringDurationNight = 300; //5 Minuten |
| SimonLie | 0:34f429428d45 | 208 | i32NightWateringHour[0] = 23; |
| SimonLie | 0:34f429428d45 | 209 | i32NightWateringMinute[0] = 0; |
| SimonLie | 0:34f429428d45 | 210 | i32NightWateringHour[1] = 4; |
| SimonLie | 0:34f429428d45 | 211 | i32NightWateringMinute[1] = 30; |
| SimonLie | 0:34f429428d45 | 212 | for(i = 2; i < 10; i++){ |
| SimonLie | 0:34f429428d45 | 213 | i32NightWateringMinute[i] = 65; //65 ist unerreichbar |
| SimonLie | 0:34f429428d45 | 214 | i32NightWateringHour[i] = 25; //25 ist unerreichbar |
| SimonLie | 0:34f429428d45 | 215 | } |
| SimonLie | 0:34f429428d45 | 216 | break; |
| SimonLie | 0:34f429428d45 | 217 | case 6: |
| SimonLie | 0:34f429428d45 | 218 | i32WateringDurationDay = 180; |
| SimonLie | 0:34f429428d45 | 219 | i32WateringDurationNight = 360; //6 Minuten |
| SimonLie | 0:34f429428d45 | 220 | i32NightWateringHour[0] = 23; |
| SimonLie | 0:34f429428d45 | 221 | i32NightWateringMinute[0] = 0; |
| SimonLie | 0:34f429428d45 | 222 | i32NightWateringHour[1] = 4; |
| SimonLie | 0:34f429428d45 | 223 | i32NightWateringMinute[1] = 30; |
| SimonLie | 0:34f429428d45 | 224 | for(i = 2; i < 10; i++){ |
| SimonLie | 0:34f429428d45 | 225 | i32NightWateringMinute[i] = 65; //65 ist unerreichbar |
| SimonLie | 0:34f429428d45 | 226 | i32NightWateringHour[i] = 25; //25 ist unerreichbar |
| SimonLie | 0:34f429428d45 | 227 | } |
| SimonLie | 0:34f429428d45 | 228 | break; |
| SimonLie | 0:34f429428d45 | 229 | case 7: |
| SimonLie | 0:34f429428d45 | 230 | i32WateringDurationDay = 180; |
| SimonLie | 0:34f429428d45 | 231 | i32WateringDurationNight = 420; //7 Minuten |
| SimonLie | 0:34f429428d45 | 232 | i32NightWateringHour[0] = 23; |
| SimonLie | 0:34f429428d45 | 233 | i32NightWateringMinute[0] = 0; |
| SimonLie | 0:34f429428d45 | 234 | i32NightWateringHour[1] = 4; |
| SimonLie | 0:34f429428d45 | 235 | i32NightWateringMinute[1] = 30; |
| SimonLie | 0:34f429428d45 | 236 | for(i = 2; i < 10; i++){ |
| SimonLie | 0:34f429428d45 | 237 | i32NightWateringMinute[i] = 65; //65 ist unerreichbar |
| SimonLie | 0:34f429428d45 | 238 | i32NightWateringHour[i] = 25; //25 ist unerreichbar |
| SimonLie | 0:34f429428d45 | 239 | } |
| SimonLie | 0:34f429428d45 | 240 | break; |
| SimonLie | 0:34f429428d45 | 241 | case 8: |
| SimonLie | 0:34f429428d45 | 242 | i32WateringDurationDay = 180; |
| SimonLie | 0:34f429428d45 | 243 | i32WateringDurationNight = 480; //8 Minuten |
| SimonLie | 0:34f429428d45 | 244 | i32NightWateringHour[0] = 23; |
| SimonLie | 0:34f429428d45 | 245 | i32NightWateringMinute[0] = 0; |
| SimonLie | 0:34f429428d45 | 246 | i32NightWateringHour[1] = 4; |
| SimonLie | 0:34f429428d45 | 247 | i32NightWateringMinute[1] = 30; |
| SimonLie | 0:34f429428d45 | 248 | for(i = 2; i < 10; i++){ |
| SimonLie | 0:34f429428d45 | 249 | i32NightWateringMinute[i] = 65; //65 ist unerreichbar |
| SimonLie | 0:34f429428d45 | 250 | i32NightWateringHour[i] = 25; //25 ist unerreichbar |
| SimonLie | 0:34f429428d45 | 251 | } |
| SimonLie | 0:34f429428d45 | 252 | break; |
| SimonLie | 0:34f429428d45 | 253 | case 9: |
| SimonLie | 0:34f429428d45 | 254 | i32WateringDurationDay = 180; |
| SimonLie | 0:34f429428d45 | 255 | i32WateringDurationNight = 540; //9 Minuten |
| SimonLie | 0:34f429428d45 | 256 | i32NightWateringHour[0] = 23; |
| SimonLie | 0:34f429428d45 | 257 | i32NightWateringMinute[0] = 0; |
| SimonLie | 0:34f429428d45 | 258 | i32NightWateringHour[1] = 4; |
| SimonLie | 0:34f429428d45 | 259 | i32NightWateringMinute[1] = 30; |
| SimonLie | 0:34f429428d45 | 260 | for(i = 2; i < 10; i++){ |
| SimonLie | 0:34f429428d45 | 261 | i32NightWateringMinute[i] = 65; //65 ist unerreichbar |
| SimonLie | 0:34f429428d45 | 262 | i32NightWateringHour[i] = 25; //25 ist unerreichbar |
| SimonLie | 0:34f429428d45 | 263 | } |
| SimonLie | 0:34f429428d45 | 264 | break; |
| SimonLie | 0:34f429428d45 | 265 | case 10: |
| SimonLie | 0:34f429428d45 | 266 | i32WateringDurationDay = 180; |
| SimonLie | 0:34f429428d45 | 267 | i32WateringDurationNight = 600; //10 Minuten |
| SimonLie | 0:34f429428d45 | 268 | i32NightWateringHour[0] = 23; |
| SimonLie | 0:34f429428d45 | 269 | i32NightWateringMinute[0] = 0; |
| SimonLie | 0:34f429428d45 | 270 | i32NightWateringHour[1] = 4; |
| SimonLie | 0:34f429428d45 | 271 | i32NightWateringMinute[1] = 30; |
| SimonLie | 0:34f429428d45 | 272 | for(i = 2; i < 10; i++){ |
| SimonLie | 0:34f429428d45 | 273 | i32NightWateringMinute[i] = 65; //65 ist unerreichbar |
| SimonLie | 0:34f429428d45 | 274 | i32NightWateringHour[i] = 25; //25 ist unerreichbar |
| SimonLie | 0:34f429428d45 | 275 | } |
| SimonLie | 0:34f429428d45 | 276 | break; |
| SimonLie | 0:34f429428d45 | 277 | case 11: |
| SimonLie | 0:34f429428d45 | 278 | i32WateringDurationDay = 180; |
| SimonLie | 0:34f429428d45 | 279 | i32WateringDurationNight = 660; //11 Minuten |
| SimonLie | 0:34f429428d45 | 280 | i32NightWateringHour[0] = 23; |
| SimonLie | 0:34f429428d45 | 281 | i32NightWateringMinute[0] = 0; |
| SimonLie | 0:34f429428d45 | 282 | i32NightWateringHour[1] = 4; |
| SimonLie | 0:34f429428d45 | 283 | i32NightWateringMinute[1] = 30; |
| SimonLie | 0:34f429428d45 | 284 | for(i = 2; i < 10; i++){ |
| SimonLie | 0:34f429428d45 | 285 | i32NightWateringMinute[i] = 65; //65 ist unerreichbar |
| SimonLie | 0:34f429428d45 | 286 | i32NightWateringHour[i] = 25; //25 ist unerreichbar |
| SimonLie | 0:34f429428d45 | 287 | } |
| SimonLie | 0:34f429428d45 | 288 | break; |
| SimonLie | 0:34f429428d45 | 289 | case 12: |
| SimonLie | 0:34f429428d45 | 290 | i32WateringDurationDay = 180; |
| SimonLie | 0:34f429428d45 | 291 | i32WateringDurationNight = 720; //12 Minuten |
| SimonLie | 0:34f429428d45 | 292 | i32NightWateringHour[0] = 23; |
| SimonLie | 0:34f429428d45 | 293 | i32NightWateringMinute[0] = 0; |
| SimonLie | 0:34f429428d45 | 294 | i32NightWateringHour[1] = 4; |
| SimonLie | 0:34f429428d45 | 295 | i32NightWateringMinute[1] = 30; |
| SimonLie | 0:34f429428d45 | 296 | for(i = 2; i < 10; i++){ |
| SimonLie | 0:34f429428d45 | 297 | i32NightWateringMinute[i] = 65; //65 ist unerreichbar |
| SimonLie | 0:34f429428d45 | 298 | i32NightWateringHour[i] = 25; //25 ist unerreichbar |
| SimonLie | 0:34f429428d45 | 299 | } |
| SimonLie | 0:34f429428d45 | 300 | break; |
| SimonLie | 0:34f429428d45 | 301 | case 13: |
| SimonLie | 0:34f429428d45 | 302 | i32WateringDurationDay = 180; |
| SimonLie | 0:34f429428d45 | 303 | i32WateringDurationNight = 780; //13 Minuten |
| SimonLie | 0:34f429428d45 | 304 | i32NightWateringHour[0] = 23; |
| SimonLie | 0:34f429428d45 | 305 | i32NightWateringMinute[0] = 0; |
| SimonLie | 0:34f429428d45 | 306 | i32NightWateringHour[1] = 4; |
| SimonLie | 0:34f429428d45 | 307 | i32NightWateringMinute[1] = 30; |
| SimonLie | 0:34f429428d45 | 308 | for(i = 2; i < 10; i++){ |
| SimonLie | 0:34f429428d45 | 309 | i32NightWateringMinute[i] = 65; //65 ist unerreichbar |
| SimonLie | 0:34f429428d45 | 310 | i32NightWateringHour[i] = 25; //25 ist unerreichbar |
| SimonLie | 0:34f429428d45 | 311 | } |
| SimonLie | 0:34f429428d45 | 312 | break; |
| SimonLie | 0:34f429428d45 | 313 | case 14: |
| SimonLie | 0:34f429428d45 | 314 | i32WateringDurationDay = 180; |
| SimonLie | 0:34f429428d45 | 315 | i32WateringDurationNight = 840; //14 Minuten |
| SimonLie | 0:34f429428d45 | 316 | i32NightWateringHour[0] = 23; |
| SimonLie | 0:34f429428d45 | 317 | i32NightWateringMinute[0] = 0; |
| SimonLie | 0:34f429428d45 | 318 | i32NightWateringHour[1] = 4; |
| SimonLie | 0:34f429428d45 | 319 | i32NightWateringMinute[1] = 30; |
| SimonLie | 0:34f429428d45 | 320 | for(i = 2; i < 10; i++){ |
| SimonLie | 0:34f429428d45 | 321 | i32NightWateringMinute[i] = 65; //65 ist unerreichbar |
| SimonLie | 0:34f429428d45 | 322 | i32NightWateringHour[i] = 25; //25 ist unerreichbar |
| SimonLie | 0:34f429428d45 | 323 | } |
| SimonLie | 0:34f429428d45 | 324 | break; |
| SimonLie | 0:34f429428d45 | 325 | case 15: |
| SimonLie | 0:34f429428d45 | 326 | i32WateringDurationDay = 15; |
| SimonLie | 0:34f429428d45 | 327 | i32WateringDurationNight = 15; |
| SimonLie | 0:34f429428d45 | 328 | for(i = 0; i < 10; i++){ |
| SimonLie | 0:34f429428d45 | 329 | i32NightWateringHour[i] = 10+i; //10 Uhr bis 19 Uhr |
| SimonLie | 0:34f429428d45 | 330 | } |
| SimonLie | 0:34f429428d45 | 331 | for(i = 0; i < 10; i++){ |
| SimonLie | 0:34f429428d45 | 332 | i32NightWateringMinute[i] = i * 6; //Alle 6 Minuten |
| SimonLie | 0:34f429428d45 | 333 | } |
| SimonLie | 0:34f429428d45 | 334 | break; |
| SimonLie | 0:34f429428d45 | 335 | } |
| SimonLie | 0:34f429428d45 | 336 | } |
| SimonLie | 0:34f429428d45 | 337 | |
| SimonLie | 0:34f429428d45 | 338 | void vfCheckBttns(){ |
| SimonLie | 0:34f429428d45 | 339 | // static int abFlagZaehler[7]; |
| SimonLie | 0:34f429428d45 | 340 | |
| SimonLie | 0:34f429428d45 | 341 | if(diBttnOnP3.read() == 1) |
| SimonLie | 0:34f429428d45 | 342 | { |
| SimonLie | 0:34f429428d45 | 343 | abFlagZaehler[0]++; |
| SimonLie | 0:34f429428d45 | 344 | if(abFlagZaehler[0] >= 10) |
| SimonLie | 0:34f429428d45 | 345 | { |
| SimonLie | 0:34f429428d45 | 346 | vfBttnOnP3(); |
| SimonLie | 0:34f429428d45 | 347 | abFlagZaehler[0] = 10; |
| SimonLie | 0:34f429428d45 | 348 | } |
| SimonLie | 0:34f429428d45 | 349 | } |
| SimonLie | 0:34f429428d45 | 350 | else |
| SimonLie | 0:34f429428d45 | 351 | abFlagZaehler[0] = 0; |
| SimonLie | 0:34f429428d45 | 352 | |
| SimonLie | 0:34f429428d45 | 353 | if(diBttnOnP4.read() == 1) |
| SimonLie | 0:34f429428d45 | 354 | { |
| SimonLie | 0:34f429428d45 | 355 | abFlagZaehler[1]++; |
| SimonLie | 0:34f429428d45 | 356 | if(abFlagZaehler[1] >= 10) |
| SimonLie | 0:34f429428d45 | 357 | { |
| SimonLie | 0:34f429428d45 | 358 | vfBttnOnP4(); |
| SimonLie | 0:34f429428d45 | 359 | abFlagZaehler[1] = 10; |
| SimonLie | 0:34f429428d45 | 360 | } |
| SimonLie | 0:34f429428d45 | 361 | } |
| SimonLie | 0:34f429428d45 | 362 | else |
| SimonLie | 0:34f429428d45 | 363 | abFlagZaehler[1] = 0; |
| SimonLie | 0:34f429428d45 | 364 | |
| SimonLie | 0:34f429428d45 | 365 | if(diBttnOnP5.read() == 1) |
| SimonLie | 0:34f429428d45 | 366 | { |
| SimonLie | 0:34f429428d45 | 367 | abFlagZaehler[2]++; |
| SimonLie | 0:34f429428d45 | 368 | if(abFlagZaehler[2] >= 10) |
| SimonLie | 0:34f429428d45 | 369 | { |
| SimonLie | 0:34f429428d45 | 370 | vfBttnOnP5(); |
| SimonLie | 0:34f429428d45 | 371 | abFlagZaehler[2] = 10; |
| SimonLie | 0:34f429428d45 | 372 | } |
| SimonLie | 0:34f429428d45 | 373 | } |
| SimonLie | 0:34f429428d45 | 374 | else |
| SimonLie | 0:34f429428d45 | 375 | abFlagZaehler[2] = 0; |
| SimonLie | 0:34f429428d45 | 376 | |
| SimonLie | 0:34f429428d45 | 377 | if(diBttnOnP6.read() == 1) |
| SimonLie | 0:34f429428d45 | 378 | { |
| SimonLie | 0:34f429428d45 | 379 | abFlagZaehler[3]++; |
| SimonLie | 0:34f429428d45 | 380 | if(abFlagZaehler[3] >= 10) |
| SimonLie | 0:34f429428d45 | 381 | { |
| SimonLie | 0:34f429428d45 | 382 | vfBttnOnP6(); |
| SimonLie | 0:34f429428d45 | 383 | abFlagZaehler[3] = 10; |
| SimonLie | 0:34f429428d45 | 384 | } |
| SimonLie | 0:34f429428d45 | 385 | } |
| SimonLie | 0:34f429428d45 | 386 | else |
| SimonLie | 0:34f429428d45 | 387 | abFlagZaehler[3] = 0; |
| SimonLie | 0:34f429428d45 | 388 | |
| SimonLie | 0:34f429428d45 | 389 | if(diBttnOnP7.read() == 1) |
| SimonLie | 0:34f429428d45 | 390 | { |
| SimonLie | 0:34f429428d45 | 391 | abFlagZaehler[4]++; |
| SimonLie | 0:34f429428d45 | 392 | if(abFlagZaehler[4] >= 10) |
| SimonLie | 0:34f429428d45 | 393 | { |
| SimonLie | 0:34f429428d45 | 394 | vfBttnOnP7(); |
| SimonLie | 0:34f429428d45 | 395 | abFlagZaehler[4] = 10; |
| SimonLie | 0:34f429428d45 | 396 | } |
| SimonLie | 0:34f429428d45 | 397 | } |
| SimonLie | 0:34f429428d45 | 398 | else |
| SimonLie | 0:34f429428d45 | 399 | abFlagZaehler[4] = 0; |
| SimonLie | 0:34f429428d45 | 400 | |
| SimonLie | 0:34f429428d45 | 401 | if(diBttnOnP8.read() == 1) |
| SimonLie | 0:34f429428d45 | 402 | { |
| SimonLie | 0:34f429428d45 | 403 | abFlagZaehler[5]++; |
| SimonLie | 0:34f429428d45 | 404 | if(abFlagZaehler[5] >= 10) |
| SimonLie | 0:34f429428d45 | 405 | { |
| SimonLie | 0:34f429428d45 | 406 | vfBttnOnP8(); |
| SimonLie | 0:34f429428d45 | 407 | abFlagZaehler[5] = 10; |
| SimonLie | 0:34f429428d45 | 408 | } |
| SimonLie | 0:34f429428d45 | 409 | } |
| SimonLie | 0:34f429428d45 | 410 | else |
| SimonLie | 0:34f429428d45 | 411 | abFlagZaehler[5] = 0; |
| SimonLie | 0:34f429428d45 | 412 | |
| SimonLie | 0:34f429428d45 | 413 | if(diBttnOffP3.read() == 0){ |
| SimonLie | 0:34f429428d45 | 414 | vfEndWateringP3(); |
| SimonLie | 0:34f429428d45 | 415 | } |
| SimonLie | 0:34f429428d45 | 416 | else if(diBttnOffP4.read() == 0){ |
| SimonLie | 0:34f429428d45 | 417 | vfEndWateringP4(); |
| SimonLie | 0:34f429428d45 | 418 | } |
| SimonLie | 0:34f429428d45 | 419 | else if(diBttnOffP5.read() == 0){ |
| SimonLie | 0:34f429428d45 | 420 | vfEndWateringP5(); |
| SimonLie | 0:34f429428d45 | 421 | } |
| SimonLie | 0:34f429428d45 | 422 | else if(diBttnOffP6.read() == 0){ |
| SimonLie | 0:34f429428d45 | 423 | vfEndWateringP6(); |
| SimonLie | 0:34f429428d45 | 424 | } |
| SimonLie | 0:34f429428d45 | 425 | else if(diBttnOffP7.read() == 0){ |
| SimonLie | 0:34f429428d45 | 426 | vfEndWateringP7(); |
| SimonLie | 0:34f429428d45 | 427 | } |
| SimonLie | 0:34f429428d45 | 428 | else if(diBttnOffP8.read() == 0){ |
| SimonLie | 0:34f429428d45 | 429 | vfEndWateringP8(); |
| SimonLie | 0:34f429428d45 | 430 | } |
| SimonLie | 0:34f429428d45 | 431 | |
| SimonLie | 0:34f429428d45 | 432 | if(diNightWatering.read() == 1) |
| SimonLie | 0:34f429428d45 | 433 | { |
| SimonLie | 0:34f429428d45 | 434 | abFlagZaehler[6]++; |
| SimonLie | 0:34f429428d45 | 435 | if(abFlagZaehler[6] >= 50) |
| SimonLie | 0:34f429428d45 | 436 | { |
| SimonLie | 0:34f429428d45 | 437 | bKeySwitch = 1; |
| SimonLie | 0:34f429428d45 | 438 | abFlagZaehler[6] = 50; |
| SimonLie | 0:34f429428d45 | 439 | } |
| SimonLie | 0:34f429428d45 | 440 | } |
| SimonLie | 0:34f429428d45 | 441 | else |
| SimonLie | 0:34f429428d45 | 442 | { |
| SimonLie | 0:34f429428d45 | 443 | bKeySwitch = 0; |
| SimonLie | 0:34f429428d45 | 444 | abFlagZaehler[6] = 0; |
| SimonLie | 0:34f429428d45 | 445 | } |
| SimonLie | 0:34f429428d45 | 446 | } |
| SimonLie | 0:34f429428d45 | 447 | |
| SimonLie | 0:34f429428d45 | 448 | |
| SimonLie | 0:34f429428d45 | 449 | void vfBttnOnP3(){ |
| SimonLie | 0:34f429428d45 | 450 | if(abFlagSetzen[0] == 0) |
| SimonLie | 0:34f429428d45 | 451 | { |
| SimonLie | 0:34f429428d45 | 452 | doRelaisLEDP3 = 0; //Relais schaltet bei ziehen auf GND |
| SimonLie | 0:34f429428d45 | 453 | abFlagSetzen[0] = 1; |
| SimonLie | 0:34f429428d45 | 454 | vfQueueCourt((unsigned char)3); |
| SimonLie | 0:34f429428d45 | 455 | } |
| SimonLie | 0:34f429428d45 | 456 | } |
| SimonLie | 0:34f429428d45 | 457 | |
| SimonLie | 0:34f429428d45 | 458 | void vfBttnOnP4(){ |
| SimonLie | 0:34f429428d45 | 459 | if(abFlagSetzen[1] == 0) |
| SimonLie | 0:34f429428d45 | 460 | { |
| SimonLie | 0:34f429428d45 | 461 | doRelaisLEDP4 = 0; |
| SimonLie | 0:34f429428d45 | 462 | abFlagSetzen[1] = 1; |
| SimonLie | 0:34f429428d45 | 463 | vfQueueCourt((unsigned char)4); |
| SimonLie | 0:34f429428d45 | 464 | } |
| SimonLie | 0:34f429428d45 | 465 | |
| SimonLie | 0:34f429428d45 | 466 | } |
| SimonLie | 0:34f429428d45 | 467 | |
| SimonLie | 0:34f429428d45 | 468 | void vfBttnOnP5(){ |
| SimonLie | 0:34f429428d45 | 469 | if(abFlagSetzen[2] == 0) |
| SimonLie | 0:34f429428d45 | 470 | { |
| SimonLie | 0:34f429428d45 | 471 | doRelaisLEDP5 = 0; |
| SimonLie | 0:34f429428d45 | 472 | abFlagSetzen[2] = 1; |
| SimonLie | 0:34f429428d45 | 473 | vfQueueCourt((unsigned char)5); |
| SimonLie | 0:34f429428d45 | 474 | } |
| SimonLie | 0:34f429428d45 | 475 | } |
| SimonLie | 0:34f429428d45 | 476 | |
| SimonLie | 0:34f429428d45 | 477 | void vfBttnOnP6(){ |
| SimonLie | 0:34f429428d45 | 478 | if(abFlagSetzen[3] == 0) |
| SimonLie | 0:34f429428d45 | 479 | { |
| SimonLie | 0:34f429428d45 | 480 | doRelaisLEDP6 = 0; |
| SimonLie | 0:34f429428d45 | 481 | abFlagSetzen[3] = 1; |
| SimonLie | 0:34f429428d45 | 482 | vfQueueCourt((unsigned char)6); |
| SimonLie | 0:34f429428d45 | 483 | } |
| SimonLie | 0:34f429428d45 | 484 | } |
| SimonLie | 0:34f429428d45 | 485 | |
| SimonLie | 0:34f429428d45 | 486 | void vfBttnOnP7(){ |
| SimonLie | 0:34f429428d45 | 487 | if(abFlagSetzen[4] == 0) |
| SimonLie | 0:34f429428d45 | 488 | { |
| SimonLie | 0:34f429428d45 | 489 | doRelaisLEDP7 = 0; |
| SimonLie | 0:34f429428d45 | 490 | abFlagSetzen[4] = 1; |
| SimonLie | 0:34f429428d45 | 491 | vfQueueCourt((unsigned char)7); |
| SimonLie | 0:34f429428d45 | 492 | } |
| SimonLie | 0:34f429428d45 | 493 | } |
| SimonLie | 0:34f429428d45 | 494 | |
| SimonLie | 0:34f429428d45 | 495 | void vfBttnOnP8(){ |
| SimonLie | 0:34f429428d45 | 496 | if(abFlagSetzen[5] == 0) |
| SimonLie | 0:34f429428d45 | 497 | { |
| SimonLie | 0:34f429428d45 | 498 | doRelaisLEDP8 = 0; |
| SimonLie | 0:34f429428d45 | 499 | abFlagSetzen[5] = 1; |
| SimonLie | 0:34f429428d45 | 500 | vfQueueCourt((unsigned char)8); |
| SimonLie | 0:34f429428d45 | 501 | } |
| SimonLie | 0:34f429428d45 | 502 | |
| SimonLie | 0:34f429428d45 | 503 | } |
| SimonLie | 0:34f429428d45 | 504 | |
| SimonLie | 0:34f429428d45 | 505 | |
| SimonLie | 0:34f429428d45 | 506 | void vfQueueCourt(unsigned char bCourtNumber){ |
| SimonLie | 0:34f429428d45 | 507 | int i; |
| SimonLie | 0:34f429428d45 | 508 | for( i = 0; i < 6; i++){ |
| SimonLie | 0:34f429428d45 | 509 | if( abCourtQueue[i] == 0 || abCourtQueue[i] == bCourtNumber){ |
| SimonLie | 0:34f429428d45 | 510 | abCourtQueue[i] = bCourtNumber; |
| SimonLie | 0:34f429428d45 | 511 | i = 7; //Abbruch der for-Schleife |
| SimonLie | 0:34f429428d45 | 512 | } |
| SimonLie | 0:34f429428d45 | 513 | } |
| SimonLie | 0:34f429428d45 | 514 | } |
| SimonLie | 0:34f429428d45 | 515 | |
| SimonLie | 0:34f429428d45 | 516 | void vfShiftCourtQueue(unsigned char bCourtNumberDay, unsigned char bCourtNumberNight){ |
| SimonLie | 0:34f429428d45 | 517 | int i,j; |
| SimonLie | 0:34f429428d45 | 518 | for( i = 0; i < 6; i++){ |
| SimonLie | 0:34f429428d45 | 519 | if( abCourtQueue[i] == bCourtNumberDay || abCourtQueue[i] == bCourtNumberNight){ |
| SimonLie | 0:34f429428d45 | 520 | abCourtQueue[i] = 0; |
| SimonLie | 0:34f429428d45 | 521 | } |
| SimonLie | 0:34f429428d45 | 522 | } |
| SimonLie | 0:34f429428d45 | 523 | for( j = 0; j < 5; j++){ |
| SimonLie | 0:34f429428d45 | 524 | for( i = 0; i < 5; i++){ |
| SimonLie | 0:34f429428d45 | 525 | if( abCourtQueue[i] == 0){ |
| SimonLie | 0:34f429428d45 | 526 | abCourtQueue[i] = abCourtQueue[i+1]; |
| SimonLie | 0:34f429428d45 | 527 | abCourtQueue[i+1] = 0; |
| SimonLie | 0:34f429428d45 | 528 | } |
| SimonLie | 0:34f429428d45 | 529 | } |
| SimonLie | 0:34f429428d45 | 530 | } |
| SimonLie | 0:34f429428d45 | 531 | } |
| SimonLie | 0:34f429428d45 | 532 | |
| SimonLie | 0:34f429428d45 | 533 | |
| SimonLie | 0:34f429428d45 | 534 | void vfEndWateringP3(){ |
| SimonLie | 0:34f429428d45 | 535 | doRelaisVentP3 = 1; //Relais wird ausgeschaltet |
| SimonLie | 0:34f429428d45 | 536 | doRelaisLEDP3 = 1; |
| SimonLie | 0:34f429428d45 | 537 | toEndWateringP3.detach(); |
| SimonLie | 0:34f429428d45 | 538 | vfShiftCourtQueue(3,13); |
| SimonLie | 0:34f429428d45 | 539 | bValveState = enValveUnused; |
| SimonLie | 0:34f429428d45 | 540 | abFlagSetzen[0] = 0; |
| SimonLie | 0:34f429428d45 | 541 | } |
| SimonLie | 0:34f429428d45 | 542 | |
| SimonLie | 0:34f429428d45 | 543 | void vfEndWateringP4(){ |
| SimonLie | 0:34f429428d45 | 544 | doRelaisVentP4 = 1; |
| SimonLie | 0:34f429428d45 | 545 | doRelaisLEDP4 = 1; |
| SimonLie | 0:34f429428d45 | 546 | toEndWateringP4.detach(); |
| SimonLie | 0:34f429428d45 | 547 | vfShiftCourtQueue(4,14); |
| SimonLie | 0:34f429428d45 | 548 | bValveState = enValveUnused; |
| SimonLie | 0:34f429428d45 | 549 | abFlagSetzen[1] = 0; |
| SimonLie | 0:34f429428d45 | 550 | } |
| SimonLie | 0:34f429428d45 | 551 | |
| SimonLie | 0:34f429428d45 | 552 | void vfEndWateringP5(){ |
| SimonLie | 0:34f429428d45 | 553 | abFlagSetzen[2] = 0; |
| SimonLie | 0:34f429428d45 | 554 | doRelaisVentP5 = 1; |
| SimonLie | 0:34f429428d45 | 555 | doRelaisLEDP5 = 1; |
| SimonLie | 0:34f429428d45 | 556 | toEndWateringP5.detach(); |
| SimonLie | 0:34f429428d45 | 557 | vfShiftCourtQueue(5,15); |
| SimonLie | 0:34f429428d45 | 558 | bValveState = enValveUnused; |
| SimonLie | 0:34f429428d45 | 559 | abFlagSetzen[2] = 0; |
| SimonLie | 0:34f429428d45 | 560 | } |
| SimonLie | 0:34f429428d45 | 561 | |
| SimonLie | 0:34f429428d45 | 562 | void vfEndWateringP6(){ |
| SimonLie | 0:34f429428d45 | 563 | doRelaisVentP6 = 1; |
| SimonLie | 0:34f429428d45 | 564 | doRelaisLEDP6 = 1; |
| SimonLie | 0:34f429428d45 | 565 | toEndWateringP6.detach(); |
| SimonLie | 0:34f429428d45 | 566 | vfShiftCourtQueue(6,16); |
| SimonLie | 0:34f429428d45 | 567 | bValveState = enValveUnused; |
| SimonLie | 0:34f429428d45 | 568 | abFlagSetzen[3] = 0; |
| SimonLie | 0:34f429428d45 | 569 | } |
| SimonLie | 0:34f429428d45 | 570 | |
| SimonLie | 0:34f429428d45 | 571 | void vfEndWateringP7(){ |
| SimonLie | 0:34f429428d45 | 572 | doRelaisVentP7 = 1; |
| SimonLie | 0:34f429428d45 | 573 | doRelaisLEDP7 = 1; |
| SimonLie | 0:34f429428d45 | 574 | toEndWateringP7.detach(); |
| SimonLie | 0:34f429428d45 | 575 | vfShiftCourtQueue(7,17); |
| SimonLie | 0:34f429428d45 | 576 | bValveState = enValveUnused; |
| SimonLie | 0:34f429428d45 | 577 | abFlagSetzen[4] = 0; |
| SimonLie | 0:34f429428d45 | 578 | } |
| SimonLie | 0:34f429428d45 | 579 | |
| SimonLie | 0:34f429428d45 | 580 | void vfEndWateringP8(){ |
| SimonLie | 0:34f429428d45 | 581 | doRelaisVentP8 = 1; |
| SimonLie | 0:34f429428d45 | 582 | doRelaisLEDP8 = 1; |
| SimonLie | 0:34f429428d45 | 583 | toEndWateringP8.detach(); |
| SimonLie | 0:34f429428d45 | 584 | vfShiftCourtQueue(8,18); |
| SimonLie | 0:34f429428d45 | 585 | bValveState = enValveUnused; |
| SimonLie | 0:34f429428d45 | 586 | abFlagSetzen[5] = 0; |
| SimonLie | 0:34f429428d45 | 587 | } |
| SimonLie | 0:34f429428d45 | 588 | |
| SimonLie | 0:34f429428d45 | 589 | void vfWateringAllCourts(){ |
| SimonLie | 0:34f429428d45 | 590 | unsigned char i; |
| SimonLie | 0:34f429428d45 | 591 | for( i = 18; i >= 13; i-- ){ |
| SimonLie | 0:34f429428d45 | 592 | abFlagSetzen[i-13] = 1; |
| SimonLie | 0:34f429428d45 | 593 | vfQueueCourt(i); |
| SimonLie | 0:34f429428d45 | 594 | } |
| SimonLie | 0:34f429428d45 | 595 | doRelaisLEDP3 = 0; |
| SimonLie | 0:34f429428d45 | 596 | doRelaisLEDP4 = 0; |
| SimonLie | 0:34f429428d45 | 597 | doRelaisLEDP5 = 0; |
| SimonLie | 0:34f429428d45 | 598 | doRelaisLEDP6 = 0; |
| SimonLie | 0:34f429428d45 | 599 | doRelaisLEDP7 = 0; |
| SimonLie | 0:34f429428d45 | 600 | doRelaisLEDP8 = 0; |
| SimonLie | 0:34f429428d45 | 601 | } |
| SimonLie | 0:34f429428d45 | 602 | |
| SimonLie | 0:34f429428d45 | 603 | void vfWaterNextCourt(){ |
| SimonLie | 0:34f429428d45 | 604 | switch(abCourtQueue[0]){ |
| SimonLie | 0:34f429428d45 | 605 | default: |
| SimonLie | 0:34f429428d45 | 606 | break; |
| SimonLie | 0:34f429428d45 | 607 | case 0: |
| SimonLie | 0:34f429428d45 | 608 | bValveState = enValveUnused; |
| SimonLie | 0:34f429428d45 | 609 | break; |
| SimonLie | 0:34f429428d45 | 610 | case 3: |
| SimonLie | 0:34f429428d45 | 611 | doRelaisVentP3 = 0; |
| SimonLie | 0:34f429428d45 | 612 | toEndWateringP3.attach(&vfEndWateringP3, i32WateringDurationDay); |
| SimonLie | 0:34f429428d45 | 613 | bValveState = enValveInUse; |
| SimonLie | 0:34f429428d45 | 614 | break; |
| SimonLie | 0:34f429428d45 | 615 | case 4: |
| SimonLie | 0:34f429428d45 | 616 | doRelaisVentP4 = 0; |
| SimonLie | 0:34f429428d45 | 617 | toEndWateringP4.attach(&vfEndWateringP4, i32WateringDurationDay); |
| SimonLie | 0:34f429428d45 | 618 | bValveState = enValveInUse; |
| SimonLie | 0:34f429428d45 | 619 | break; |
| SimonLie | 0:34f429428d45 | 620 | case 5: |
| SimonLie | 0:34f429428d45 | 621 | doRelaisVentP5 = 0; |
| SimonLie | 0:34f429428d45 | 622 | toEndWateringP5.attach(&vfEndWateringP5, i32WateringDurationDay); |
| SimonLie | 0:34f429428d45 | 623 | bValveState = enValveInUse; |
| SimonLie | 0:34f429428d45 | 624 | break; |
| SimonLie | 0:34f429428d45 | 625 | case 6: |
| SimonLie | 0:34f429428d45 | 626 | doRelaisVentP6 = 0; |
| SimonLie | 0:34f429428d45 | 627 | toEndWateringP6.attach(&vfEndWateringP6, i32WateringDurationDay); |
| SimonLie | 0:34f429428d45 | 628 | bValveState = enValveInUse; |
| SimonLie | 0:34f429428d45 | 629 | break; |
| SimonLie | 0:34f429428d45 | 630 | case 7: |
| SimonLie | 0:34f429428d45 | 631 | doRelaisVentP7 = 0; |
| SimonLie | 0:34f429428d45 | 632 | toEndWateringP7.attach(&vfEndWateringP7, i32WateringDurationDay); |
| SimonLie | 0:34f429428d45 | 633 | bValveState = enValveInUse; |
| SimonLie | 0:34f429428d45 | 634 | break; |
| SimonLie | 0:34f429428d45 | 635 | case 8: |
| SimonLie | 0:34f429428d45 | 636 | doRelaisVentP8 = 0; |
| SimonLie | 0:34f429428d45 | 637 | toEndWateringP8.attach(&vfEndWateringP8, i32WateringDurationDay); |
| SimonLie | 0:34f429428d45 | 638 | bValveState = enValveInUse; |
| SimonLie | 0:34f429428d45 | 639 | break; |
| SimonLie | 0:34f429428d45 | 640 | case 13: |
| SimonLie | 0:34f429428d45 | 641 | if(bKeySwitch == 1){ |
| SimonLie | 0:34f429428d45 | 642 | doRelaisVentP3 = 0; |
| SimonLie | 0:34f429428d45 | 643 | bValveState = enValveInUse; |
| SimonLie | 0:34f429428d45 | 644 | toEndWateringP3.attach(&vfEndWateringP3, i32WateringDurationNight); |
| SimonLie | 0:34f429428d45 | 645 | } |
| SimonLie | 0:34f429428d45 | 646 | else |
| SimonLie | 0:34f429428d45 | 647 | doRelaisVentP3 = 1; |
| SimonLie | 0:34f429428d45 | 648 | break; |
| SimonLie | 0:34f429428d45 | 649 | case 14: |
| SimonLie | 0:34f429428d45 | 650 | if(bKeySwitch == 1){ |
| SimonLie | 0:34f429428d45 | 651 | doRelaisVentP4 = 0; |
| SimonLie | 0:34f429428d45 | 652 | toEndWateringP4.attach(&vfEndWateringP4, i32WateringDurationNight); |
| SimonLie | 0:34f429428d45 | 653 | bValveState = enValveInUse; |
| SimonLie | 0:34f429428d45 | 654 | } |
| SimonLie | 0:34f429428d45 | 655 | else |
| SimonLie | 0:34f429428d45 | 656 | doRelaisVentP4 = 1; |
| SimonLie | 0:34f429428d45 | 657 | break; |
| SimonLie | 0:34f429428d45 | 658 | case 15: |
| SimonLie | 0:34f429428d45 | 659 | if(bKeySwitch == 1){ |
| SimonLie | 0:34f429428d45 | 660 | doRelaisVentP5 = 0; |
| SimonLie | 0:34f429428d45 | 661 | toEndWateringP5.attach(&vfEndWateringP5, i32WateringDurationNight); |
| SimonLie | 0:34f429428d45 | 662 | bValveState = enValveInUse; |
| SimonLie | 0:34f429428d45 | 663 | } |
| SimonLie | 0:34f429428d45 | 664 | else |
| SimonLie | 0:34f429428d45 | 665 | doRelaisVentP5 = 1; |
| SimonLie | 0:34f429428d45 | 666 | break; |
| SimonLie | 0:34f429428d45 | 667 | case 16: |
| SimonLie | 0:34f429428d45 | 668 | if(bKeySwitch == 1){ |
| SimonLie | 0:34f429428d45 | 669 | doRelaisVentP6 = 0; |
| SimonLie | 0:34f429428d45 | 670 | toEndWateringP6.attach(&vfEndWateringP6, i32WateringDurationNight); |
| SimonLie | 0:34f429428d45 | 671 | bValveState = enValveInUse; |
| SimonLie | 0:34f429428d45 | 672 | } |
| SimonLie | 0:34f429428d45 | 673 | else |
| SimonLie | 0:34f429428d45 | 674 | doRelaisVentP6 = 1; |
| SimonLie | 0:34f429428d45 | 675 | break; |
| SimonLie | 0:34f429428d45 | 676 | case 17: |
| SimonLie | 0:34f429428d45 | 677 | if(bKeySwitch == 1){ |
| SimonLie | 0:34f429428d45 | 678 | doRelaisVentP7 = 0; |
| SimonLie | 0:34f429428d45 | 679 | toEndWateringP7.attach(&vfEndWateringP7, i32WateringDurationNight); |
| SimonLie | 0:34f429428d45 | 680 | bValveState = enValveInUse; |
| SimonLie | 0:34f429428d45 | 681 | } |
| SimonLie | 0:34f429428d45 | 682 | else |
| SimonLie | 0:34f429428d45 | 683 | doRelaisVentP7 = 1; |
| SimonLie | 0:34f429428d45 | 684 | break; |
| SimonLie | 0:34f429428d45 | 685 | case 18: |
| SimonLie | 0:34f429428d45 | 686 | if(bKeySwitch == 1){ |
| SimonLie | 0:34f429428d45 | 687 | doRelaisVentP8 = 0; |
| SimonLie | 0:34f429428d45 | 688 | toEndWateringP8.attach(&vfEndWateringP8, i32WateringDurationNight); |
| SimonLie | 0:34f429428d45 | 689 | bValveState = enValveInUse; |
| SimonLie | 0:34f429428d45 | 690 | } |
| SimonLie | 0:34f429428d45 | 691 | else |
| SimonLie | 0:34f429428d45 | 692 | doRelaisVentP8 = 1; |
| SimonLie | 0:34f429428d45 | 693 | break; |
| SimonLie | 0:34f429428d45 | 694 | } |
| SimonLie | 0:34f429428d45 | 695 | |
| SimonLie | 0:34f429428d45 | 696 | } |
| SimonLie | 0:34f429428d45 | 697 | |
| SimonLie | 0:34f429428d45 | 698 | unsigned char bfGetRotarySwitchValue(){ |
| SimonLie | 0:34f429428d45 | 699 | unsigned char bRotarySwitchPin1 = 0; |
| SimonLie | 0:34f429428d45 | 700 | unsigned char bRotarySwitchPin2 = 0; |
| SimonLie | 0:34f429428d45 | 701 | unsigned char bRotarySwitchPin4 = 0; |
| SimonLie | 0:34f429428d45 | 702 | unsigned char bRotarySwitchPin8 = 0; |
| SimonLie | 0:34f429428d45 | 703 | if(diRotarySwitchPin1.read() > (float)0.5) |
| SimonLie | 0:34f429428d45 | 704 | bRotarySwitchPin1 = 1; |
| SimonLie | 0:34f429428d45 | 705 | if(diRotarySwitchPin2.read() > (float)0.5) |
| SimonLie | 0:34f429428d45 | 706 | bRotarySwitchPin2 = 1; |
| SimonLie | 0:34f429428d45 | 707 | if(diRotarySwitchPin4.read() > (float)0.5) |
| SimonLie | 0:34f429428d45 | 708 | bRotarySwitchPin4 = 1; |
| SimonLie | 0:34f429428d45 | 709 | if(diRotarySwitchPin8.read() > (float)0.5) |
| SimonLie | 0:34f429428d45 | 710 | bRotarySwitchPin8 = 1; |
| SimonLie | 0:34f429428d45 | 711 | return ( (bRotarySwitchPin1 * 1) + |
| SimonLie | 0:34f429428d45 | 712 | (bRotarySwitchPin2 * 2) + |
| SimonLie | 0:34f429428d45 | 713 | (bRotarySwitchPin4 * 4) + |
| SimonLie | 0:34f429428d45 | 714 | (bRotarySwitchPin8 * 8) ); |
| SimonLie | 0:34f429428d45 | 715 | } |
| SimonLie | 0:34f429428d45 | 716 | |
| SimonLie | 0:34f429428d45 | 717 | void vfResetFlag(){ |
| SimonLie | 0:34f429428d45 | 718 | bNightWateringIsRunning = 0; |
| SimonLie | 0:34f429428d45 | 719 | } |
| SimonLie | 0:34f429428d45 | 720 | |
| SimonLie | 0:34f429428d45 | 721 | void vfInit(){ |
| SimonLie | 0:34f429428d45 | 722 | /* Initialisierung der Knöpfe und derer Interruptfunktionen */ |
| SimonLie | 0:34f429428d45 | 723 | |
| SimonLie | 0:34f429428d45 | 724 | /* Alle Relais ausschalten */ |
| SimonLie | 0:34f429428d45 | 725 | doRelaisVentP3 = 1; |
| SimonLie | 0:34f429428d45 | 726 | doRelaisVentP4 = 1; |
| SimonLie | 0:34f429428d45 | 727 | doRelaisVentP5 = 1; |
| SimonLie | 0:34f429428d45 | 728 | doRelaisVentP6 = 1; |
| SimonLie | 0:34f429428d45 | 729 | doRelaisVentP7 = 1; |
| SimonLie | 0:34f429428d45 | 730 | doRelaisVentP8 = 1; |
| SimonLie | 0:34f429428d45 | 731 | |
| SimonLie | 0:34f429428d45 | 732 | doRelaisLEDP3 = 1; |
| SimonLie | 0:34f429428d45 | 733 | doRelaisLEDP4 = 1; |
| SimonLie | 0:34f429428d45 | 734 | doRelaisLEDP5 = 1; |
| SimonLie | 0:34f429428d45 | 735 | doRelaisLEDP6 = 1; |
| SimonLie | 0:34f429428d45 | 736 | doRelaisLEDP7 = 1; |
| SimonLie | 0:34f429428d45 | 737 | doRelaisLEDP8 = 1; |
| SimonLie | 0:34f429428d45 | 738 | |
| SimonLie | 0:34f429428d45 | 739 | abFlagSetzen[0] = 0; |
| SimonLie | 0:34f429428d45 | 740 | abFlagSetzen[1] = 0; |
| SimonLie | 0:34f429428d45 | 741 | abFlagSetzen[2] = 0; |
| SimonLie | 0:34f429428d45 | 742 | abFlagSetzen[3] = 0; |
| SimonLie | 0:34f429428d45 | 743 | abFlagSetzen[4] = 0; |
| SimonLie | 0:34f429428d45 | 744 | abFlagSetzen[5] = 0; |
| SimonLie | 0:34f429428d45 | 745 | |
| SimonLie | 0:34f429428d45 | 746 | abFlagZaehler[0] = 0; |
| SimonLie | 0:34f429428d45 | 747 | abFlagZaehler[1] = 0; |
| SimonLie | 0:34f429428d45 | 748 | abFlagZaehler[2] = 0; |
| SimonLie | 0:34f429428d45 | 749 | abFlagZaehler[3] = 0; |
| SimonLie | 0:34f429428d45 | 750 | abFlagZaehler[4] = 0; |
| SimonLie | 0:34f429428d45 | 751 | abFlagZaehler[5] = 0; |
| SimonLie | 0:34f429428d45 | 752 | abFlagZaehler[6] = 0; |
| SimonLie | 0:34f429428d45 | 753 | |
| SimonLie | 0:34f429428d45 | 754 | diBttnOnP3.mode(PullDown); |
| SimonLie | 0:34f429428d45 | 755 | diBttnOnP4.mode(PullDown); |
| SimonLie | 0:34f429428d45 | 756 | diBttnOnP5.mode(PullDown); |
| SimonLie | 0:34f429428d45 | 757 | diBttnOnP6.mode(PullDown); |
| SimonLie | 0:34f429428d45 | 758 | diBttnOnP7.mode(PullDown); |
| SimonLie | 0:34f429428d45 | 759 | diBttnOnP8.mode(PullDown); |
| SimonLie | 0:34f429428d45 | 760 | |
| SimonLie | 0:34f429428d45 | 761 | diBttnOffP3.mode(PullDown); |
| SimonLie | 0:34f429428d45 | 762 | diBttnOffP4.mode(PullDown); |
| SimonLie | 0:34f429428d45 | 763 | diBttnOffP5.mode(PullDown); |
| SimonLie | 0:34f429428d45 | 764 | diBttnOffP6.mode(PullDown); |
| SimonLie | 0:34f429428d45 | 765 | diBttnOffP7.mode(PullDown); |
| SimonLie | 0:34f429428d45 | 766 | diBttnOffP8.mode(PullDown); |
| SimonLie | 0:34f429428d45 | 767 | |
| SimonLie | 0:34f429428d45 | 768 | diRotarySwitchPin1.mode(PullDown); |
| SimonLie | 0:34f429428d45 | 769 | diRotarySwitchPin2.mode(PullDown); |
| SimonLie | 0:34f429428d45 | 770 | diRotarySwitchPin4.mode(PullDown); |
| SimonLie | 0:34f429428d45 | 771 | diRotarySwitchPin8.mode(PullDown); |
| SimonLie | 0:34f429428d45 | 772 | |
| SimonLie | 0:34f429428d45 | 773 | diNightWatering.mode(PullDown); |
| SimonLie | 0:34f429428d45 | 774 | bNightWateringIsRunning = 0; |
| SimonLie | 0:34f429428d45 | 775 | bKeySwitch = 0; |
| SimonLie | 0:34f429428d45 | 776 | |
| SimonLie | 0:34f429428d45 | 777 | tkCheckBttns.attach(&vfCheckBttns, nCHECKBTTNINTERVAL); |
| SimonLie | 0:34f429428d45 | 778 | tkCheckRotarySwitch.attach(&vfCheckRotarySwitch,nCHECKROTARYSWITCHINTERVAL); |
| SimonLie | 0:34f429428d45 | 779 | tkCheckNightWatering.attach(&vfCheckNightWatering,nCHECKNIGHTWATERINGINTERVAL); |
| SimonLie | 0:34f429428d45 | 780 | |
| SimonLie | 0:34f429428d45 | 781 | i32WateringDurationDay = nWATERINGDURATIONDAY; |
| SimonLie | 0:34f429428d45 | 782 | i32WateringDurationNight = nWATERINGDURATIONNIGHT; |
| SimonLie | 0:34f429428d45 | 783 | |
| SimonLie | 0:34f429428d45 | 784 | bValveState = enValveUnused; |
| SimonLie | 0:34f429428d45 | 785 | } |
| SimonLie | 0:34f429428d45 | 786 | |
| SimonLie | 0:34f429428d45 | 787 | int main() { |
| SimonLie | 0:34f429428d45 | 788 | char acTime[6]; |
| SimonLie | 0:34f429428d45 | 789 | unsigned char bcTime[6]; |
| SimonLie | 0:34f429428d45 | 790 | char cBuffer; |
| SimonLie | 0:34f429428d45 | 791 | unsigned char bSeconds, bMinutes, bHours; |
| SimonLie | 0:34f429428d45 | 792 | int i=-1; |
| SimonLie | 0:34f429428d45 | 793 | int j; |
| SimonLie | 0:34f429428d45 | 794 | vfInit(); |
| SimonLie | 0:34f429428d45 | 795 | |
| SimonLie | 0:34f429428d45 | 796 | /* |
| SimonLie | 0:34f429428d45 | 797 | Möglichen Befehle: |
| SimonLie | 0:34f429428d45 | 798 | "z": |
| SimonLie | 0:34f429428d45 | 799 | Gibt die akutelle Uhrzeit in der Konsole aus. |
| SimonLie | 0:34f429428d45 | 800 | "d": |
| SimonLie | 0:34f429428d45 | 801 | Gibt die aktuelle Drehschalterstellung in der Konsole aus. |
| SimonLie | 0:34f429428d45 | 802 | "t": |
| SimonLie | 0:34f429428d45 | 803 | Initialisiert die Zeitsetzung. |
| SimonLie | 0:34f429428d45 | 804 | Beispiel: |
| SimonLie | 0:34f429428d45 | 805 | Es soll die Uhrzeit 22:35:59 eingestellt werden. |
| SimonLie | 0:34f429428d45 | 806 | Befehl: "t223559" |
| SimonLie | 0:34f429428d45 | 807 | */ |
| SimonLie | 0:34f429428d45 | 808 | while(1) { |
| SimonLie | 0:34f429428d45 | 809 | if(pc.readable()){ |
| SimonLie | 0:34f429428d45 | 810 | cBuffer = pc.getc(); |
| SimonLie | 0:34f429428d45 | 811 | if(i >= 0 && i <= 5){ |
| SimonLie | 0:34f429428d45 | 812 | acTime[i] = cBuffer; |
| SimonLie | 0:34f429428d45 | 813 | i++; |
| SimonLie | 0:34f429428d45 | 814 | } |
| SimonLie | 0:34f429428d45 | 815 | if(cBuffer == 't'){ |
| SimonLie | 0:34f429428d45 | 816 | i = 0; |
| SimonLie | 0:34f429428d45 | 817 | } |
| SimonLie | 0:34f429428d45 | 818 | if(cBuffer == 'z'){ |
| SimonLie | 0:34f429428d45 | 819 | vfGetTime(&bSeconds, &bMinutes, &bHours); |
| SimonLie | 0:34f429428d45 | 820 | pc.printf("\n\rAktuelle Zeit:\n\r"); |
| SimonLie | 0:34f429428d45 | 821 | pc.printf("%2u:%2u:%2u\n\r", bHours, bMinutes, bSeconds); |
| SimonLie | 0:34f429428d45 | 822 | } |
| SimonLie | 0:34f429428d45 | 823 | if(cBuffer == 'd'){ |
| SimonLie | 0:34f429428d45 | 824 | pc.printf("\n\rDrehschalterstellung: %u \n\r",bfGetRotarySwitchValue()); |
| SimonLie | 0:34f429428d45 | 825 | } |
| SimonLie | 0:34f429428d45 | 826 | if(i >= 6){ |
| SimonLie | 0:34f429428d45 | 827 | for(j = 0; j<6; j++){ |
| SimonLie | 0:34f429428d45 | 828 | bcTime[j] = acTime[j] - 48; |
| SimonLie | 0:34f429428d45 | 829 | } |
| SimonLie | 0:34f429428d45 | 830 | vfStopRTCOszi(); |
| SimonLie | 0:34f429428d45 | 831 | wait(0.3); |
| SimonLie | 0:34f429428d45 | 832 | vfSetTime((bcTime[4]*10)+bcTime[5],(bcTime[2]*10)+bcTime[3],(bcTime[0]*10)+bcTime[1]); |
| SimonLie | 0:34f429428d45 | 833 | i = -1; |
| SimonLie | 0:34f429428d45 | 834 | vfGetTime(&bSeconds, &bMinutes, &bHours); |
| SimonLie | 0:34f429428d45 | 835 | pc.printf("\n\rAktuelle Zeit:\n\r"); |
| SimonLie | 0:34f429428d45 | 836 | pc.printf("%2u:%2u:%2u\n\r", bHours, bMinutes, bSeconds); |
| SimonLie | 0:34f429428d45 | 837 | } |
| SimonLie | 0:34f429428d45 | 838 | } |
| SimonLie | 0:34f429428d45 | 839 | switch(bValveState){ |
| SimonLie | 0:34f429428d45 | 840 | default: |
| SimonLie | 0:34f429428d45 | 841 | break; |
| SimonLie | 0:34f429428d45 | 842 | case enValveUnused: |
| SimonLie | 0:34f429428d45 | 843 | vfWaterNextCourt(); |
| SimonLie | 0:34f429428d45 | 844 | break; |
| SimonLie | 0:34f429428d45 | 845 | case enValveInUse: |
| SimonLie | 0:34f429428d45 | 846 | break; |
| SimonLie | 0:34f429428d45 | 847 | } |
| SimonLie | 0:34f429428d45 | 848 | } |
| SimonLie | 0:34f429428d45 | 849 | } |