Browse Source

Profile translation can be re-applied after it is reset.

Neal Wilson 7 years ago
parent
commit
ec408bb67c
1 changed files with 248 additions and 221 deletions
  1. 248
    221
      config/Windows/productionroaster.xml

+ 248
- 221
config/Windows/productionroaster.xml View File

45
         <item id="manual" shortcut="Ctrl+E">Manual Entry</item>
45
         <item id="manual" shortcut="Ctrl+E">Manual Entry</item>
46
     </menu>
46
     </menu>
47
 	<menu name="Graph">
47
 	<menu name="Graph">
48
-		<item id="unshift">Reset Translation</item>
49
-	</menu>
48
+		<item id="reshift" shortcut="Ctrl+T">Set Translation</item>
49
+		<item id="unshift" shortcut="Ctrl+R">Reset Translation</item>
50
+	</menu>roaster@wilsonscoffee.com
50
     <program>
51
     <program>
51
     <![CDATA[
52
     <![CDATA[
52
         var window = this;
53
         var window = this;
53
         var targetOffset = 0;
54
         var targetOffset = 0;
54
         var gtrans = 0;
55
         var gtrans = 0;
56
+		var oldtrans = 0;
55
 		var translationdelay = new Timer;
57
 		var translationdelay = new Timer;
56
 		translationdelay.interval = 0;
58
 		translationdelay.interval = 0;
57
 		translationdelay.singleShot = true;
59
 		translationdelay.singleShot = true;
59
         window.targetcolumnname = "";
61
         window.targetcolumnname = "";
60
         var currentDetector = new ThresholdDetector;
62
         var currentDetector = new ThresholdDetector;
61
         var translationChannel = -1;
63
         var translationChannel = -1;
64
+		var resetTranslation = findChildObject(this, 'unshift');
65
+		var setTranslation = findChildObject(this, 'reshift');
66
+		resetTranslation.enabled = false;
67
+		setTranslation.enabled = false;
62
         targetDetector.timeForValue.connect(function(value) {
68
         targetDetector.timeForValue.connect(function(value) {
63
             targetOffset = value;
69
             targetOffset = value;
64
         });
70
         });
100
 	var hasTranslated = false;
106
 	var hasTranslated = false;
101
 	var externtrans = undefined;
107
 	var externtrans = undefined;
102
 	window.translateLoadedSeries = function(translation) {
108
 	window.translateLoadedSeries = function(translation) {
103
-            var lc = Number(QSettings.value("liveColumn"));
104
-            for(var i = 1; i < lc - 1; i++)
105
-            {
106
-                graph.setSeriesTranslation(i, translation);
107
-            }
109
+	    var lc = Number(QSettings.value("liveColumn"));
110
+        for(var i = 1; i < lc - 1; i++)
111
+        {
112
+            graph.setSeriesTranslation(i, translation);
113
+        }
108
 	};
114
 	};
109
 	window.translateCurrentSeries = function(translation) {
115
 	window.translateCurrentSeries = function(translation) {
110
-            var lc = Number(QSettings.value("liveColumn"));
111
-            for(var i = 0; i < columnNames.length; i++)
112
-            {
113
-                graph.setSeriesTranslation(lc + i, translation);
114
-            }
116
+        var lc = Number(QSettings.value("liveColumn"));
117
+        for(var i = 0; i < columnNames.length; i++)
118
+        {
119
+            graph.setSeriesTranslation(lc + i, translation);
120
+        }
115
 	};
121
 	};
116
 	var selectedRoasterName = configModel.data(rootIndex, 0);
122
 	var selectedRoasterName = configModel.data(rootIndex, 0);
117
 	var machineReference = configModel.referenceElement(configModel.data(rootIndex, 32));
123
 	var machineReference = configModel.referenceElement(configModel.data(rootIndex, 32));
118
 	var selectedRoasterID = machineReference.databaseid;
124
 	var selectedRoasterID = machineReference.databaseid;
119
-        var checkCapacity = machineReference.checkcapacity;
120
-        var maxCapacity = machineReference.capacity;
121
-        var capacityUnit = machineReference.capacityunit;
122
-        var poundsCapacity;
123
-        var convertToPounds = function(w, u) {
124
-            switch(u) {
125
-                case "g":
126
-                    return w * 0.0022;
127
-                case "oz":
128
-                    return w * 0.0625;
129
-                case "Kg":
130
-                    return w * 2.2;
131
-            }
132
-            return w;
133
-        };
134
-        if(checkCapacity == "true") {
135
-            poundsCapacity = convertToPounds(maxCapacity, capacityUnit);
125
+    var checkCapacity = machineReference.checkcapacity;
126
+    var maxCapacity = machineReference.capacity;
127
+    var capacityUnit = machineReference.capacityunit;
128
+    var poundsCapacity;
129
+    var convertToPounds = function(w, u) {
130
+        switch(u) {
131
+            case "g":
132
+                return w * 0.0022;
133
+            case "oz":
134
+                return w * 0.0625;
135
+            case "Kg":
136
+                return w * 2.2;
136
         }
137
         }
138
+        return w;
139
+    };
140
+    if(checkCapacity == "true") {
141
+        poundsCapacity = convertToPounds(maxCapacity, capacityUnit);
142
+    }
137
 	if(configModel.hasChildren(rootIndex)) {
143
 	if(configModel.hasChildren(rootIndex)) {
138
 		for(var i = 0; i < configModel.rowCount(rootIndex); i++) {
144
 		for(var i = 0; i < configModel.rowCount(rootIndex); i++) {
139
 			var driverIndex = configModel.index(i, 0, rootIndex);
145
 			var driverIndex = configModel.index(i, 0, rootIndex);
381
 					tabControls.push(outputControl);
387
 					tabControls.push(outputControl);
382
 				}
388
 				}
383
 			}
389
 			}
384
-                        else if(driverReference.driver == "modbusngport")
385
-                        {
386
-                            var device = new ModbusNG(configModel, driverIndex);
387
-                            modbusdevices.push(device);
388
-                            for(var j = 0; j < device.channelCount(); j++) {
389
-                                channels.push(device.getChannel(j));
390
-                                columnNames.push(device.channelColumnName(j));
391
-                                channelType.push(device.channelType(j));
392
-                                if(device.isChannelHidden(j)) {
393
-                                    channelVisibility.push(false);
394
-                                } else {
395
-                                    channelVisibility.push(true);
396
-                                    var indicator = new TemperatureDisplay;
397
-									if(device.channelType(j) == "C") {
398
-										indicator.setDisplayUnits(Units.Unitless);
399
-										indicator.digitCount = 6;
400
-									}
401
-                                    temperatureDisplays.push(indicator);
402
-                                    var decorator = new WidgetDecorator(indicator, device.channelIndicatorText(j), 2);
403
-                                    device.getChannel(j).newData.connect(indicator.setValue);
404
-                                    indicatorPanel.addWidget(decorator);
405
-                                }
406
-                            }
407
-                        }
390
+            else if(driverReference.driver == "modbusngport")
391
+            {
392
+                var device = new ModbusNG(configModel, driverIndex);
393
+                modbusdevices.push(device);
394
+                for(var j = 0; j < device.channelCount(); j++) {
395
+                    channels.push(device.getChannel(j));
396
+                    columnNames.push(device.channelColumnName(j));
397
+                    channelType.push(device.channelType(j));
398
+                    if(device.isChannelHidden(j)) {
399
+                        channelVisibility.push(false);
400
+                    } else {
401
+                        channelVisibility.push(true);
402
+                        var indicator = new TemperatureDisplay;
403
+						if(device.channelType(j) == "C") {
404
+							indicator.setDisplayUnits(Units.Unitless);
405
+							indicator.digitCount = 6;
406
+						}
407
+                        temperatureDisplays.push(indicator);
408
+                        var decorator = new WidgetDecorator(indicator, device.channelIndicatorText(j), 2);
409
+                        device.getChannel(j).newData.connect(indicator.setValue);
410
+                        indicatorPanel.addWidget(decorator);
411
+                    }
412
+                }
413
+            }
408
 			else if(driverReference.driver == "unsupporteddevice")
414
 			else if(driverReference.driver == "unsupporteddevice")
409
 			{
415
 			{
410
 				var device = createDevice(driverIndex);
416
 				var device = createDevice(driverIndex);
464
 				annotationPanel.addWidget(button);
470
 				annotationPanel.addWidget(button);
465
 				tabControls.push(button);
471
 				tabControls.push(button);
466
 			}
472
 			}
467
-                        else if(driverReference.driver == "thresholdannotation")
468
-                        {
469
-                            var noteDetector = new ThresholdDetector();
470
-                            var noteEmitter = new Annotator(driverReference.annotation);
471
-                            noteDetector.setThreshold(Number(driverReference.value));
472
-                            for(var j = 0; j < columnNames.length; j++) {
473
-                                if(columnNames[j] == driverReference.source) {
474
-                                    channels[j].newData.connect(noteDetector.newMeasurement);
475
-                                    break;
476
-                                }
477
-                            }
478
-                            if(Number(driverReference.direction) == 1) {
479
-                                noteDetector.setEdgeDirection(ThresholdDetector.Descending);
480
-                            } else {
481
-                                noteDetector.setEdgeDirection(ThresholdDetector.Ascending);
482
-                            }
483
-                            var scope = new Object;
484
-                            scope.invoke = function() {
485
-                                if(timer.running) {
486
-                                    arguments.callee.noteEmitter.annotate();
487
-                                }
488
-                            }
489
-                            scope.invoke.noteEmitter = noteEmitter;
490
-                            noteDetector.timeForValue.connect(scope.invoke);
491
-                            annotationButtons.push(noteEmitter);
492
-                        }
473
+            else if(driverReference.driver == "thresholdannotation")
474
+            {
475
+                var noteDetector = new ThresholdDetector();
476
+                var noteEmitter = new Annotator(driverReference.annotation);
477
+                noteDetector.setThreshold(Number(driverReference.value));
478
+                for(var j = 0; j < columnNames.length; j++) {
479
+                    if(columnNames[j] == driverReference.source) {
480
+                        channels[j].newData.connect(noteDetector.newMeasurement);
481
+                        break;
482
+                    }
483
+                }
484
+                if(Number(driverReference.direction) == 1) {
485
+                    noteDetector.setEdgeDirection(ThresholdDetector.Descending);
486
+                } else {
487
+                    noteDetector.setEdgeDirection(ThresholdDetector.Ascending);
488
+                }
489
+                var scope = new Object;
490
+                scope.invoke = function() {
491
+                    if(timer.running) {
492
+                        arguments.callee.noteEmitter.annotate();
493
+                    }
494
+                }
495
+                scope.invoke.noteEmitter = noteEmitter;
496
+                noteDetector.timeForValue.connect(scope.invoke);
497
+                annotationButtons.push(noteEmitter);
498
+            }
493
 			else if(driverReference.driver == "valueannotation")
499
 			else if(driverReference.driver == "valueannotation")
494
 			{
500
 			{
495
 				var checker = new ValueAnnotation;
501
 				var checker = new ValueAnnotation;
634
 								}
640
 								}
635
 							}
641
 							}
636
 							hasTranslated = true;
642
 							hasTranslated = true;
643
+							resetTranslation.enabled = true;
637
 						});
644
 						});
638
-						var resetTranslation = findChildObject(this, 'unshift');
639
 						resetTranslation.triggered.connect(function() {
645
 						resetTranslation.triggered.connect(function() {
640
 							if(gtrans > 0) {
646
 							if(gtrans > 0) {
641
 								window.translateLoadedSeries(-gtrans);
647
 								window.translateLoadedSeries(-gtrans);
643
 							else {
649
 							else {
644
 								window.translateCurrentSeries(gtrans);
650
 								window.translateCurrentSeries(gtrans);
645
 							}
651
 							}
652
+							oldtrans = gtrans;
646
 							gtrans = 0;
653
 							gtrans = 0;
647
-							indicator.display(0);
654
+							externtrans.display(0);
648
 							hasTranslated = false;
655
 							hasTranslated = false;
656
+							setTranslation.enabled = true;
657
+						});
658
+						setTranslation.triggered.connect(function() {
659
+							externtrans.display(oldtrans);
660
+							gtrans = oldtrans;
661
+							if(gtrans > 0) {
662
+								window.translateLoadedSeries(gtrans);
663
+							}
664
+							else {
665
+								window.translateCurrentSeries(-gtrans);
666
+							}
667
+							hasTranslated = true;
668
+							resetTranslation.enabled = true;
669
+							setTranslation.enabled = false;
649
 						});
670
 						});
650
 					}
671
 					}
651
 				}
672
 				}
691
 				scale.open(3);
712
 				scale.open(3);
692
 				window.scales.push(scale);
713
 				window.scales.push(scale);
693
 			}
714
 			}
694
-                        else if(driverReference.driver == "coolingtimer")
715
+            else if(driverReference.driver == "coolingtimer")
716
+            {
717
+                var coolingTimer = new TimerDisplay();
718
+                coolingTimer.setDisplayFormat("mm:ss");
719
+                var decorator = new WidgetDecorator(coolingTimer, configModel.data(driverIndex, 0), 2);
720
+                indicatorPanel.addWidget(decorator);
721
+                coolingTimer.setTimerMode(1);
722
+                coolingTimer.setAutoReset(true);
723
+                var timeValue = new QTime();
724
+                timeValue = timeValue.fromString(driverReference.reset, "mm:ss");
725
+                coolingTimer.setResetValue(timeValue);
726
+                stop.clicked.connect(coolingTimer.startTimer);
727
+            }
728
+            else if(driverReference.driver == "rangetimer")
729
+            {
730
+                rangetimers.push(new TimerDisplay());
731
+                var rangeTimer = rangetimers[rangetimers.length - 1];
732
+                rangeTimer.setDisplayFormat("mm:ss");
733
+                var decorator = new WidgetDecorator(rangeTimer, configModel.data(driverIndex, 0), 2);
734
+                indicatorPanel.addWidget(decorator);
735
+                stop.clicked.connect(rangeTimer.stopTimer);
736
+                start.clicked.connect(rangeTimer.reset);
737
+                if(driverReference.starttrigger == "batch")
738
+                {
739
+                    start.clicked.connect(rangeTimer.startTimer);
740
+                }
741
+                else if(driverReference.starttrigger == "manual")
742
+                {
743
+                    var startButton = new AnnotationButton(driverReference.startbuttontext);
744
+                    startButton.clicked.connect(rangeTimer.startTimer);
745
+                    annotationPanel.addWidget(startButton);
746
+                    tabControls.push(button);
747
+                }
748
+                else if(driverReference.starttrigger == "value")
749
+                {
750
+                    var startTrigger = new ThresholdDetector();
751
+                    startTrigger.setThreshold(Number(driverReference.startvalue));
752
+                    var scope = new Object;
753
+                    scope.invoke = function() {
754
+                        if(timer.running && !(arguments.callee.rangeTimer.running))
695
                         {
755
                         {
696
-                            var coolingTimer = new TimerDisplay();
697
-                            coolingTimer.setDisplayFormat("mm:ss");
698
-                            var decorator = new WidgetDecorator(coolingTimer, configModel.data(driverIndex, 0), 2);
699
-                            indicatorPanel.addWidget(decorator);
700
-                            coolingTimer.setTimerMode(1);
701
-                            coolingTimer.setAutoReset(true);
702
-                            var timeValue = new QTime();
703
-                            timeValue = timeValue.fromString(driverReference.reset, "mm:ss");
704
-                            coolingTimer.setResetValue(timeValue);
705
-                            stop.clicked.connect(coolingTimer.startTimer);
756
+                            arguments.callee.rangeTimer.startTimer();
706
                         }
757
                         }
707
-                        else if(driverReference.driver == "rangetimer")
708
-                        {
709
-                            rangetimers.push(new TimerDisplay());
710
-                            var rangeTimer = rangetimers[rangetimers.length - 1];
711
-                            rangeTimer.setDisplayFormat("mm:ss");
712
-                            var decorator = new WidgetDecorator(rangeTimer, configModel.data(driverIndex, 0), 2);
713
-                            indicatorPanel.addWidget(decorator);
714
-                            stop.clicked.connect(rangeTimer.stopTimer);
715
-                            start.clicked.connect(rangeTimer.reset);
716
-                            if(driverReference.starttrigger == "batch")
717
-                            {
718
-                                start.clicked.connect(rangeTimer.startTimer);
719
-                            }
720
-                            else if(driverReference.starttrigger == "manual")
721
-                            {
722
-                                var startButton = new AnnotationButton(driverReference.startbuttontext);
723
-                                startButton.clicked.connect(rangeTimer.startTimer);
724
-                                annotationPanel.addWidget(startButton);
725
-                                tabControls.push(button);
726
-                            }
727
-                            else if(driverReference.starttrigger == "value")
728
-                            {
729
-                                var startTrigger = new ThresholdDetector();
730
-                                startTrigger.setThreshold(Number(driverReference.startvalue));
731
-                                var scope = new Object;
732
-                                scope.invoke = function() {
733
-                                    if(timer.running && !(arguments.callee.rangeTimer.running))
734
-                                    {
735
-                                        arguments.callee.rangeTimer.startTimer();
736
-                                    }
737
-                                };
738
-                                scope.invoke.rangeTimer = rangeTimer;
739
-                                startTrigger.timeForValue.connect(scope.invoke);
740
-                                for(var j = 0; j < columnNames.length; j++)
741
-                                {
742
-                                    if(columnNames[j] == driverReference.startcolumnname)
743
-                                    {
744
-                                        channels[j].newData.connect(startTrigger.newMeasurement);
745
-                                    }
746
-                                }
747
-                            }
748
-                            stop.clicked.connect(rangeTimer.stopTimer)
749
-                            if(driverReference.stoptrigger == "manual")
750
-                            {
751
-                                var stopButton = new AnnotationButton(driverReference.stopbuttontext);
752
-                                stopButton.clicked.connect(rangeTimer.stopTimer);
753
-                                annotationPanel.addWidget(stopButton);
754
-                                tabControls.push(button);
755
-                            }
756
-                            else if(driverReference.stoptrigger == "value")
757
-                            {
758
-                                var stopTrigger = new ThresholdDetector();
759
-                                stopTrigger.setThreshold(Number(driverReference.stopvalue));
760
-                                stopTrigger.timeForValue.connect(rangeTimer.stopTimer);
761
-                                for(var j = 0; j < columnNames.length; j++)
762
-                                {
763
-                                    if(columnNames[j] == driverReference.stopcolumnname)
764
-                                    {
765
-                                        channels[j].newData.connect(stopTrigger.newMeasurement);
766
-                                    }
767
-                                }
768
-                            }
769
-                            rangeTimer.reportingName = configModel.data(driverIndex, 0);
770
-                            rangeTimer.report = function() {
771
-                                return "" + this.reportingName + ": " + this.value;
772
-                            };
758
+                    };
759
+                    scope.invoke.rangeTimer = rangeTimer;
760
+                    startTrigger.timeForValue.connect(scope.invoke);
761
+                    for(var j = 0; j < columnNames.length; j++)
762
+                    {
763
+                        if(columnNames[j] == driverReference.startcolumnname)
764
+	                    {
765
+                            channels[j].newData.connect(startTrigger.newMeasurement);
773
                         }
766
                         }
774
-                        else if(driverReference.driver = "multirangetimer")
767
+                    }
768
+                }
769
+                stop.clicked.connect(rangeTimer.stopTimer)
770
+                if(driverReference.stoptrigger == "manual")
771
+                {
772
+                    var stopButton = new AnnotationButton(driverReference.stopbuttontext);
773
+                    stopButton.clicked.connect(rangeTimer.stopTimer);
774
+                    annotationPanel.addWidget(stopButton);
775
+                    tabControls.push(button);
776
+                }
777
+                else if(driverReference.stoptrigger == "value")
778
+                {
779
+                    var stopTrigger = new ThresholdDetector();
780
+                    stopTrigger.setThreshold(Number(driverReference.stopvalue));
781
+                    stopTrigger.timeForValue.connect(rangeTimer.stopTimer);
782
+                    for(var j = 0; j < columnNames.length; j++)
783
+                    {
784
+                        if(columnNames[j] == driverReference.stopcolumnname)
775
                         {
785
                         {
776
-                            var rangeTimer = new TimerDisplay();
777
-                            rangeTimer.setDisplayFormat("mm:ss");
778
-                            var decorator = new WidgetDecorator(rangeTimer, configModel.data(driverIndex, 0), 2);
779
-                            indicatorPanel.addWidget(decorator);
780
-                            var rangenames = driverReference.rangenames;
781
-                            var endtemps = driverReference.endtemps;
782
-                            var names = rangenames.slice(2, rangenames.length - 2).split(", ");
783
-                            rangeTimer.rangeNames = new Array();
784
-                            for(var j = 0; j < names.length; j++)
785
-                            {
786
-                                var name = names[j].slice(1, names[j].length - 1);
787
-                                rangeTimer.rangeNames.push(name);
788
-                            }
789
-                            rangeTimer.rangeEnds = new Array();
790
-                            var ends = endtemps.slice(2, endtemps.length - 2).split(", ");
791
-                            for(var j = 0; j < ends.length; j++)
792
-                            {
793
-                                rangeTimer.rangeEnds.push(Number(ends[j]));
794
-                            }
795
-                            rangeTimer.currentRange = 0;
796
-                            rangeTimer.results = new Array();
797
-                            rangeTimer.trigger = new ThresholdDetector();
798
-                            for(var j = 0; j < columnNames.length; j++)
799
-                            {
800
-                                if(columnNames[j] == driverReference.trigger)
801
-                                {
802
-                                    channels[j].newData.connect(rangeTimer.trigger.newMeasurement);
803
-                                }
804
-                            }
805
-                            rangeTimer.startRanges = function() {
806
-                                arguments.callee.timer.currentRange = 0;
807
-                                arguments.callee.timer.results.splice(0, arguments.callee.timer.results.length);
808
-                                arguments.callee.timer.trigger.setThreshold(arguments.callee.timer.rangeEnds[0]);
809
-                            };
810
-                            rangeTimer.startRanges.timer = rangeTimer;
811
-                            start.clicked.connect(rangeTimer.startTimer);
812
-                            start.clicked.connect(rangeTimer.startRanges);
813
-                            rangeTimer.transition = function() {
814
-                                arguments.callee.timer.stopTimer();
815
-                                arguments.callee.timer.results.push(arguments.callee.timer.value);
816
-                                arguments.callee.timer.reset();
817
-                                arguments.callee.timer.startTimer();
818
-                                arguments.callee.timer.currentRange++;
819
-                                if(arguments.callee.timer.currentRange <= arguments.callee.timer.rangeEnds.length)
820
-                                {
821
-                                    arguments.callee.timer.trigger.setThreshold(arguments.callee.timer.rangeEnds[arguments.callee.timer.currentRange]);
822
-                                }
823
-                            };
824
-                            rangeTimer.transition.timer = rangeTimer;
825
-                            rangeTimer.trigger.timeForValue.connect(rangeTimer.transition);
826
-                            stop.clicked.connect(rangeTimer.transition);
827
-                            stop.clicked.connect(rangeTimer.stopTimer);
828
-                            rangeTimer.report = function() {
829
-                                var retval = "";
830
-                                for(var j = 0; j < arguments.callee.timer.results.length; j++)
831
-                                {
832
-                                    retval += arguments.callee.timer.rangeNames[j] + ": " + arguments.callee.timer.results[j] + "\n";
833
-                                }
834
-                                return retval;
835
-                            };
836
-                            rangeTimer.report.timer = rangeTimer;
837
-                            rangetimers.push(rangeTimer);
786
+                            channels[j].newData.connect(stopTrigger.newMeasurement);
838
                         }
787
                         }
788
+                    }
789
+                }
790
+                rangeTimer.reportingName = configModel.data(driverIndex, 0);
791
+                rangeTimer.report = function() {
792
+                    return "" + this.reportingName + ": " + this.value;
793
+                };
794
+            }
795
+            else if(driverReference.driver = "multirangetimer")
796
+            {
797
+                var rangeTimer = new TimerDisplay();
798
+                rangeTimer.setDisplayFormat("mm:ss");
799
+                var decorator = new WidgetDecorator(rangeTimer, configModel.data(driverIndex, 0), 2);
800
+                indicatorPanel.addWidget(decorator);
801
+                var rangenames = driverReference.rangenames;
802
+                var endtemps = driverReference.endtemps;
803
+                var names = rangenames.slice(2, rangenames.length - 2).split(", ");
804
+                rangeTimer.rangeNames = new Array();
805
+                for(var j = 0; j < names.length; j++)
806
+                {
807
+                    var name = names[j].slice(1, names[j].length - 1);
808
+                    rangeTimer.rangeNames.push(name);
809
+                }
810
+                rangeTimer.rangeEnds = new Array();
811
+                var ends = endtemps.slice(2, endtemps.length - 2).split(", ");
812
+                for(var j = 0; j < ends.length; j++)
813
+                {
814
+                    rangeTimer.rangeEnds.push(Number(ends[j]));
815
+                }
816
+                rangeTimer.currentRange = 0;
817
+                rangeTimer.results = new Array();
818
+                rangeTimer.trigger = new ThresholdDetector();
819
+                for(var j = 0; j < columnNames.length; j++)
820
+                {
821
+                    if(columnNames[j] == driverReference.trigger)
822
+                    {
823
+                        channels[j].newData.connect(rangeTimer.trigger.newMeasurement);
824
+                    }
825
+                }
826
+                rangeTimer.startRanges = function() {
827
+                    arguments.callee.timer.currentRange = 0;
828
+                    arguments.callee.timer.results.splice(0, arguments.callee.timer.results.length);
829
+                    arguments.callee.timer.trigger.setThreshold(arguments.callee.timer.rangeEnds[0]);
830
+                };
831
+                rangeTimer.startRanges.timer = rangeTimer;
832
+                start.clicked.connect(rangeTimer.startTimer);
833
+                start.clicked.connect(rangeTimer.startRanges);
834
+                rangeTimer.transition = function() {
835
+                    arguments.callee.timer.stopTimer();
836
+                    arguments.callee.timer.results.push(arguments.callee.timer.value);
837
+                    arguments.callee.timer.reset();
838
+                    arguments.callee.timer.startTimer();
839
+                    arguments.callee.timer.currentRange++;
840
+                    if(arguments.callee.timer.currentRange <= arguments.callee.timer.rangeEnds.length)
841
+                    {
842
+                        arguments.callee.timer.trigger.setThreshold(arguments.callee.timer.rangeEnds[arguments.callee.timer.currentRange]);
843
+                    }
844
+                };
845
+                rangeTimer.transition.timer = rangeTimer;
846
+                rangeTimer.trigger.timeForValue.connect(rangeTimer.transition);
847
+                stop.clicked.connect(rangeTimer.transition);
848
+                stop.clicked.connect(rangeTimer.stopTimer);
849
+                rangeTimer.report = function() {
850
+                    var retval = "";
851
+                    for(var j = 0; j < arguments.callee.timer.results.length; j++)
852
+                    {
853
+                        retval += arguments.callee.timer.rangeNames[j] + ": " + arguments.callee.timer.results[j] + "\n";
854
+                    }
855
+                    return retval;
856
+                };
857
+                rangeTimer.report.timer = rangeTimer;
858
+                rangetimers.push(rangeTimer);
859
+            }
839
 		}
860
 		}
840
 	}
861
 	}
841
 	for(var i = 1; i < tabControls.length; i++)
862
 	for(var i = 1; i < tabControls.length; i++)
943
         start.clicked.connect(function() {
964
         start.clicked.connect(function() {
944
 			start.enabled = false;
965
 			start.enabled = false;
945
 			hasTranslated = false;
966
 			hasTranslated = false;
967
+			resetTranslation.enabled = false;
968
+			setTranslation.enabled = false;
946
             var epoch = new QTime();
969
             var epoch = new QTime();
947
             epoch = epoch.currentTime();
970
             epoch = epoch.currentTime();
948
 			for(var i = 0; i < offsets.length; i++)
971
 			for(var i = 0; i < offsets.length; i++)
1108
 			if(typeof(externtrans) != 'undefined') {
1131
 			if(typeof(externtrans) != 'undefined') {
1109
 				externtrans.display(0);
1132
 				externtrans.display(0);
1110
 			}
1133
 			}
1134
+			resetTranslation.enabled = false;
1135
+			setTranslation.enabled = false;
1111
         });
1136
         });
1112
 		var openMenu = findChildObject(this, 'open');
1137
 		var openMenu = findChildObject(this, 'open');
1113
         var compareMenu = findChildObject(this, 'compare');
1138
         var compareMenu = findChildObject(this, 'compare');
1148
 						targetDetector.newMeasurement(data);
1173
 						targetDetector.newMeasurement(data);
1149
 					}
1174
 					}
1150
 				});
1175
 				});
1176
+				resetTranslation.enabled = false;
1177
+				setTranslation.enabled = false;
1151
                 input.annotation.connect(log.newAnnotation);
1178
                 input.annotation.connect(log.newAnnotation);
1152
 				input.annotation.connect(function(note, tcol, ncol) {
1179
 				input.annotation.connect(function(note, tcol, ncol) {
1153
 					for(var i = tcol; i < ncol; i++) {
1180
 					for(var i = tcol; i < ncol; i++) {

Loading…
Cancel
Save