Index: firmware/FSC/src/application.c
===================================================================
--- firmware/FSC/src/application.c	(revision 17628)
+++ firmware/FSC/src/application.c	(revision 17629)
@@ -1,120 +1,83 @@
-//-----------------------------------------------------------------------------
-
 #include "application.h"
-#include "usart.h"
-#include <avr/wdt.h> 
-
-// in order to implement the "registers" I work with a quite long 
-//  char-array like this:
-
-U08 FSCregister[FSC_REGISTER_LENGTH];
-// but this register is not only accessible by
-// FSCregister[i], but as well by special pointers like this:
-U32 *status 							= (U32*)&FSCregister[0];
-U32 *time_sec 							= (U32*)&(FSCregister[4]);
-U16 *time_ms 							= (U16*)&(FSCregister[6]);
-U16 *FR_period 							= (U16*)&(FSCregister[8]);
-U16 *ref_resistor 						= (U16*)&(FSCregister[10]);
-
-
-U32 *ad7719_values 						= (U32*)&FSCregister[68];
-U08 *ad7719_enables 					= &FSCregister[30];
-U08 *ad7719_channels_ready 				= &FSCregister[49];
-U08 *ad7719_readings_since_last_muxing 	= &FSCregister[14];
-U08 *ad7719_current_channel 			= &FSCregister[15];
-U32 *ad7719_current_reading 			= (U32*)&FSCregister[16];
-
-U16 *adc_values 						= (U16*) &FSCregister[324];
-U08 *adc_enables 						= &FSCregister[38];
-U08 *adc_channels_ready 				= &FSCregister[57];
-U08 *adc_readings_since_last_muxing 	= &FSCregister[20];
-U08 *adc_current_channel 				= &FSCregister[21];
-U16 *adc_current_reading 				= (U16*) &FSCregister[22];
-
-// using these pointers one can manipulate measurement values like this:
-// res_value[3] = 453212;
-// and then readout the most significant byte of this same value by accessing:
-// FSCregister[92]; 
-// I like this very much for asking the boards status ... this is just a copy of the registers,
-// into the W5100 TX FIFO.
-// submitting the measurement values is just a partial copy... 
-
-//-----------------------------------------------------------------------------
-
-//-----------------------------------------------------------------------------
-
-volatile U08 app_reset_source;
-//-----------------------------------------------------------------------------
+#include "w5100_spi_interface.h"
+#include <avr/wdt.h>
+
+// ---------------- These are the global variables that represent the registers 
+// of the entire FSC, everything is stored here and can thus be sent down ----
+FSCRegisterType gReg;
+volatile VolatileRegisterType gVolReg;
+
+
+
 
 void app_init(void) {
-  app_reset_source = MCUSR; // Save last reset source
-  MCUSR = 0x00; // Clear reset source for next reset cycle
-
-
-	// Dangerous here: I still do not know much about the watchdog.
-	// This code is still from Udo Juerss. 
-
-  // The watchdog timer is disabled by default ("startup.asm")
-	#ifdef USE_WATCHDOG
-	 WDTCSR = WDTOE | (1 << WDE); // Enable watchdog reset (~16ms)
-	#endif
-
-	// define PORTS
-	// USART
-	DDRD &= ~(1<<PD0);				// PD0 = RXD is input
-	DDRD |= 1<<PD1; 					// PD1 = TXD is output
-	
-
-	// SPARE OUT/-INPUTS
-	DDRB |= (1<<PB2) | (1<<PB3); 	// set Out1_spare & out2_spare as outputs
-	DDRA &= ~(1<<PA7);				// set In1_spare as input
-	DDRC &= ~(1<<PC7);				// set In2_spare as input
-	//PORTA |= (1<<PA7); 				// swtich on pullup on In1_spare
-	//PORTC |= (1<<PC7); 				// swtich on pullup on In2_spare
-
-	// ATmega internal ADC input 
-	DDRA &= ~(1<<PA6);
-
-	// MUXER ADDRESS OUTs
-	DDRA |= 0x3F; // SA-pins -> output
-	DDRC |= 0x7F; // SB-pins -> output
-
-	// SPI
-	// set all CS's: output
-	DDRB |= (1 << SPI_E_CS);
-	DDRD |= (1 << SPI_AD_CS) |(1 << SPI_M_CS) |(1 << SPI_A_CS);
-
-	// set all Chips selects HIGH
-	PORTB |= (1 << SPI_E_CS);
-	PORTD |= (1 << SPI_AD_CS) |(1 << SPI_M_CS) |(1 << SPI_A_CS);
-
-	// set MOSI and SCK: output & // set MISO: input
-	SPI_DDR |= (1 << SPI_MOSI);
-	SPI_DDR |= (1 << SPI_SCLK);
-	SPI_DDR &= ~(1 << SPI_MISO);
-
-	// set MOSI, SCK: HIGH. MISO leave alone.
-	SPI_PRT |= (1 << SPI_MOSI);
-	SPI_PRT |= (1 << SPI_SCLK);
-	//SPI_PRT |= (1 << SPI_MISO);
-
-	// ADC 
-	DDRD &= ~(1<<PD6);					// PD6 is AD_READY input
-	DDRD |= 1<<PD7;							// PD7 is AD_RESET output
-
-	// ACCELEROMETER
-	DDRD &= ~(1<<PD2);					// PD2 is ACC_READY input
-
-	//MAX6662   <--- not assembled 
-	// DDRB &= ~(1<<PB0); 			// PB0 is over temperature alert input
-	// DDRB &= ~(1<<PB1);				// PB1 is general temperature altert input
-}
-
-
-
-//-----------------------------------------------------------------------------
-
-void app_set_watchdog_prescaler(tWDT_PRESCALE wdt_prescale) // Set watchdog prescale
-{
+    gVolReg.app_reset_source = MCUSR; // Save last reset source
+    MCUSR = 0x00; // Clear reset source for next reset cycle
+
+    // Dangerous here: I still do not know much about the watchdog.
+    // This code is still from Udo Juerss. 
+    // The watchdog timer is disabled by default ("startup.asm")
+    #ifdef USE_WATCHDOG
+        WDTCSR = WDTOE | (1 << WDE); // Enable watchdog reset (~16ms)
+    #endif
+
+    // define PORTS
+    // USART
+    DDRD &= ~(1<<PD0);              // PD0 = RXD is input
+    DDRD |= 1<<PD1;                 // PD1 = TXD is output
+
+    // SPARE OUT/-INPUTS
+    DDRB |= (1<<PB2);           // set Out1_spare as output
+    DDRB |= (1<<PB3);           // set Out2_spare as output
+    DDRA &= ~(1<<PA7);          // set In1_spare as input
+    DDRC &= ~(1<<PC7);          // set In2_spare as input
+    //PORTA |= (1<<PA7);        // swtich on pullup on In1_spare
+    //PORTC |= (1<<PC7);        // swtich on pullup on In2_spare
+
+    // ATmega internal ADC input 
+    DDRA &= ~(1<<PA6);
+
+    // MUXER ADDRESS OUTs
+    DDRA |= 0x3F; // SA-pins -> output
+    DDRC |= 0x7F; // SB-pins -> output
+
+    // SPI
+    // set all CS's: output
+    DDRB |= (1 << SPI_E_CS);
+    DDRD |= (1 << SPI_AD_CS);
+    DDRD |= (1 << SPI_M_CS);
+    DDRD |= (1 << SPI_A_CS);
+
+    // set all Chips selects HIGH
+    PORTB |= (1 << SPI_E_CS);
+    PORTD |= (1 << SPI_AD_CS);
+    PORTD |= (1 << SPI_M_CS);
+    PORTD |= (1 << SPI_A_CS);
+
+    // set MOSI and SCK: output & // set MISO: input
+    SPI_DDR |= (1 << SPI_MOSI);
+    SPI_DDR |= (1 << SPI_SCLK);
+    SPI_DDR &= ~(1 << SPI_MISO);
+
+    // set MOSI, SCK: HIGH. MISO leave alone.
+    SPI_PRT |= (1 << SPI_MOSI);
+    SPI_PRT |= (1 << SPI_SCLK);
+    //SPI_PRT |= (1 << SPI_MISO);
+
+    // ADC 
+    DDRD &= ~(1<<PD6);      // PD6 is AD_READY input
+    DDRD |= 1<<PD7;         // PD7 is AD_RESET output
+
+    // ACCELEROMETER
+    DDRD &= ~(1<<PD2);      // PD2 is ACC_READY input
+
+    //MAX6662   <--- not assembled 
+    // DDRB &= ~(1<<PB0);   // PB0 is over temperature alert input
+    // DDRB &= ~(1<<PB1);   // PB1 is general temperature altert input
+}
+
+// Set watchdog prescale
+void app_set_watchdog_prescaler(tWDT_PRESCALE wdt_prescale) { 
+
   U08 sreg_backup = SREG; // Copy status register to variable
   U08 wdtcsr_value = WDE + wdt_prescale; // Set new prescale value to variable
@@ -128,142 +91,142 @@
 }
 
-void set_ad7719_enable_register() {
-
-	usart_write_str((pU08)"\n set enable bits of AD7719 Port ");
-	if ((usart_received_chars>=5) && 
-	(usart_rx_buffer[2] >= 'A' && usart_rx_buffer[2] <= 'H'))
-	{
-	usart_write_char(usart_rx_buffer[2]);
-	usart_write_str((pU08)" to ");
-	usart_write_U08_hex(usart_rx_buffer[4]);
-	usart_write_char('\n');
-		ad7719_enables[usart_rx_buffer[2]-'A']=usart_rx_buffer[4];
-		ad7719_channels_ready[usart_rx_buffer[2]-'A']=0x00;
-	}
-	else if  ((usart_received_chars=3) && 
-	(usart_rx_buffer[1] >= 'A' && usart_rx_buffer[1] <= 'H'))
-	{
-		usart_write_char(usart_rx_buffer[1]);
-		if (usart_rx_buffer[2]!='0') {
-			usart_write_str((pU08)" to 0xFF\n");
-			ad7719_enables[usart_rx_buffer[1]-'A']=0xFF;
-		} else
-		{
-			usart_write_str((pU08)" to 0x00\n");
-			ad7719_enables[usart_rx_buffer[1]-'A']=0x00;
-		}
-		ad7719_channels_ready[usart_rx_buffer[1]-'A']=0x00;	
-	}
-	else
-	{
-		usart_write_str((pU08)"\n something wrong\n");
-		usart_write_str((pU08)"usart_rx_buffer_index: ");
-		usart_write_U08(usart_received_chars, 3);
-		usart_write_str((pU08)"\n usart_rx_buffer[2]: ");
-		usart_write_char(usart_rx_buffer[2]);
-		usart_write_str((pU08)"\n usart_rx_buffer[4]: ");
-		usart_write_U08_hex(usart_rx_buffer[4]);
-		usart_write_char('\n');
-	}
-}
-
-void set_adc_enable_register() {
-	// TODO
-	usart_write_str((pU08)"setting of ATmega internal ADC enable registers is not supported. yet.\n");
-}
-
-U08	increase_adc (U08 channel){
-U08 effective_channel;
-	for ( U08 increase = 1 ; increase <= VOLTAGE_CHANNELS; increase++)
-	{
-		effective_channel = (channel + increase) % (VOLTAGE_CHANNELS);
-		if (adc_enables[effective_channel/8] & (1<<effective_channel%8)) {
-			if (debug_mode)
-			{
-				usart_write_U08(effective_channel,3);
-				usart_write_crlf();
-			}
-			return effective_channel;
-		}
-	}
-	if (debug_mode)
-	{
-		usart_write_U08(channel,3);
-		usart_write_crlf();
-	}
-	return channel;
-} // end if increase_adc;
-
-U08	increase_ad7719 (U08 channel){
-U08 effective_channel;
-	for ( U08 increase = 1 ; increase <= RESISTANCE_CHANNELS; increase++)
-	{
-		effective_channel = (channel + increase) % (RESISTANCE_CHANNELS);
-		if (ad7719_enables[effective_channel/8] & (1<<effective_channel%8))
-			return effective_channel;
-	}
-	return channel;
-} // end if increase_adc;
-
-void check_if_measured_all() {
-	adc_measured_all = true;
-	for ( U08 i=0; i<(VOLTAGE_REGS); ++i ) {
-		if ((adc_enables[i] ^ adc_channels_ready[i]) != 0x00) {
-			adc_measured_all = false;
-			break;
-		}
-	}
-	ad7719_measured_all = true;
-	for ( U08 i=0; i<(RESISTANCE_CHANNELS/8); ++i ) {
-		if ((ad7719_enables[i] ^ ad7719_channels_ready[i]) != 0x00) {
-			ad7719_measured_all = false;
-			break;
-		}
-	}
-
-
-}
-
-// an U08 array containts bitmaps, which encode, which channel is enabled and which is not.
-// a measurement is done, when all (or more) enabled channels were already measured.
-// a similar U08 array contains a bitmap, encoding which channels are already done.
-//  note: "or more" above is important, if we check to strictly, 
-//	we will never finish, in case a disabled channel get measured by any mistake...
-//
-//	lets assume:
-//	enabled = 1110.0011		1110.0011
-// 	done 	= 1111.0011		0111.0010
-//
-//	and		= 1110.0011		0110.0010
-//	nand	= 0001.0011		1001.1101
-//	or		= 1111.0011		1111.0011
-//	xor		= 0001.0000		1001.0001
-//	
-//											
-// (en xor done) and enabled =
-//	xor		= 0001.0000		1001.0001
-//	enabled = 1110.0011		1110.0011
-//			  ---------		---------
-//			  0000.0000		1000.0001
-// if this statement evaluates to zero, 
-bool check_if_adc_measurement_done(){
-	adc_measured_all = true;
-	for ( U08 i=0; i<VOLTAGE_REGS; ++i ) {
-		if (( (adc_enables[i] ^ adc_channels_ready[i]) & adc_enables[i] )  != 0x00) {
-			adc_measured_all = false;
-			break;
-		}
-	}
-	return adc_measured_all;
-}
-
-bool check_if_ad7719_measurement_done(){
-	ad7719_measured_all = true;
-	for ( U08 i=0; i<RESISTANCE_CHANNELS/8; ++i ) {
-		if (( (ad7719_enables[i] ^ ad7719_channels_ready[i]) & ad7719_enables[i]) != 0x00) {
-			ad7719_measured_all = false;
-			break;
-		}
-	}
-	return ad7719_measured_all;
-}
+
+//U08* en = gReg.adc_enables;
+//U08 size = VOLTAGE_CHANNELS;
+U08 increase (U08 channel, U08* enables_ptr, U08 size){
+    for ( U08 increase = 1 ; increase <= size; increase++) {
+        U08 effective_channel = (channel + increase) % size;
+        if (enables_ptr[effective_channel/8] & (1<<effective_channel%8)) {
+            return effective_channel;
+        }
+    }
+    return channel;
+}
+U08 increase_ad7719 (U08 channel) {
+    return increase( channel, gReg.ad7719_enables, RESISTANCE_CHANNELS);
+} 
+U08 increase_adc (U08 channel) {
+    return increase( channel, gReg.adc_enables, VOLTAGE_CHANNELS);
+}
+
+
+/* Explaination of bit banging:
+ * an U08 array containts bitmaps, which encode, which channel is enabled and which is not.
+ * a measurement is done, when all (or more) enabled channels were already measured.
+ * a similar U08 array contains a bitmap, encoding which channels are already done.
+ * note: "or more" above is important, if we check to strictly, 
+ * we will never finish, in case a disabled channel get measured by any mistake...
+ * 
+ * lets assume:
+ * enabled  = 1110.0011     1110.0011
+ * done     = 1111.0011     0111.0010
+ * 
+ * and      = 1110.0011     0110.0010
+ * nand     = 0001.0011     1001.1101
+ * or       = 1111.0011     1111.0011
+ * xor      = 0001.0000     1001.0001
+ * 
+ * (en xor done) and enabled =
+ * xor      = 0001.0000     1001.0001
+ * enabled  = 1110.0011     1110.0011
+ *            ---------     ---------
+ *            0000.0000     1000.0001
+ * if this statement evaluates to zero, 
+ * 
+ * 
+ * size = VOLTAGE_REGS | RESISTANCE_REGS
+ * en = gReg.adc_enables | gReg.ad7719_enables
+ * dry = gReg.adc_channels_ready | gReg.ad7719_channels_ready
+ */
+bool check_if_measurement_done(U08* en, U08*rdy, U08 size) {
+    U08 temp = true;
+    for ( U08 i=0; i<size; ++i ) {
+        if (((en[i]^rdy[i])&en[i]) != 0x00) {
+            temp = false;
+            break;
+        }
+    }
+    return temp;
+}
+bool check_if_adc_measurement_done() {  // operates on global gReg
+    return gReg.adc_measured_all = check_if_measurement_done(
+                                        gReg.adc_enables, 
+                                        gReg.adc_channels_ready, 
+                                        VOLTAGE_REGS);
+}
+bool check_if_ad7719_measurement_done() {  // operates on global gReg
+    return gReg.ad7719_measured_all = check_if_measurement_done(
+                                        gReg.ad7719_enables, 
+                                        gReg.ad7719_channels_ready, 
+                                        RESISTANCE_REGS);
+}
+bool check_if_measured_all() {          // operates on global gReg
+    return check_if_adc_measurement_done() && check_if_ad7719_measurement_done();
+}
+
+void reset_voltage_done(){              // operates on global gReg
+    for (U08 i=0; i < (VOLTAGE_REGS); i++){
+        gReg.adc_channels_ready[i] = 0;
+    }
+}
+void reset_voltage_values(){            // operates on global gReg
+    for (U08 i=0; i < VOLTAGE_CHANNELS; i++){
+        gReg.adc_values[i] = 0;
+    }
+}
+void reset_resistance_done(){           // operates on global gReg
+    for (U08 i=0; i < (RESISTANCE_REGS); i++){
+        gReg.ad7719_channels_ready[i] = 0;
+    }
+}
+void reset_resistance_values(){         // operates on global gReg
+    for (U08 i=0; i < RESISTANCE_CHANNELS; i++){
+        gReg.ad7719_values[i] = 0;
+    }
+}
+void reset_done(){
+    reset_resistance_done();
+    reset_voltage_done();
+}
+
+
+void write_status_via_eth() { 
+    gReg.ad7719_values_checksum = fletcher16( (U08*)gReg.ad7719_values, RESISTANCE_CHANNELS * sizeof(U32) );
+    gReg.adc_values_checksum = fletcher16( (U08*)gReg.adc_values, VOLTAGE_CHANNELS * sizeof(U16) );
+    
+    U16 bytes_to_be_sent = sizeof(gReg);
+    U16 bytes_already_sent = 0;
+    U16 bytes_really_sent_away = 0;
+    while (bytes_to_be_sent){
+        bytes_really_sent_away = w5100_set_TX( (U08*)&gReg+bytes_already_sent, bytes_to_be_sent);
+        bytes_to_be_sent -= bytes_really_sent_away;
+        bytes_already_sent += bytes_really_sent_away;
+    }
+    bytes_to_be_sent = sizeof(gVolReg);
+    bytes_already_sent = 0;
+    bytes_really_sent_away = 0;
+    while (bytes_to_be_sent){
+        bytes_really_sent_away = w5100_set_TX( (U08*)&gVolReg+bytes_already_sent, bytes_to_be_sent);
+        bytes_to_be_sent -= bytes_really_sent_away;
+        bytes_already_sent += bytes_really_sent_away;
+    }
+}
+
+
+U16 fletcher16( U08 const *data, U16 bytes ) {
+    U16 sum1 = 0xff, sum2 = 0xff;
+
+    while (bytes) {
+            U16 tlen = bytes > 20 ? 20 : bytes;
+            bytes -= tlen;
+            do {
+                    sum2 += sum1 += *data++;
+            } while (--tlen);
+            sum1 = (sum1 & 0xff) + (sum1 >> 8);
+            sum2 = (sum2 & 0xff) + (sum2 >> 8);
+    }
+    /* Second reduction step to reduce sums to 8 bits */
+    sum1 = (sum1 & 0xff) + (sum1 >> 8);
+    sum2 = (sum2 & 0xff) + (sum2 >> 8);
+    return sum2 << 8 | sum1;
+}
Index: firmware/FSC/src/application.h
===================================================================
--- firmware/FSC/src/application.h	(revision 17628)
+++ firmware/FSC/src/application.h	(revision 17629)
@@ -5,38 +5,46 @@
 #include "typedefs.h"
 //-----------------------------------------------------------------------------
-// in order to implement the "registers" I work with a quite long 
-//  char-array like this:
-# define FSC_REGISTER_LENGTH 492
-extern U08 FSCregister[FSC_REGISTER_LENGTH];
-// but this register is not only accessible by
-// FSCregister[i], but as well by special pointers like this:
-extern U32 *status 							;
-extern U32 *time_sec 							;
-extern U16 *time_ms 							;
-extern U16 *FR_period 							;
-extern U16 *ref_resistor 						;
 
-extern U32 *ad7719_values 						;
+#define RESISTANCE_CHANNELS 64
+#define RESISTANCE_REGS 8
+#define AD7719_READINGS_UNTIL_SETTLED 3 // when set to 3 --> we wait 480ms per sensor reading
+#define VOLTAGE_CHANNELS 84
+#define VOLTAGE_REGS 11
+#define ADC_READINGS_UNTIL_SETTLED 1
+#define ADC_VALUES_LEN_BYTE 168
 #define AD7719_VALUES_LEN_BYTE 512
-extern U08 *ad7719_enables 					;
-extern U08 *ad7719_channels_ready 				;
-extern U08 *ad7719_readings_since_last_muxing 	;
-extern U08 *ad7719_current_channel 			;
-extern U32 *ad7719_current_reading 			;
 
-extern U16 *adc_values 						;
-#define ADC_VALUES_LEN_BYTE 168
-extern U08 *adc_enables 						;
-extern U08 *adc_channels_ready 				;
-extern U08 *adc_readings_since_last_muxing 	;
-extern U08 *adc_current_channel 				;
-extern U16 *adc_current_reading 				;
-// using these pointers one can manipulate measurement values like this:
-// res_value[3] = 453212;
-// and then readout the most significant byte of this same value by accessing:
-// FSCregister[92]; 
-// I like this very much for asking the boards status ... this is just a copy of the registers,
-// into the W5100 TX FIFO.
-// submitting the measurement values is just a partial copy... 
+typedef struct {
+    U08 ad7719_readings_since_last_muxing;
+    U08 ad7719_current_channel;
+    U32 ad7719_current_reading;
+    U08 ad7719_enables[RESISTANCE_REGS];
+    U08 ad7719_channels_ready[RESISTANCE_REGS];
+    U32 ad7719_values[RESISTANCE_CHANNELS];
+    U16 ad7719_values_checksum;
+    
+    U08 adc_readings_since_last_muxing;
+    U08 adc_current_channel;
+    U16 adc_current_reading;
+    U08 adc_enables[VOLTAGE_REGS];
+    U08 adc_channels_ready[VOLTAGE_REGS];
+    U16 adc_values[VOLTAGE_CHANNELS];
+    U16 adc_values_checksum;
+    
+    // ----- NEW --------
+    bool ad7719_measured_all;
+    bool adc_measured_all;
+
+} FSCRegisterType;
+
+typedef struct {
+    U08 app_reset_source;
+    U32 time_sec;
+    U16 time_ms;
+} VolatileRegisterType;
+
+extern FSCRegisterType gReg;
+extern volatile VolatileRegisterType gVolReg;
+
 
 //-----------------------------------------------------------------------------
@@ -58,57 +66,18 @@
 #define SPI_MISO PB6
 
-#define SPI_E_CS PB4 		
-#define SPI_AD_CS PD3 		
-#define SPI_M_CS PD4		
-#define SPI_A_CS PD5		
-
-//#ifdef ____WENNICHSWIRKLICHWILL
-#ifndef ___MAIN_WORKFLOW_GLOBAL_VARS
-#define ___MAIN_WORKFLOW_GLOBAL_VARS
-	#define RESISTANCE_CHANNELS 64
-	#define AD7719_READINGS_UNTIL_SETTLED 3 // bei3:480ms
-	
-	#define VOLTAGE_CHANNELS 84
-	#define VOLTAGE_REGS 11
-	#define ADC_READINGS_UNTIL_SETTLED 1
-#endif
+#define SPI_E_CS PB4
+#define SPI_AD_CS PD3
+#define SPI_M_CS PD4
+#define SPI_A_CS PD5
 
 #define W5100_INPUT_CHECK_TIME 25 // defines how often the W5100 should be asked if something arrived... in ms
+#define ADC_READINGS_UNTIL_MEAN 40
 
-// MAIN WORKFLOW GLOBAL VARIABLES
-
-	extern bool heartbeat_enable;
-
-
-	
-// TIMER global variable
-	extern volatile U32 local_ms;
-
-// AD7719 global variables
-	extern bool ad7719_measured_all;
-	extern bool ad7719_values_printed;
-	extern bool ad7719_print_endless;
-
-// ATMEGA ADC global variables
-	#define adc_readings_until_mean 40
-	extern bool adc_measured_all;
-	extern bool adc_values_printed;
-	extern bool adc_print_endless;
-
-	extern bool once_told_you;
-	extern bool debug_mode;
-
-
-
-//-----------------------------------------------------------------------------
-extern volatile U08 app_reset_source;
-//-----------------------------------------------------------------------------
 
 void app_init(void); // Initialize application
 void app_set_watchdog_prescaler(tWDT_PRESCALE wdt_prescale); // Set watchdog prescale
-
-//methods in main ... declared here ... don't ask why ... 
+ 
 // definition of some functions:
-// these function are implemented in this file, this is not doog coding style.
+// these function are implemented in this file, this is not good coding style.
 // sooner or later, they will be moved into more apropriate files.
 void set_adc_enable_register();
@@ -117,14 +86,18 @@
 U08	increase_ad7719 (U08 channel);
 void check_what_measurement_was_finished() ;
-void check_if_measured_all() ;
+
 
 bool check_if_adc_measurement_done();
 bool check_if_ad7719_measurement_done();
-// end of function definition:
-//-----------------------------------------------------------------------------
+bool check_if_measured_all();
 
+void reset_resistance_done();
+void reset_resistance_values();
+void reset_voltage_done();
+void reset_voltage_values();
+void reset_done();
 
-
-//-----------------------------------------------------------------------------
+void write_status_via_eth();
+U16 fletcher16( U08 const *data, U16 bytes );
 
 #endif
