Index: /trunk/FACT++/scripts/Main.js
===================================================================
--- /trunk/FACT++/scripts/Main.js	(revision 18428)
+++ /trunk/FACT++/scripts/Main.js	(revision 18429)
@@ -169,4 +169,15 @@
         dim.log("Opening lid");
         dim.send("LID_CONTROL/OPEN");
+
+        dim.log("Turning off IR camera LEDs...");
+
+        var cam = new Curl("fact@cam/cgi-bin/user/Config.cgi");
+        cam.data.push("action=set");
+        cam.data.push("Camera.System.Title=Camera1");
+        cam.data.push("Camera.General.IRControl.Value=2");
+        cam.data.push("Camera.System.Display=ALL");
+        cam.data.push("Camera.Environment=OUTDOOR");
+        var ret = cam.send();
+        dim.log("Camera response: "+ret.data.replace("\n","/")+" ["+ret.rc+"]");
     }
     dim.wait("LID_CONTROL", "Open", 30000);
@@ -1130,5 +1141,5 @@
         service_feedback.voltageOn(0);
 
-        if (obs[sub].source != undefined)
+        if (obs[sub].source != null) // undefined != null -> false
         {
             dim.log("Pointing telescope to '"+obs[sub].source+"'.");
@@ -1227,5 +1238,5 @@
         else
         {
-            if (obs[sub].source != undefined)
+            if (obs[sub].source != null)  // undefined != null -> false
             {
                 dim.log("Pointing telescope to '"+obs[sub].source+"'.");
@@ -1399,5 +1410,5 @@
         //  ...if at least ten minutes of observation time are left
         //  ...if this is the first run on the source
-        var point  = (run%4==0 && remaining>10) || run==0;
+        var point  = (run%4==0 && remaining>10 && !obs[sub].orbit) || run==0; // undefined==null -> true!
 
         // Take DRS Calib...
@@ -1417,7 +1428,10 @@
             // start with alternating wobble positions each day
             var wobble = (parseInt(run/4) + parseInt(new Date()/1000/3600/24-0.5))%2+1;
-
-            //console.out("  Move telescope to '"+source+"' "+offset+" "+wobble);
-            dim.log("Pointing telescope to '"+obs[sub].source+"' [wobble="+wobble+"]");
+            var angle  = obs[sub].angle == null ? Math.random()*360 : obs[sub].angle;
+
+            if (obs[sub].orbit) // != undefined, != null, != 0
+                dim.log("Pointing telescope to '"+obs[sub].source+"' [orbit="+obs[sub].orbit+"min, angle="+angle+"]");
+            else
+                dim.log("Pointing telescope to '"+obs[sub].source+"' [wobble="+wobble+"]");
 
             // This is a workaround to make sure that we really catch
@@ -1426,6 +1440,8 @@
             dim.wait("DRIVE_CONTROL", "Initialized", 15000);
 
-            //dim.send("DRIVE_CONTROL/MOON");
-            dim.send("DRIVE_CONTROL/TRACK_WOBBLE", wobble, obs[sub].source);
+            if (obs[sub].orbit) // != undefined, != null, != 0
+                dim.send("DRIVE_CONTROL/TRACK_ORBIT", angle, obs[sub].orbit, obs[sub].source);
+            else
+                dim.send("DRIVE_CONTROL/TRACK_WOBBLE", wobble, obs[sub].source);
 
             // Do we have to check if the telescope is really moving?
