Index: firmware/InterlockArduino/src/webserver/webserver.ino
===================================================================
--- firmware/InterlockArduino/src/webserver/webserver.ino	(revision 14252)
+++ firmware/InterlockArduino/src/webserver/webserver.ino	(revision 14511)
@@ -1,3 +1,2 @@
-
 /*
   Arduino Ethernet for FACT Interlock
@@ -36,5 +35,4 @@
   FC_OFF: disable pump : digital output D6
  */
-
 #include <SPI.h>
 #include <Ethernet.h>
@@ -51,6 +49,30 @@
 int Z_OK = 19;
 
-int my_inputs[] = {FC_OK, BP_ON, IL_ON, FL_OK, FP_EN, X_ON, Y_ON, Z_OK};
-char * my_input_names[] = {"FC_OK", "BP_ON", "IL_ON", "FL_OK", "FP_EN", "X_ON", "Y_ON", "Z_OK"};
+int my_inputs[] =          {FC_OK,   BP_ON,   IL_ON,   FL_OK,   FP_EN,   X_ON,   Y_ON,   Z_OK};
+//char * my_input_names[] = {"FC_OK", "BP_ON", "IL_ON", "FL_OK", "FP_EN", "X_ON", "Y_ON", "Z_OK"};
+
+char * my_input_names[] = { "Is the cooling liquid flow meter measuring enough throuput?", 
+                            "Is Bias Power enabled?", 
+                            "Is 24VDC Interlock power supply enabled?", 
+                            "Is the Level of the cooling liquid ok?", 
+                            "Is the Pump powered?", 
+                            "Is the Drive Cabinet Enable Signal on?", 
+                            "Is the Drive Cabinet Power Signal on?", 
+                            "Is Drive Container Enabled?"};
+int Number_of_Buttons = 3;
+// This is in HTML called the VALUE of the button,
+// but it is in fact what is written on it.
+char * button_caption[] = {
+    "Camera ON",
+    "Camera OFF",
+    "Drive ON/OFF"};
+
+// This is in HTML called the NAME of the button, and it is, what is transmit
+// within the request. So this is a kind of reference string .. which i searh for 
+// in the request ... so the strings schould be nice ... no capital letters no spaces
+char * button_name[] = {
+    "cam_on",
+    "cam_off",
+    "drive_toggle"};
 
   // outputs
@@ -66,6 +88,7 @@
 unsigned int fc_off_time = 0;// time in ms, for FC_OFF to be HIGH
 
-//byte mac[] = { 0xFA, 0xC7, 0x0F, 0xAD, 0x22, 0x01 }; // ETHZ
-byte mac[] = { 0xFA, 0xC7, 0xFC, 0xB1, 0x00, 0x01 }; // TUDO
+
+byte mac[] = { 0xFA, 0xC7, 0xFC, 0xB1, 0x00, 0x01 }; // FACT internal network
+
 
 
@@ -80,11 +103,7 @@
 
 
-
 void setup() {
  // Open serial communications and wait for port to open:
   Serial.begin(9600);
-   while (!Serial) {
-    ; // wait for serial port to connect. Needed for Leonardo only
-  }
 
 
@@ -95,23 +114,19 @@
   Serial.println(Ethernet.localIP());
   
- // Enable ATmega Pullups
- for (int i = 0 ; i<8; i++)
- {
-  digitalWrite(my_inputs[i], HIGH);
- }
-
-
-
   pinMode( FC_ON, OUTPUT );
   pinMode( FC_OFF,OUTPUT );
   pinMode( X, OUTPUT );
   pinMode( Y,OUTPUT );
-
-}
+  // the others are all INPUTs
+}
+
+
 
 
 void loop() {
    Check_n_Set_FC_ON_OFF();
+    
    unsigned long before = millis();
+    
    if (Check_for_clients() )
    {
@@ -123,4 +138,8 @@
    delay(300);
 }
+
+
+
+
 /////////////////////////////////////////////////////////////////////////////////////////////
 int Check_for_clients()
@@ -144,5 +163,5 @@
         {
          eth += c;
-//        Serial.write(c);
+         //Serial.write(c);
          //Serial.println(eth.length(), DEC);
          if ( eth.indexOf('\n') != -1 )
@@ -151,10 +170,11 @@
            {
              get_http_found = true;
-             if (eth.indexOf(String("D2on=")) !=-1){
+             if (eth.indexOf(String("pump_on=")) !=-1){
                Serial.println("User request: Enable Pump");
                digitalWrite( FC_ON, HIGH);
-               fc_on_time = 3000;
+               if ((fc_on_time+3000) > fc_on_time)
+                  fc_on_time += 3000;
              }
-             else if (eth.indexOf(String("D2off=")) !=-1)
+             else if (eth.indexOf(String("pump_off=")) !=-1)
              {
                Serial.println("User request: Disable Pump");
@@ -162,16 +182,18 @@
                fc_off_time = 500;
              }
-             else if (eth.indexOf(String("toggle_x=")) !=-1)
+             else if (eth.indexOf(String("toggle_drive=")) !=-1)
              {
-               Serial.println("User request: Toggle X");
-               x_signal = !x_signal;
-               digitalWrite( X, x_signal );
+                Serial.println("User request: Toggle Drive");
+                x_signal = !x_signal;
+                digitalWrite( X, x_signal );
+                y_signal = !y_signal;
+                digitalWrite( Y, y_signal );
              }
-             else if (eth.indexOf(String("toggle_y=")) !=-1)
-             {
-               Serial.println("User request: Toggle Y");
-               y_signal = !y_signal;
-               digitalWrite( Y, y_signal );
-             }
+             //else if (eth.indexOf(String("toggle_y=")) !=-1)
+             //{
+             //  Serial.println("User request: Toggle Y");
+             //  y_signal = !y_signal;
+             //  digitalWrite( Y, y_signal );
+             //}
               else
               {
@@ -232,42 +254,5 @@
 }
 
-void send_ana_outs_example( EthernetClient *client) {
-   // output the value of each analog input pin
-  for (int analogChannel = 0; analogChannel < 6; analogChannel++) 
-  {
-    client->print("analog input ");
-    client->print(analogChannel);
-    client->print(" is ");
-    client->print(analogRead(analogChannel));
-    client->println("<br />");
-  }
-}
-
-void send_dig_ins( EthernetClient *client) 
-{
-  for (int ch = 4; ch < 9; ch++) 
-  {
-    client->print("digital input ");
-    client->print(ch);
-    client->print(" is ");
-    if (digitalRead(ch))
-    {
-      client->print("<font color=\"green\" size=20>HIGH</font>"); 
-    }
-    else
-    {
-      client->print("<font color=\"red\" size=20>LOW</font>"); 
-    }
-    
-    
-    
-    client->println("<br />");
-  }
- 
-}
-
-
-
-void send_my_inputs( EthernetClient *client) 
+void print_input_status( EthernetClient *client) 
 {
   for (int ch = 0; ch < 8; ch++) 
@@ -289,17 +274,29 @@
 }
 
+void make_buttons( EthernetClient *client )
+{
+    for ( int button_id = 0; button_id < Number_of_Buttons; ++button_id )
+    {
+        client->print("<P><INPUT TYPE=SUBMIT NAME=\"");
+        client->print(button_name[button_id]);
+        client->print("\" VALUE=\"");
+        client->print(button_caption[button_id]);
+        client->print("\" ");
+        
+        // the 'OFF' button should be disabled 
+        // in case somebody just pressed the 'ON' button.
+        if (fc_on_time != 0 && button_id == 1){
+            client->print("disabled");
+        }
+        
+        client->println("><br />");
+    }
+}
 
 
 void html_page( EthernetClient *client)
 {
-  client->println("<P><INPUT TYPE=SUBMIT NAME=\"D2on\" VALUE=\"Enable Pump\"> --> FC_ON HIGH for 3 seconds <br />");
-  client->println("<P><INPUT TYPE=SUBMIT NAME=\"D2off\" VALUE=\"Disable Pump\">--> FC_OFF HIGH for 0.5 seconds <br />");
-  client->println("<P><INPUT TYPE=SUBMIT NAME=\"toggle_x\" VALUE=\"Toggle X\">--> ... well it toggles X <br />");
-  client->println("<P><INPUT TYPE=SUBMIT NAME=\"toggle_y\" VALUE=\"Toggle Y\">--> ... well it toggles Y <br />");
-  
-//  send_dig_ins( client );
-  send_my_inputs( client );
-  
-  //send_ana_outs_example( client );
+    make_buttons( client );
+    print_input_status( client );
 }
 
@@ -315,8 +312,4 @@
 Check_n_Set_FC_ON_OFF()
 {
-//  Serial.print("FC ON TIME");
-//  Serial.println(fc_on_time);
-//  Serial.print("FC OFF TIME");
-//  Serial.println(fc_off_time);
   
   unsigned long since_last = millis() - last_time;
