Skip to content

Commit 4d79d80

Browse files
committed
try to add debug name to legend
1 parent 18c6d96 commit 4d79d80

File tree

1 file changed

+20
-10
lines changed

1 file changed

+20
-10
lines changed

js/graph_config.js

Lines changed: 20 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -194,7 +194,6 @@ GraphConfig.load = function(config) {
194194
GraphConfig.getDefaultCurveForField = function(flightLog, fieldName) {
195195
var
196196
sysConfig = flightLog.getSysConfig();
197-
198197
var maxDegreesSecond = function(scale) {
199198
switch(sysConfig["rates_type"]){
200199
case RATES_TYPE.indexOf('ACTUAL'):
@@ -917,12 +916,18 @@ GraphConfig.load = function(config) {
917916
* Supply an array of strings `graphNames` to only fetch the graph with the given names.
918917
*/
919918
GraphConfig.getExampleGraphConfigs = function(flightLog, graphNames) {
919+
920+
console.log("Running getExampleGraphConfigs");
921+
920922
var
921923
result = [],
922924
i, j;
923925

926+
var sysConfig = flightLog.getSysConfig();
927+
var debugModeName = DEBUG_MODE[sysConfig.debug_mode];
928+
924929
const EXAMPLE_GRAPHS = [];
925-
930+
926931
if (!flightLog.isFieldDisabled().MOTORS) {
927932
EXAMPLE_GRAPHS.push({label: "Motors",fields: ["motor[all]", "servo[5]"]});
928933
EXAMPLE_GRAPHS.push({label: "Motors (Legacy)",fields: ["motorLegacy[all]", "servo[5]"]});
@@ -955,19 +960,19 @@ GraphConfig.load = function(config) {
955960
EXAMPLE_GRAPHS.push({label: "Compass",fields: ["magADC[all]"]});
956961
}
957962
if (!flightLog.isFieldDisabled().DEBUG) {
958-
EXAMPLE_GRAPHS.push({label: "Debug",fields: ["debug[all]"]});
963+
EXAMPLE_GRAPHS.push({label: "Debug", fields: ["debug[all]"]});
959964
}
960965

961966
for (i = 0; i < EXAMPLE_GRAPHS.length; i++) {
962967
var
963968
srcGraph = EXAMPLE_GRAPHS[i],
964969
destGraph = {
965-
label: srcGraph.label,
970+
label: srcGraph.label,
966971
fields: [],
967972
height: srcGraph.height || 1
968973
},
969974
found;
970-
975+
971976
if (graphNames !== undefined) {
972977
found = false;
973978
for (j = 0; j < graphNames.length; j++) {
@@ -976,25 +981,30 @@ GraphConfig.load = function(config) {
976981
break;
977982
}
978983
}
979-
980984
if (!found) {
985+
console.log("not found" + srcGraph.label);
981986
continue;
982987
}
983988
}
984-
989+
990+
if (srcGraph.label.includes("Debug")) {
991+
console.log("src: " + srcGraph.label + " dest: " + destGraph.label);
992+
destGraph.label = "Debug " + debugModeName;
993+
console.log("src: " + srcGraph.label + " dest: " + destGraph.label);
994+
}
995+
985996
for (j = 0; j < srcGraph.fields.length; j++) {
986997
var
987998
srcFieldName = srcGraph.fields[j],
988999
destField = {
9891000
name: srcFieldName
9901001
};
991-
9921002
destGraph.fields.push(destField);
9931003
}
994-
1004+
9951005
result.push(destGraph);
9961006
}
997-
1007+
9981008
return result;
9991009
};
10001010
})();

0 commit comments

Comments
 (0)