Changeset 15289 for trunk/FACT++
- Timestamp:
- 04/10/13 10:17:48 (12 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/FACT++/scripts/Main.js
r15284 r15289 101 101 sub_incomplete.onchange = function(evt) 102 102 { 103 if (!evt) 103 if (!evt.data) 104 { 105 this.last_inc = 0; 104 106 return; 105 106 var inc = evt.data[0];//obj['incomplete']; 107 } 108 109 var inc = evt.obj['incomplete']; 107 110 if (!inc) 111 { 112 this.last_inc = 0; 108 113 return; 109 110 if ((evt.time - this.last_time)<5000 && this.last_inc==inc) 114 } 115 116 if (this.last_inc==inc) 111 117 return; 112 118 … … 136 142 } 137 143 138 this.last_time = evt.time;139 144 this.last_inc = inc; 140 145 } … … 322 327 if (stat[i]!=0x43) 323 328 { 324 console.out(" ...disconnect " ,i);329 console.out(" ...disconnect "+i); 325 330 dim.send("FAD_CONTROL/DISCONNECT", i); 326 331 } … … 332 337 if (stat[i]!=0x43) 333 338 { 334 console.out(" ...reconnect " ,i);339 console.out(" ...reconnect "+i); 335 340 dim.send("FAD_CONTROL/CONNECT", i); 336 341 } … … 353 358 if (incomplete&(1<<i)) 354 359 { 355 console.out(" ...disconnect " ,i);360 console.out(" ...disconnect "+i); 356 361 dim.send("FAD_CONTROL/DISCONNECT", i); 357 362 } … … 363 368 if (incomplete&(1<<i)) 364 369 { 365 console.out(" ...reconnect " ,i);370 console.out(" ...reconnect "+i); 366 371 dim.send("FAD_CONTROL/CONNECT", i); 367 372 } … … 650 655 function Shutdown() 651 656 { 652 /**** dummy ****/653 //console.out(" => [SHUTDOWN] called.");654 657 console.out("Shutdown: start"); 655 658 656 dim.send("FEEDBACK/STOP");657 dim.send("FEEDBACK/ENABLE_OUTPUT", false);658 dim.send("FTM_CONTROL/STOP_TRIGGER");659 659 service_feedback.voltageOff(); 660 660 CloseLid(); … … 665 665 // FIXME: This might not work is the drive is already close to park position 666 666 dim.wait("DRIVE_CONTROL", "Locked", 3000); 667 //dim.wait("DRIVE_CONTROL", "Moving", 3000);668 //dim.wait("DRIVE_CONTROL", "Armed", 120000);669 670 // dim.wait("DRIVE_CONTROL", "Locked", 3000);671 667 672 668 var sub = new Subscription("DRIVE_CONTROL/POINTING_POSITION"); … … 688 684 var now = new Date(); 689 685 v8.timeout(150000, func); 686 687 //dim.send("FEEDBACK/STOP"); 688 dim.send("FEEDBACK/ENABLE_OUTPUT", false); 689 dim.send("FTM_CONTROL/STOP_TRIGGER"); 690 691 dim.wait("FEEDBACK", "CurrentCtrlIdle", 3000); 692 dim.wait("FTM_CONTROL", "Idle", 3000); 690 693 691 694 var report = sub.get(); … … 789 792 var lastObs; 790 793 var sun = Sun.horizon(-13); 794 var system_on; // undefined 791 795 792 796 while (1) … … 815 819 // FIXME: State check? 816 820 Shutdown(); 821 system_on = false; 817 822 continue; 818 823 } … … 863 868 } 864 869 870 var task = obs[sub].task; 871 865 872 // Check if sun is still up... only DATA and RATESCAN must be suppressed 866 if (( obs[sub].task=="DATA" || obs[sub].task=="RATESCAN") && sun.isUp)873 if ((task=="DATA" || task=="RATESCAN") && sun.isUp) 867 874 { 868 875 var now = new Date(); … … 872 879 continue; 873 880 } 881 882 if (system_on===false && task!="STARTUP") 883 { 884 v8.sleep(1000); 885 continue; 886 } 887 888 var power_states = sun.isUp || system_on===false ? [ "DriveOff" ] : [ "SystemOn" ]; 889 890 var drive_states = sun.isUp || system_on===false ? [ ] : [ "Armed", "Tracking", "OnTrack" ]; 874 891 875 892 // A scheduled task was found, lets check if all servers are … … 887 904 [ "MCP", [ "Idle" ] ], 888 905 [ "TIME_CHECK", [ "Valid" ] ], 889 [ "PWR_CONTROL", [ "SystemOn" ]],906 [ "PWR_CONTROL", power_states/*[ "SystemOn" ]*/ ], 890 907 [ "AGILENT_CONTROL", [ "VoltageOn" ] ], 891 908 [ "BIAS_CONTROL", [ "VoltageOff", "VoltageOn", "Ramping" ] ], 892 909 [ "FEEDBACK", [ "CurrentControl", "CurrentCtrlIdle" ] ], 893 910 [ "LID_CONTROL", [ "Open", "Closed" ] ], 894 [ "DRIVE_CONTROL", [ "Armed", "Tracking", "OnTrack" ]],911 [ "DRIVE_CONTROL", drive_states/*[ "Armed", "Tracking", "OnTrack" ]*/ ], 895 912 [ "FTM_CONTROL", [ "Idle", "TriggerOn" ] ], 896 913 [ "FAD_CONTROL", [ "Connected", "WritingData" ] ], … … 926 943 // It is unclear what comes next, so we better switch off the voltage 927 944 service_feedback.voltageOff(); 945 system_on = true; 928 946 break; 929 947 … … 931 949 console.out(" SHUTDOWN", ""); 932 950 Shutdown(); 951 system_on = false; 933 952 934 953 // FIXME: Avoid new observations after a shutdown until
Note:
See TracChangeset
for help on using the changeset viewer.