Browse Source
			
			
			Merge pull request #113 from SZenglein/queue_race_condition_fix
			
				Fix rare issue where the RFID tag is read before queues are initialized
			
			
				master
			
			
		 
		
			
				
					
						 biologist79
					
					4 years ago
						biologist79
					
					4 years ago
					
						
							committed by
							
								 GitHub
								GitHub
							
						 
					
				 
				
			 
		 
		
			
				
				  
				  No known key found for this signature in database
				  
				  	
						GPG Key ID: 4AEE18F83AFDEB23
				  	
				  
				
			
		
		
		
	
		
			
				 4 changed files with 
9 additions and 
1 deletions
			 
			
		 
		
			
				- 
					
					
					 
					src/LogMessages_DE.cpp
				
- 
					
					
					 
					src/LogMessages_EN.cpp
				
- 
					
					
					 
					src/RfidPn5180.cpp
				
- 
					
					
					 
					src/main.cpp
				
					
					
						
							
								
									
										
											
	
		
			
				
					|  |  | @ -51,6 +51,7 @@ | 
			
		
	
		
			
				
					|  |  |  |     const char trackChangeWebstream[] PROGMEM = "Im Webradio-Modus kann nicht an den Anfang gesprungen werden."; | 
			
		
	
		
			
				
					|  |  |  |     const char endOfPlaylistReached[] PROGMEM = "Ende der Playlist erreicht."; | 
			
		
	
		
			
				
					|  |  |  |     const char trackStartatPos[] PROGMEM = "Titel wird abgespielt ab Position"; | 
			
		
	
		
			
				
					|  |  |  |     const char waitingForTaskQueues[] PROGMEM = "Task Queue für RFID existiert noch nicht, warte..."; | 
			
		
	
		
			
				
					|  |  |  |     const char rfidScannerReady[] PROGMEM = "RFID-Tags koennen jetzt gescannt werden..."; | 
			
		
	
		
			
				
					|  |  |  |     const char rfidTagDetected[] PROGMEM = "RFID-Karte erkannt: "; | 
			
		
	
		
			
				
					|  |  |  |     const char rfid15693TagDetected[] PROGMEM = "RFID-Karte (ISO-15693) erkannt: "; | 
			
		
	
	
		
			
				
					|  |  | 
 | 
			
		
	
										
									
								
							
						 
					 
				 
			
		
			
				
					
					
						
							
								
									
										
											
	
		
			
				
					|  |  | @ -51,6 +51,7 @@ | 
			
		
	
		
			
				
					|  |  |  |     const char trackChangeWebstream[] PROGMEM = "Playing from the very beginning is not possible while webradio-mode is active."; | 
			
		
	
		
			
				
					|  |  |  |     const char endOfPlaylistReached[] PROGMEM = "Reached end of playlist."; | 
			
		
	
		
			
				
					|  |  |  |     const char trackStartatPos[] PROGMEM = "Starting track at position"; | 
			
		
	
		
			
				
					|  |  |  |     const char waitingForTaskQueues[] PROGMEM = "Task Queue for RFID does not exist yet, waiting..."; | 
			
		
	
		
			
				
					|  |  |  |     const char rfidScannerReady[] PROGMEM = "RFID-tags can now be applied..."; | 
			
		
	
		
			
				
					|  |  |  |     const char rfidTagDetected[] PROGMEM = "RFID-tag detected: "; | 
			
		
	
		
			
				
					|  |  |  |     const char rfid15693TagDetected[] PROGMEM = "RFID-ta (ISO-15693) detected: "; | 
			
		
	
	
		
			
				
					|  |  | 
 | 
			
		
	
										
									
								
							
						 
					 
				 
			
		
			
				
					
					
						
							
								
									
										
											
	
		
			
				
					|  |  | @ -95,6 +95,12 @@ extern unsigned long Rfid_LastRfidCheckTimestamp; | 
			
		
	
		
			
				
					|  |  |  |         static byte cardId[cardIdSize], lastCardId[cardIdSize]; | 
			
		
	
		
			
				
					|  |  |  |         uint8_t uid[10]; | 
			
		
	
		
			
				
					|  |  |  | 
 | 
			
		
	
		
			
				
					|  |  |  |         // wait until queues are created
 | 
			
		
	
		
			
				
					|  |  |  |         while(gRfidCardQueue == NULL){ | 
			
		
	
		
			
				
					|  |  |  |             Log_Println((char *) FPSTR(waitingForTaskQueues), LOGLEVEL_DEBUG); | 
			
		
	
		
			
				
					|  |  |  |             vTaskDelay(50); | 
			
		
	
		
			
				
					|  |  |  |         } | 
			
		
	
		
			
				
					|  |  |  | 
 | 
			
		
	
		
			
				
					|  |  |  |         for (;;) { | 
			
		
	
		
			
				
					|  |  |  |             vTaskDelay(portTICK_RATE_MS * 10u); | 
			
		
	
		
			
				
					|  |  |  |             #ifdef PN5180_ENABLE_LPCD
 | 
			
		
	
	
		
			
				
					|  |  | 
 | 
			
		
	
										
									
								
							
						 
					 
				 
			
		
			
				
					
					
						
							
								
									
										
											
	
		
			
				
					|  |  | @ -128,6 +128,7 @@ void printWakeUpReason() { | 
			
		
	
		
			
				
					|  |  |  | 
 | 
			
		
	
		
			
				
					|  |  |  | void setup() { | 
			
		
	
		
			
				
					|  |  |  |     Log_Init(); | 
			
		
	
		
			
				
					|  |  |  |     Queues_Init(); | 
			
		
	
		
			
				
					|  |  |  |     #ifdef RFID_READER_TYPE_PN5180
 | 
			
		
	
		
			
				
					|  |  |  |         Rfid_Init(); | 
			
		
	
		
			
				
					|  |  |  |     #endif
 | 
			
		
	
	
		
			
				
					|  |  | @ -206,7 +207,6 @@ void setup() { | 
			
		
	
		
			
				
					|  |  |  |         Serial.println(F("UNKNOWN")); | 
			
		
	
		
			
				
					|  |  |  |     } | 
			
		
	
		
			
				
					|  |  |  | 
 | 
			
		
	
		
			
				
					|  |  |  |     Queues_Init(); | 
			
		
	
		
			
				
					|  |  |  |     #ifdef PORT_EXPANDER_ENABLE
 | 
			
		
	
		
			
				
					|  |  |  |         Port_Init(); | 
			
		
	
		
			
				
					|  |  |  |     #endif
 | 
			
		
	
	
		
			
				
					|  |  | 
 |