Index: firmware/ShutterController/ShutterController.ino
===================================================================
--- firmware/ShutterController/ShutterController.ino	(revision 14517)
+++ firmware/ShutterController/ShutterController.ino	(revision 14778)
@@ -23,5 +23,5 @@
 // Define MAC and IP addresses
 byte _mac[] = { 0x90, 0xA2, 0xDA, 0x00, 0x5C, 0x91 };
-
+//byte _mac[] = { 0x80, 0x49, 0x71, 0x0f, 0x80, 0xd0 };
 #if !defined USE_DHCP_FOR_IP_ADDRESS
 // ip represents the fixed IP address to use if DHCP is disabled.
@@ -34,5 +34,5 @@
 // pushing coefficient ~100 Kg/A
 const double _ZeroCurrent         PROGMEM = 0.25; // [A] 
-const double _CurrentPushingLimit PROGMEM = 0.70; // 0.7-0.5 = 0.2 -> 20  +/- 5 kg
+const double _CurrentPushingLimit PROGMEM = 0.75; // 0.7-0.5 = 0.2 -> 20  +/- 5 kg
 const double _OverCurrent         PROGMEM = 1.50; // 1.5-0.5 = 1   -> 100 +/- 5 kg
 
@@ -40,5 +40,5 @@
 const int _StartPointLimit =    70;
 const int _EndPoint        =  1024;
-const int _EndPointLimit   =   740;
+const int _EndPointLimit   =   775; // This must me 740 for the mockup and >770 for the FACT shutter
 
 // Define Lid Status levels and labels
@@ -138,5 +138,5 @@
                                     "<button name=\"Button6\" value=\"valueButton6\" type=\"submit\">Close Lid</button><p/>"
                                     "<span id=\"cur1\" value=\"\002\"> Motor Current 1 = \002 A </span><p/><span id=\"cur2\" value=\"\002\"> Motor Current 2 = \002 A </span><p/>"
-                                    "<span id=\"pos1\" value=\"\002\"> Hall Sensor 1 = \002 ADC ounts </span><p/><span id=\"pos2\" valus=\"\002\"> Hall Sensor 2 = \002 ADC counts</span><p/>"
+                                    "<span id=\"pos1\" value=\"\002\"> Hall Sensor 1 = \002 ADC counts </span><p/><span id=\"pos2\" value=\"\002\"> Hall Sensor 2 = \002 ADC counts</span><p/>"
                                     "</form></p>";
                                     //<br/></body></html>
@@ -277,9 +277,4 @@
   Serial.println(Ethernet.localIP());
   
- // Serial.print("Gateway IP address is ");
- // Serial.println(ip_to_str(gatewayAddr));
-  
- // Serial.print("DNS IP address is ");
- // Serial.println(ip_to_str(dnsAddr));
 
 
@@ -625,5 +620,8 @@
 void sendPage(EthernetClient & client, int nUriIndex, BUFFER & requestContent)
 {
-
+  // Read Sensor values for every page reload
+  ReadSensorM(-1,100);
+  ReadCurrentM(-1,100);
+  
 #ifdef DEBUG
   Serial.print("sendPage(");
@@ -957,8 +955,8 @@
   double travel;
   
-   // only one reading to define the position is not sufficient
-   // current_position = ReadSensor(motor);
- 
-   // Calculate average final position
+  // only one reading to define the position is not sufficient
+  // current_position = ReadSensor(motor);
+
+  // Calculate average final position
   double tmp=0; 
   double tmpM=0; 
@@ -974,8 +972,4 @@
   tmpS  = sqrt(tmpS/SAMPLES - tmpM*tmpM);
   
-  Serial.print(" - The current position of the actuator is ");
-  Serial.print(tmpM,3);
-  Serial.print( " +/- " ); 
-  Serial.println(tmpS,3);
 
   int tmpS_int = (int) tmpS;
@@ -991,12 +985,6 @@
   
   original_position      = current_position;
-  err_original_position = err_current_position;
-  
-  Serial.print(" - The corrected position of the actuator is ");
-  Serial.print(current_position);
-  Serial.print( " +/- " ); 
-  Serial.println(err_current_position);
- 
-  
+  err_original_position  = err_current_position;
+
   // calculate the travel needed to reach the target position
   travel = target_position - current_position;
@@ -1009,5 +997,16 @@
   Serial.print(target_position,3);
   Serial.print(" - Travel distance = ");
-  Serial.print(travel,3);
+  Serial.println(travel,3);
+
+  Serial.print(" - The current position of the actuator is ");
+  Serial.print(tmpM,3);
+  Serial.print( " +/- " ); 
+  Serial.println(tmpS,3);
+
+  Serial.print(" - The corrected position of the actuator is ");
+  Serial.print(current_position);
+  Serial.print( " +/- " ); 
+  Serial.println(err_current_position);
+
   
   // [IF] the travel is bigger than +2*(absolute position error) try to move out the motor
@@ -1223,5 +1222,5 @@
   Serial.println(_StatusLabel[_LidStatus[motor]]);
   
-  Serial.print("availableMemory()=");
+  Serial.print("AvailableMemory()=");
   Serial.println(availableMemory());
 
@@ -1266,16 +1265,31 @@
   Serial.println("Action->ReadSensorsM()");
 #endif 
-  _sensorValue[motor]=0;
   switch (motor){
+    case -1: // Read all of them
+      _sensorValue[0] = 0;
+      _sensorValue[1] = 0;
+      for (int j=0;j<samples;j++){
+        _sensorValue[0] +=  analogRead(A2);
+        _sensorValue[1] +=  analogRead(A3);
+      }
+      _sensorValue[0]/=samples;
+      _sensorValue[1]/=samples;
+      return -1;
+
     case 0:
+      _sensorValue[motor]=0;
       for (int j=0;j<samples;j++)
         _sensorValue[motor] +=  analogRead(A2);//*_ADC2V - _Voffset; //*_Compensation;
+      _sensorValue[motor] /= samples;
+      return _sensorValue[motor]; // Actuator 1 position
+
     case 1:
+      _sensorValue[motor]=0;
       for (int j=0;j<samples;j++)
         _sensorValue[motor] +=  analogRead(A3);//*_ADC2V - _Voffset;//_Compensation;
-  }
-  
-  _sensorValue[motor] /= samples;
-  return _sensorValue[motor]; // Actuator 1 position
+      _sensorValue[motor] /= samples;
+      return _sensorValue[motor]; // Actuator 1 position
+  }
+  
 }
 
@@ -1301,15 +1315,29 @@
 
 double ReadCurrentM(int motor,  int samples){
-  _currentValue[motor] = 0;
   switch (motor){
+    case -1: // Read all of them
+      _currentValue[0] = 0;
+      _currentValue[1] = 0;
+      for (int j=0;j<samples;j++){
+        _currentValue[0] +=  analogRead(A4)*_ADC2V/(_V2A*10.);
+        _currentValue[1] +=  analogRead(A5)*_ADC2V/(_V2A*10.);
+      }
+      _currentValue[0]/=samples;
+      _currentValue[1]/=samples;
+      return -1;
     case 0:
+      _currentValue[motor] = 0;
       for (int j=0;j<samples;j++)
         _currentValue[motor] +=  analogRead(A4)*_ADC2V/(_V2A*10.);        
+      _currentValue[motor]/=samples;
+      return _currentValue[motor];
     case 1:
+      _currentValue[motor] = 0;
       for (int j=0;j<samples;j++)
         _currentValue[motor] +=  analogRead(A5)*_ADC2V/(_V2A*10.);
-  }
-  _currentValue[motor]/=samples;
-  return _currentValue[motor];
+      _currentValue[motor]/=samples;
+      return _currentValue[motor];
+
+  }
 
 }
