Reed-input working
This commit is contained in:
		| @@ -12,7 +12,8 @@ | |||||||
| platform = espressif8266 | platform = espressif8266 | ||||||
| board = d1_mini | board = d1_mini | ||||||
| board_build.filesystem = littlefs | board_build.filesystem = littlefs | ||||||
| board_build.ldscript = eagle.flash.4m2m.ld | board_build.f_flash = 80000000L | ||||||
|  | board_build.ldscript = eagle.flash.4m1m.ld | ||||||
|  |  | ||||||
| framework = arduino | framework = arduino | ||||||
| lib_deps = | lib_deps = | ||||||
|   | |||||||
							
								
								
									
										27
									
								
								src/main.cpp
									
									
									
									
									
								
							
							
						
						
									
										27
									
								
								src/main.cpp
									
									
									
									
									
								
							| @@ -33,14 +33,18 @@ enum Parties | |||||||
| void SevenSeg_Output(); | void SevenSeg_Output(); | ||||||
| void ticker_callback(); | void ticker_callback(); | ||||||
| void serialOut_callback(); | void serialOut_callback(); | ||||||
|  | void inputGetter_callback(); | ||||||
|  |  | ||||||
| TM1637Display disp_GOF(CLK, DIO_GOF_7SEG); | TM1637Display disp_GOF(CLK, DIO_GOF_7SEG); | ||||||
| TM1637Display disp_MIL(CLK, DIO_MIL_7SEG); | TM1637Display disp_MIL(CLK, DIO_MIL_7SEG); | ||||||
| TM1637Display disp_KGG(CLK, DIO_KGG_7SEG); | TM1637Display disp_KGG(CLK, DIO_KGG_7SEG); | ||||||
|  |  | ||||||
| DNSServer dnsServer; | DNSServer dnsServer; | ||||||
| AsyncWebServer server(80); | AsyncWebServer server(80); | ||||||
|  |  | ||||||
| Ticker PartyTicker(ticker_callback, 500, 0, MILLIS); | Ticker PartyTicker(ticker_callback, 500, 0, MILLIS); | ||||||
| Ticker SerialOutputTicker(serialOut_callback, 5000, 0, MILLIS); | Ticker SerialOutputTicker(serialOut_callback, 5000, 0, MILLIS); | ||||||
|  | Ticker InputGetterTicker(inputGetter_callback, 500, 0, MILLIS); | ||||||
|  |  | ||||||
| Parties activeParty = NONE; | Parties activeParty = NONE; | ||||||
|  |  | ||||||
| @@ -205,6 +209,26 @@ void serialOut_callback() | |||||||
|   SerialPrintCount++; |   SerialPrintCount++; | ||||||
| } | } | ||||||
|  |  | ||||||
|  | void inputGetter_callback() | ||||||
|  | { | ||||||
|  |   activeParty = NONE; | ||||||
|  |  | ||||||
|  |   if (digitalRead(DIO_GOF_TRG) + digitalRead(DIO_MIL_TRG) + digitalRead(DIO_KGG_TRG) < 2) | ||||||
|  |   { | ||||||
|  |     Serial.println("ERROR: More than one Flag active"); | ||||||
|  |     return; | ||||||
|  |   } | ||||||
|  |  | ||||||
|  |   if (digitalRead(DIO_GOF_TRG) == LOW) | ||||||
|  |     activeParty = GOF; | ||||||
|  |  | ||||||
|  |   if (digitalRead(DIO_KGG_TRG) == LOW) | ||||||
|  |     activeParty = KGG; | ||||||
|  |  | ||||||
|  |   if (digitalRead(DIO_MIL_TRG) == LOW) | ||||||
|  |     activeParty = MILIZ; | ||||||
|  | } | ||||||
|  |  | ||||||
| void setup() | void setup() | ||||||
| { | { | ||||||
|   pinMode(DIO_GOF_TRG, INPUT_PULLUP); |   pinMode(DIO_GOF_TRG, INPUT_PULLUP); | ||||||
| @@ -223,12 +247,15 @@ void setup() | |||||||
|  |  | ||||||
|   PartyTicker.start(); |   PartyTicker.start(); | ||||||
|   SerialOutputTicker.start(); |   SerialOutputTicker.start(); | ||||||
|  |   InputGetterTicker.start(); | ||||||
| } | } | ||||||
|  |  | ||||||
| void loop() | void loop() | ||||||
| { | { | ||||||
|   PartyTicker.update(); |   PartyTicker.update(); | ||||||
|   SerialOutputTicker.update(); |   SerialOutputTicker.update(); | ||||||
|  |   InputGetterTicker.update(); | ||||||
|  |  | ||||||
|   dnsServer.processNextRequest(); |   dnsServer.processNextRequest(); | ||||||
|   SevenSeg_Output(); |   SevenSeg_Output(); | ||||||
|  |  | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user