Skip to content

Commit c7f6189

Browse files
author
Gary Keeble
committed
Merge branch 'master' into Cosmetic-Changes
2 parents 4ec112e + 7e54d38 commit c7f6189

File tree

9 files changed

+200
-75
lines changed

9 files changed

+200
-75
lines changed

css/user_settings_dialog.css

Lines changed: 18 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,24 +1,41 @@
1-
.user-settings-dialog img {
1+
.user-settings-dialog .custom_mixes_group img {
22
width: 125px;
33
max-height: 125px;
44
}
55

6+
.user-settings-dialog .stick_mode_group img {
7+
width: 200px;
8+
max-height: 125px;
9+
}
10+
611
.user-settings-dialog table {
712
width:calc(100% - 2px);
813
}
914

1015
.user-settings-dialog select {
1116
width:100px;
1217
margin-left:10px;
18+
margin-bottom:5px
1319
}
1420

1521
.user-settings-dialog label.option {
1622
width: 100%;
1723
}
1824

25+
.user-settings-dialog label + input[type=radio] {
26+
margin-left: 6px;
27+
margin-bottom:5px
28+
}
29+
30+
.user-settings-dialog input[type=radio] {
31+
margin-left: 85px;
32+
margin-bottom:5px
33+
}
1934

2035
.user-settings-dialog label {
2136
width: 75px;
37+
margin-bottom:0px;
38+
2239
}
2340

2441

images/stick_modes/Mode_1.png

10.8 KB
Loading

images/stick_modes/Mode_2.png

10.8 KB
Loading

images/stick_modes/Mode_3.png

10.8 KB
Loading

images/stick_modes/Mode_4.png

10.8 KB
Loading

index.html

Lines changed: 39 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@
1818
<script src="js/vendor/modernizr-2.6.2-respond-1.1.0.min.js"></script>
1919
</head>
2020
<body>
21+
<!-- Navigation Bar -->
2122
<nav class="navbar navbar-inverse navbar-static-top" role="navigation">
2223
<div class="container header-pane">
2324
<div class="navbar-header">
@@ -37,12 +38,12 @@
3738
<!--</div>-->
3839
</div>
3940
</nav>
40-
41+
<!-- Welcome Page -->
4142
<div class="welcome-pane">
4243
<div class="container">
4344
<div class="jumbotron">
44-
<h1>Welcome to Blackbox Explorer!</h1>
45-
<p>This tool allows you to view and analyze logs created by Cleanflight's Blackbox feature.</p>
45+
<h1>Welcome to the Enhanced Blackbox Explorer!</h1>
46+
<p>This tool allows you to view and analyze logs created by Cleanflight's and Betaflight's Blackbox feature.</p>
4647
<span class="btn btn-primary btn-lg btn-file"> Open log file/video <input type="file" class="file-open" multiple></span>
4748
</div>
4849
</div>
@@ -56,12 +57,12 @@ <h1>Welcome to Blackbox Explorer!</h1>
5657
</div>
5758
<div class="panel-body">
5859
<p>
59-
The Blackbox feature is built in to <a href="https://github.com/cleanflight/cleanflight">Cleanflight</a>,
60+
The Blackbox feature is built in to <a href="https://github.com/cleanflight/cleanflight">Cleanflight</a> and <a href="https://github.com/betaflight/betaflight/releases">Betaflight</a>,
6061
and is supported on most of CF's flight controllers (Naze32, CC3D, SPRacingF3, etc.).
6162
</p>
6263
<p>
6364
To get started with Blackbox recording, read
64-
<a href="https://github.com/cleanflight/cleanflight/blob/master/docs/Blackbox.md">Cleanflight's
65+
<a href="https://github.com/cleanflight/cleanflight/blob/master/docs/Blackbox.md">Cleanflight and Betaflight's
6566
Blackbox feature documentation</a>.
6667
</p>
6768
<p>
@@ -72,7 +73,7 @@ <h1>Welcome to Blackbox Explorer!</h1>
7273
<p>
7374
If you believe you've found a bug in this viewer (e.g. the viewer crashes upon attempting to
7475
open a log file), or you have a suggestion, please add it to
75-
<a href="https://github.com/cleanflight/blackbox-log-viewer/issues">the viewer's GitHub bug tracker</a>.
76+
<a href="https://github.com/betaflight/blackbox-log-viewer/issues">the viewer's GitHub bug tracker</a>.
7677
</p>
7778
</div>
7879
</div>
@@ -98,13 +99,19 @@ <h1>Welcome to Blackbox Explorer!</h1>
9899
<a href="http://www.rcgroups.com/forums/showthread.php?t=2386267">Blackbox log analyzation/help thread</a> on RCGroups.com
99100
</li>
100101
<li>
101-
<a href="https://github.com/cleanflight/cleanflight/blob/master/docs/PID%20tuning.md">Cleanflight's PID tuning documentation</a>
102+
<a href="https://github.com/cleanflight/cleanflight/blob/master/docs/PID%20tuning.md">Cleanflight and Betaflight's PID tuning documentation</a>
102103
</li>
103104
<li>
104105
<a href="http://www.rcgroups.com/forums/showthread.php?t=2249574">Cleanflight support topic</a> on RCGroups.com
105106
</li>
106107
<li>
107-
<a href="http://www.rcgroups.com/forums/showthread.php?t=2299805">Blackbox announcement topic</a> on RCGroups.com
108+
<a href="http://www.rcgroups.com/forums/showthread.php?t=2464844">Betaflight support topic</a> on RCGroups.com
109+
</li>
110+
<li>
111+
<a href="http://www.rcgroups.com/forums/showthread.php?t=2299805">Blackbox announcement topic (original viewer)</a> on RCGroups.com
112+
</li>
113+
<li>
114+
<a href="http://www.rcgroups.com/forums/showthread.php?t=2649495">Enhanced Blackbox announcement topic (this viewer)</a> on RCGroups.com
108115
</li>
109116
</ul>
110117
</div>
@@ -134,8 +141,8 @@ <h1>Welcome to Blackbox Explorer!</h1>
134141
</div>
135142
</div>
136143
</div>
137-
138-
<div class="container main-pane">
144+
<!-- Main Page -->
145+
<div class="container-fluid main-pane">
139146
<div class="log-metadata">
140147
<div class="log-info form-horizontal">
141148
<div class="form-group">
@@ -302,8 +309,7 @@ <h2>Legend <span class="log-close-legend-dialog glyphicon glyphicon-remove"></sp
302309
</div>
303310

304311
</div>
305-
<!-- /container -->
306-
312+
<!-- Status Bar -->
307313
<div id="status-bar">
308314
<div>
309315
<span class="version">-</span>
@@ -357,8 +363,8 @@ <h2>Legend <span class="log-close-legend-dialog glyphicon glyphicon-remove"></sp
357363
<span class="configuration-file-name">-</span>
358364
</div>
359365
</div>
360-
361-
<div class="modal fade" id="dlgGraphConfiguration">
366+
<!-- Dialog Boxes and Popup Windows -->
367+
<div class="modal fade graph-configuration-dialog" id="dlgGraphConfiguration">
362368
<div class="modal-dialog">
363369
<div class="modal-content">
364370
<div class="modal-header">
@@ -385,7 +391,6 @@ <h4 class="modal-title">Configure graphs</h4>
385391
</div>
386392
</div>
387393
</div>
388-
389394
<div class="modal fade header-dialog" id="dlgHeaderDialog">
390395
<div class="modal-dialog">
391396
<div class="modal-content">
@@ -834,7 +839,6 @@ <h5 class="modal-title-date"></h5>
834839
</div>
835840
</div>
836841
</div>
837-
838842
<div class="modal fade keys-dialog" id="dlgKeysDialog">
839843
<div class="modal-dialog">
840844
<div class="modal-content">
@@ -925,8 +929,7 @@ <h4 class="modal-title">Shortcut Keys</h4>
925929
</div>
926930
</div>
927931
</div>
928-
929-
<div class="modal fade" id="dlgVideoExport">
932+
<div class="modal fade video-export-dialog" id="dlgVideoExport">
930933
<div class="modal-dialog">
931934
<div class="modal-content">
932935
<div class="modal-header">
@@ -1038,7 +1041,6 @@ <h4 class="modal-title">Export video</h4>
10381041
</div>
10391042
</div>
10401043
</div>
1041-
10421044
<div class="modal fade user-settings-dialog" id="dlgUserSettings">
10431045
<div class="modal-dialog">
10441046
<div class="modal-content">
@@ -1049,8 +1051,6 @@ <h4 class="modal-title">Advanced User Settings</h4>
10491051
<div class="pane-user-settings form-horizontal">
10501052
<div class="form-group">
10511053
<label class="col-sm-3 control-label">Mixer Settings</label>
1052-
</tr>
1053-
</table>
10541054
<div class="col-sm-9">
10551055
<label class="option">Custom<input class="custom_mixes ios-switch orange" type="checkbox"/><div><div></div></div></label>
10561056
</div>
@@ -1070,6 +1070,23 @@ <h4 class="modal-title">Advanced User Settings</h4>
10701070
</p>
10711071
</div>
10721072
</div>
1073+
<div class="form-group">
1074+
<label class="col-sm-3 control-label">Stick Settings</label>
1075+
<div class="stick_mode_group col-sm-9">
1076+
<table>
1077+
<tr>
1078+
<td>
1079+
<label>Mode</label>
1080+
<input type="radio" name="stick-mode" value="1">Mode 1</input><br>
1081+
<input type="radio" name="stick-mode" value="2">Mode 2</input><br>
1082+
<input type="radio" name="stick-mode" value="3">Mode 3</input><br>
1083+
<input type="radio" name="stick-mode" value="4">Mode 4</input><br>
1084+
</td>
1085+
<td class="modePreview"><img src="./images/stick_modes/mode_2.png"/></td>
1086+
</tr>
1087+
</table>
1088+
</div>
1089+
</div>
10731090
</div>
10741091
</div>
10751092
<div class="modal-footer">
@@ -1079,7 +1096,7 @@ <h4 class="modal-title">Advanced User Settings</h4>
10791096
</div>
10801097
</div>
10811098
</div>
1082-
1099+
<!-- Scripts -->
10831100
<script src="js/vendor/jquery-1.11.3.min.js"></script>
10841101
<script src="js/vendor/bootstrap.min.js"></script>
10851102
<script src="js/vendor/jquery.ba-throttle-debounce.js"></script>

js/grapher.js

Lines changed: 68 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,11 @@ function FlightLogGrapher(flightLog, graphConfig, canvas, craftCanvas, analyserC
55
PID_P = 0,
66
PID_I = 1,
77
PID_D = 2,
8+
9+
STICK_MODE_1 = 1,
10+
STICK_MODE_2 = 2,
11+
STICK_MODE_3 = 3,
12+
STICK_MODE_4 = 4,
813

914
WHITE = "white",
1015

@@ -55,7 +60,7 @@ function FlightLogGrapher(flightLog, graphConfig, canvas, craftCanvas, analyserC
5560
drawCraft:"3D", drawPidTable:true, drawSticks:true, drawTime:true,
5661
drawAnalyser:true, // add an analyser option
5762
analyserSampleRate:2000/*Hz*/, // the loop time for the log
58-
eraseBackground: true // Set to false if you want the graph to draw on top of an existing canvas image
63+
eraseBackground: true // Set to false if you want the graph to draw on top of an existing canvas image
5964
},
6065

6166
windowWidthMicros = WINDOW_WIDTH_MICROS_DEFAULT,
@@ -253,6 +258,9 @@ function FlightLogGrapher(flightLog, graphConfig, canvas, craftCanvas, analyserC
253258
}
254259

255260
function drawCommandSticks(frame) {
261+
262+
canvasContext.save();
263+
256264
var
257265
// The total width available to draw both sticks in:
258266
sticksDisplayWidth = canvas.width * 0.3,
@@ -279,11 +287,35 @@ function FlightLogGrapher(flightLog, graphConfig, canvas, craftCanvas, analyserC
279287
rcCommand[stickIndex] = frame[idents.rcCommandFields[stickIndex]];
280288
}
281289

290+
291+
// map the stick positions based upon selected stick mode (default is mode 2)
292+
282293
//Compute the position of the sticks in the range [-1..1] (left stick x, left stick y, right stick x, right stick y)
283-
stickPositions[0] = -rcCommand[2] / yawStickMax; //Yaw
284-
stickPositions[1] = (1500 - rcCommand[3]) / 500; //Throttle
285-
stickPositions[2] = pitchStickCurve.lookup(rcCommand[0]); //Roll
286-
stickPositions[3] = pitchStickCurve.lookup(-rcCommand[1]); //Pitch
294+
switch(options.stickMode) {
295+
case STICK_MODE_1:
296+
stickPositions[0] = -rcCommand[2] / yawStickMax; //Yaw
297+
stickPositions[1] = pitchStickCurve.lookup(-rcCommand[1]); //Pitch
298+
stickPositions[2] = pitchStickCurve.lookup(rcCommand[0]); //Roll
299+
stickPositions[3] = (1500 - rcCommand[3]) / 500; //Throttle
300+
break;
301+
case STICK_MODE_3:
302+
stickPositions[0] = pitchStickCurve.lookup(rcCommand[0]); //Roll
303+
stickPositions[1] = pitchStickCurve.lookup(-rcCommand[1]); //Pitch
304+
stickPositions[2] = -rcCommand[2] / yawStickMax; //Yaw
305+
stickPositions[3] = (1500 - rcCommand[3]) / 500; //Throttle
306+
break;
307+
case STICK_MODE_4:
308+
stickPositions[0] = pitchStickCurve.lookup(rcCommand[0]); //Roll
309+
stickPositions[1] = (1500 - rcCommand[3]) / 500; //Throttle
310+
stickPositions[2] = -rcCommand[2] / yawStickMax; //Yaw
311+
stickPositions[3] = pitchStickCurve.lookup(-rcCommand[1]); //Pitch
312+
break;
313+
default: // Mode 2
314+
stickPositions[0] = -rcCommand[2] / yawStickMax; //Yaw
315+
stickPositions[1] = (1500 - rcCommand[3]) / 500; //Throttle
316+
stickPositions[2] = pitchStickCurve.lookup(rcCommand[0]); //Roll
317+
stickPositions[3] = pitchStickCurve.lookup(-rcCommand[1]); //Pitch
318+
}
287319

288320
for (stickIndex = 0; stickIndex < 4; stickIndex++) {
289321
//Clamp to [-1..1]
@@ -318,12 +350,6 @@ function FlightLogGrapher(flightLog, graphConfig, canvas, craftCanvas, analyserC
318350

319351
canvasContext.stroke();
320352

321-
//Draw circle to represent stick position
322-
canvasContext.beginPath();
323-
canvasContext.fillStyle = stickColor;
324-
canvasContext.arc(stickPositions[i * 2 + 0], stickPositions[i * 2 + 1], stickSurroundRadius / 5, 0, 2 * Math.PI);
325-
canvasContext.fill();
326-
327353
if (drawingParams.fontSizeCommandStickLabel) {
328354
canvasContext.fillStyle = WHITE;
329355

@@ -337,12 +363,37 @@ function FlightLogGrapher(flightLog, graphConfig, canvas, craftCanvas, analyserC
337363
stickLabel = frame[idents.rcCommandFields[(1 - i) * 2 + 1]] + "";
338364

339365
canvasContext.textAlign = 'right';
340-
canvasContext.fillText(stickLabel, -stickSurroundRadius - drawingParams.commandStickLabelMargin, drawingParams.fontSizeCurrentValueLabel / 2);
366+
canvasContext.fillText(stickLabel, -stickSurroundRadius, drawingParams.fontSizeCurrentValueLabel / 2);
367+
368+
369+
// put the mode label on the throttle stick
370+
if( (i==0 && (options.stickMode==STICK_MODE_2 || options.stickMode==STICK_MODE_4 )) ||
371+
(i==1 && (options.stickMode==STICK_MODE_1 || options.stickMode==STICK_MODE_3 ))
372+
) {
373+
//Draw stick mode label
374+
375+
canvasContext.fillStyle = crosshairColor;
376+
stickLabel = 'Mode ' + options.stickMode;
377+
378+
canvasContext.textAlign = 'center';
379+
canvasContext.fillText(stickLabel, 0, stickSurroundRadius - (drawingParams.fontSizeCurrentValueLabel / 2));
380+
}
381+
341382
}
383+
384+
//Draw circle to represent stick position
385+
canvasContext.beginPath();
386+
canvasContext.fillStyle = stickColor;
387+
canvasContext.arc(stickPositions[i * 2 + 0], stickPositions[i * 2 + 1], stickSurroundRadius / 7.5, 0, 2 * Math.PI);
388+
canvasContext.fill();
389+
342390

343391
//Advance to next stick
344392
canvasContext.translate(stickSurroundRadius + drawingParams.stickSpacing + stickSurroundRadius, 0);
345393
}
394+
395+
canvasContext.restore();
396+
346397
}
347398

348399
var
@@ -963,6 +1014,11 @@ function FlightLogGrapher(flightLog, graphConfig, canvas, craftCanvas, analyserC
9631014
analyser.setFullscreen( state );
9641015
};
9651016

1017+
// Update user options
1018+
this.refreshOptions = function(newSettings) {
1019+
options = $.extend(defaultOptions, newSettings || {});
1020+
}
1021+
9661022
// Use defaults for any options not provided
9671023
options = extend(defaultOptions, options || {});
9681024

0 commit comments

Comments
 (0)