Index: firmware/FSC/src/parser.c
===================================================================
--- firmware/FSC/src/parser.c	(revision 10667)
+++ firmware/FSC/src/parser.c	(revision 10674)
@@ -105,2 +105,202 @@
 	
 }
+
+
+// this is the recent MSR parser
+/////////////////////////////////////////////////////////////////////////////////////////////////////
+/////////////// P A R S E R /////////////////////////////////////////////////////////////////////////
+/////////////////////////////////////////////////////////////////////////////////////////////////////
+// this method parses the data, 
+// which came in via USART
+// later it might as well parse the data from ethernet.
+void MSR_parser() {
+
+U08 input_number = 0;
+bool enable = false;
+// look at first byte
+// I hope, I can manage to use one byte commands
+	usart_rx_buffer[USART_RX_BUFFER_SIZE-1] = 0;
+	usart_write_char(' ');
+	usart_write_str(usart_rx_buffer);
+	usart_write_char('\n');
+	//usart_write_str((pU08)"\n received number of bytes:");
+	//usart_write_U08(usart_rx_buffer_index,3);
+
+	if (usart_rx_buffer_index >0) {
+		switch (usart_rx_buffer[0]) {
+			case 'E': 		// user wants to enable/disable something
+			case 'e':
+				enable = true;
+			case 'D':
+			case 'd':
+			
+				if (usart_rx_buffer_index>=1) {  // let's see what.
+					if ( 	usart_rx_buffer[1] != 'r'  &&
+							usart_rx_buffer[1] != 'v'  &&
+							usart_rx_buffer[1] != 'h'  &&
+							usart_rx_buffer[1] != 'p' )
+						{
+							print_invalid_enable_statement();
+							break;
+						}
+				}
+				
+				input_number = 0;
+				if (usart_rx_buffer_index >2) {  // lets check the first digit
+					if ( usart_rx_buffer[2] >= '0' && usart_rx_buffer[2] <= '9' ) {
+						input_number = usart_rx_buffer[2] - '0';
+					} else {
+						print_invalid_enable_statement();
+						break;
+					}
+				}
+				if (usart_rx_buffer_index >3) {  // lets check the 2nd digit
+					if ( usart_rx_buffer[3] >= '0' && usart_rx_buffer[3] <= '9' ) {
+						input_number = 10*input_number + usart_rx_buffer[3] - '0';
+					} else {
+						// okay as well ... if the second digit is missing .. 
+						// we might have trailing spaces
+						// that's okay .. we just accept the first number.
+					}
+				}
+				if (usart_rx_buffer_index>2) {
+					usart_write_str((pU08)"\n I will switch ");
+					if (enable) 
+						usart_write_str((pU08)"on ");
+					else
+						usart_write_str((pU08)"off ");
+					
+					// now we know, what the user wanted ... and we need to do it.
+					switch (usart_rx_buffer[1]) {
+						case 'r':
+							if (enable)
+								ad7719_enables[input_number/8] |= (1<<(input_number%8));
+							else {
+								ad7719_enables[input_number/8] &= ~(1<<(input_number%8));
+								ad7719_channels_ready[input_number/8] &= ~(1<<(input_number%8));
+								}
+							usart_write_str((pU08)" resistance channel ");
+							usart_write_U08(input_number,2);
+							usart_write_char('\n');
+							break;
+						case 'v':
+							if (enable)
+								adc_enables[input_number/8] |= (1<<(input_number%8));
+							else {
+								adc_enables[input_number/8] &= ~(1<<(input_number%8));
+								adc_channels_ready[input_number/8] &= ~(1<<(input_number%8));
+								}
+							usart_write_str((pU08)" voltage channel ");
+							usart_write_U08(input_number,2);
+							usart_write_char('\n');
+							break;
+							
+						case 'h':
+							if (enable)
+								adc_enables[1] |= (1<<(input_number%4));
+							else {
+								adc_enables[1] &= ~(1<<(input_number%4));
+								adc_channels_ready[1] &= ~(1<<(input_number%4));
+								}
+							usart_write_str((pU08)" humidity channel ");
+							usart_write_U08(input_number,2);
+							usart_write_char('\n');
+							break;
+						case 'p':
+							if (enable)
+								adc_enables[1] |= (1<<((input_number%4) + 4));
+							else {
+								adc_enables[1] &= ~(1<<((input_number%4) + 4));
+								adc_channels_ready[1] &= ~(1<<((input_number%4) + 4));
+								}
+							usart_write_str((pU08)" pressure channel ");
+							usart_write_U08(input_number,2);
+							usart_write_char('\n');
+							break;
+						default:
+							usart_write_str((pU08)"\n DAMN! this should never happen"
+							"- enable/disable switch-case!\n");
+							break;
+					}
+					
+					
+					
+				}// end of if usart_rx_buffer_index>2  --> this should not be necessary at all
+				break;
+				
+			case 'b':
+				usart_write_str((pU08)"\nheartbeat ");
+				heartbeat_enable = true;
+				if (usart_rx_buffer[1] == '0'){
+					heartbeat_enable = false;
+					usart_write_str((pU08)"off\n");
+				} else {
+					usart_write_str((pU08)"on\n");
+				}
+				break;
+			case 'G': 			// GET the Temperature channels, which are enabled
+				ad7719_values_printed = false;
+				for ( U08 i=0; i<CHANNEL_BITMAP; ++i ) {
+					ad7719_channels_ready[i]=0;
+				}
+				break;
+			case 'g':			// GET the voltage/current/humidity channels, which are enabled
+				adc_values_printed = false;
+				for ( U08 i=0; i<V_BITMAP; ++i ) {
+					adc_channels_ready[i]=0;
+				}
+				break;
+
+			case 'p':
+					adc_print_endless = true;
+				if (usart_rx_buffer[1] == '0')
+					adc_print_endless = false;
+				break;		
+
+			case 'P':
+					ad7719_print_endless = true;
+				if (usart_rx_buffer[1] == '0')
+					ad7719_print_endless = false;
+				break;		
+				
+
+			case 's':			
+				print_adc_enable_status(true);
+				usart_write_char('\n');
+
+				print_ad7719_enable_status(true);
+				usart_write_char('\n');
+			
+				usart_write_str((pU08)"time:");
+				usart_write_float((float)local_ms/1000 , 1,7);
+				usart_write_str((pU08)" sec.\n");
+				break;	
+
+			case '!':
+				usart_write_str((pU08)"\ndebug mode ");
+				debug_mode = true;
+				if (usart_rx_buffer[1] == '0'){
+					debug_mode = false;
+					usart_write_str((pU08)"off\n");
+				} else {
+					usart_write_str((pU08)"on\n");
+				}
+				break;		
+				
+			case 'h':
+			case 'H':
+				print_help();
+				break;
+		}
+	} else
+	{
+		// zero bytes received
+	}
+	
+	
+	for (U08 i=0; i<USART_RX_BUFFER_SIZE; ++i)
+		usart_rx_buffer[i] = 0;
+	usart_rx_buffer_index = 0;	
+	usart_rx_ready = false;
+}	// END of MSR_parser();
+
