Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added setting of minimum and maximum curves values on the graphs #689

Closed
wants to merge 220 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
220 commits
Select commit Hold shift + click to select a range
81357af
added minimum and maximum curves values
demvlad Jan 18, 2024
fb342b3
resolved issue: rewriting zero value input of min max values to chart…
demvlad Jan 19, 2024
8690e20
add: restore default min max values for curve by mouse click at clear…
demvlad Jan 23, 2024
9f22d93
change action to restore default minmax values at double mouse click …
demvlad Jan 24, 2024
ede477a
tab symbols are changed to 4 space in file graph_config_dialog.js
demvlad Jan 24, 2024
eec81b5
added function FlightLogFieldPresenter.ConvertDebugFieldValue() to co…
demvlad Jan 24, 2024
a3ff2a1
added helper function to convert values units
demvlad Jan 24, 2024
bf073e4
added function FlightLogFieldPresenter.ConvertFieldValue() to convert…
demvlad Jan 24, 2024
40af8bc
added curve values convertation from log to friendly chart when data …
demvlad Jan 24, 2024
6cc24a5
added convertation values to chart setup dialog box
demvlad Jan 24, 2024
2e04f26
Convertation of MinMax values optimization. There were before: MinMax…
demvlad Jan 25, 2024
e058681
Restore normal work in standard mode without using MinMax
demvlad Jan 25, 2024
f0aad2b
resolved issue: restore wrong default MinMax values when new curve i…
demvlad Jan 25, 2024
a573f18
add use $('select.form-control option:selected', elem).val() as field…
demvlad Jan 25, 2024
3c667f9
deleted undesired trailing spaces
demvlad Jan 25, 2024
80096c8
added: show context menu by right mouse click at minmax control eleme…
demvlad Jan 29, 2024
dc7dea3
at context menu are added functions to set all minmax to default and …
demvlad Jan 29, 2024
c787681
added round of min max values to 1 digit in the output
demvlad Jan 30, 2024
21420c4
added function SetSelectedCurveMinMaxToDefault to set selected curves…
demvlad Jan 30, 2024
77bfa61
add using associative list instead of array to store curves data
demvlad Jan 30, 2024
4a6acdd
added function FitSelectedCurveToOneScaleWithSecond to fit selected c…
demvlad Jan 30, 2024
426d5c5
add functions to place curves around zero axis
demvlad Jan 30, 2024
381ba18
Labels of context menu are corrected
demvlad Jan 30, 2024
d3d2e83
code style improvement
demvlad Jan 31, 2024
9d068c1
Merge branch 'master' into min_max_chart_settings
demvlad Jan 31, 2024
5f53523
added getWindowCenterTime function to FlightLogGrapher
demvlad Feb 1, 2024
73bf1a5
added function getMinMaxForFieldDuringTimeInterval to FlightLog
demvlad Feb 1, 2024
a85a1e7
resolved: compute min-max values for calculated log fields
demvlad Feb 1, 2024
df4b5b8
added function GraphConfig.getMinMaxForFieldDuringWindowTimeInterval …
demvlad Feb 2, 2024
a76ed02
added reference to FlightLogGrapher in GraphConfigurationDialog
demvlad Feb 2, 2024
c1b0e0b
added function SetAllMinMaxValuesToFullRangeDuringWindowTime to use i…
demvlad Feb 2, 2024
3bd8a5a
added menu action to set all curves min-max values to current local w…
demvlad Feb 2, 2024
86d5834
added menu action to set minmax in window full range for selected curve
demvlad Feb 2, 2024
d3a8975
resolved issue: wrong context menu position by right mouse click. Scr…
demvlad Feb 2, 2024
e0866b8
added charts redrawing after min-max control actions
demvlad Feb 3, 2024
297c067
added restore last curves setting when Cancel button pressed
demvlad Feb 3, 2024
5437417
added preventDefault call before show menu
demvlad Feb 3, 2024
9dd274f
bodies of menu handlers functions are replaced
demvlad Feb 3, 2024
ac2e9f1
Merge branch 'master' into min_max_chart_settings
demvlad Feb 5, 2024
45041ea
added minmax values for GYRO_SAMPLE debug mode
demvlad Feb 5, 2024
ea1ee32
temporary solution of fields stat issue, stat changed to minmax for a…
demvlad Feb 5, 2024
e00a481
resolved issue: wrong min-max for new selected curves. Definition of …
demvlad Feb 5, 2024
8e38782
removed smoothing from min-max computing algoritm
demvlad Feb 5, 2024
1174dff
Min-Max input fields are set read only as default
demvlad Feb 6, 2024
e9c2918
improve minmax compute function in flightLog
demvlad Feb 6, 2024
241e9c4
Code placement optimization
demvlad Feb 6, 2024
506e4e5
improved min max values when group curves ('all') are added
demvlad Feb 6, 2024
7f94941
code style checking
demvlad Feb 6, 2024
3021312
added: restore charts view after change when mouse click out of dialo…
demvlad Feb 6, 2024
977c05e
The enabled minmax checkbox is deleted from user interface
demvlad Feb 7, 2024
a9c53d0
removed min-max enabled condition in graph module. Allways use min-max!
demvlad Feb 7, 2024
cd4b0ac
EnabledMinMax is field deleted from curves data
demvlad Feb 7, 2024
bf2680d
deleted readonly attribute for min-max input fields
demvlad Feb 7, 2024
22778fe
set default min-max values from presets for main fields
demvlad Feb 7, 2024
831664b
added function to calculate min-max for one field during all time
demvlad Feb 7, 2024
c32491e
added menu action to set all min-max to default
demvlad Feb 7, 2024
7f9686e
added menu action to set min-max one selected curve to default
demvlad Feb 7, 2024
6280cf9
resolved issue of computing min-max values while all range values hav…
demvlad Feb 7, 2024
e531d4f
set default min-max values from presets for Debug fields
demvlad Feb 7, 2024
f879f8e
added checking min-max values by load charts configuration for compat…
demvlad Feb 8, 2024
8c296b3
Checking of min-max compatibality with prev versions BBE is replaced …
demvlad Feb 9, 2024
bf93bfe
Merge branch 'master' into min_max_chart_settings
demvlad Feb 10, 2024
4a5b65f
added gyroScaleMargin to max value for RC_SMOOTHING debug mode
demvlad Feb 11, 2024
c64acb8
resolved issue wrong min-max computing sometime
demvlad Feb 11, 2024
c06139e
added menu actions: 'Fit all curves in zero ofset at global full rang…
demvlad Feb 12, 2024
909da8a
added menu action 'Apply this curves min-max to all curves'
demvlad Feb 12, 2024
472914d
added parseFloat in menu actions to transform string to digit
demvlad Feb 12, 2024
a30a041
added menu item 'Apply this curves min-max to ...', without action till
demvlad Feb 12, 2024
f87b43e
added menu action 'Apply this curves min-max to ...', without checkbo…
demvlad Feb 12, 2024
bc1aa1e
added menu action 'Apply this curves min-max to ...'
demvlad Feb 13, 2024
0bf9823
optimized range of menu items
demvlad Feb 13, 2024
4b884da
field names submenu changed to own menu with handlers ShowFieldsWitho…
demvlad Feb 13, 2024
53e0e60
set checkbox type in fields name menu, added new items
demvlad Feb 13, 2024
c6b6555
added: set min-max from selected curve to curves group, that is selec…
demvlad Feb 13, 2024
9589b82
resolved merge conflict
demvlad Feb 13, 2024
1eecf3e
resolved code style issue
demvlad Feb 13, 2024
9ed301d
resolved issue of curves count definition
demvlad Feb 13, 2024
89abe33
removed zoom from charts config users interface, removed offset, inpu…
demvlad Feb 14, 2024
87cdec3
code style improvement
demvlad Feb 14, 2024
a9ca7ad
resolved outputRange issue, the zoom value is set to 100
demvlad Feb 14, 2024
658346c
code style improvement
demvlad Feb 14, 2024
95200f8
The menu action 'Fit this curve to one scale at:' changed to 'Fit sel…
demvlad Feb 14, 2024
b22038d
When select 'Fit curves to same scale ...', current curve is checked …
demvlad Feb 14, 2024
dc43daf
changed lists size definition
demvlad Feb 14, 2024
680ef4d
changed lists size definition
demvlad Feb 14, 2024
6a9899e
added curves zoom action to context menu
demvlad Feb 15, 2024
2133f2e
removed unusing local variable
demvlad Feb 15, 2024
c289a9e
added caption to checkboxed menu
demvlad Feb 16, 2024
4d5bd9e
The new menu items order
demvlad Feb 16, 2024
df960aa
Merge branch 'master' into min_max_chart_settings
demvlad Feb 16, 2024
e90c579
added menu.css file
demvlad Feb 22, 2024
3cf6204
added div tags for menu items
demvlad Feb 22, 2024
3021da2
added menu content and click handlers
demvlad Feb 22, 2024
a127982
added arrows special symbols into menu item
demvlad Feb 22, 2024
c314566
added: zoom is working
demvlad Feb 22, 2024
bd3f1a6
'Selected to this one' menu action is ready
demvlad Feb 23, 2024
19a3155
'Selected to one scale' menu action is ready'
demvlad Feb 23, 2024
0c93bc5
added: lock main menu when submenu is open
demvlad Feb 23, 2024
62191c6
added: 'Back' menu items
demvlad Feb 23, 2024
cec5c42
resolved missing ;
demvlad Feb 24, 2024
ce934db
Made: zoom setup from one menu, instead of two menu before
demvlad Feb 24, 2024
61459b0
zoom menu improvement
demvlad Feb 24, 2024
8bd7695
add: block outer interface while menu is opened
demvlad Feb 25, 2024
42460ba
improve: setting of true submenu positions
demvlad Feb 25, 2024
18ff8a2
resolved issue of zoom computing
demvlad Feb 25, 2024
30111d7
added: harder mouse events lock at dialog panel around the menu
demvlad Feb 27, 2024
8889948
improve setting of submenu vertical position
demvlad Feb 27, 2024
c0b695b
prevent of lock charts config dialog box after menu exit by Esc key
demvlad Feb 27, 2024
f851343
the structure of code is improved
demvlad Feb 27, 2024
c2c9625
added curves selection by centered menu action
demvlad Feb 27, 2024
bd2214e
added Shift key accelerator for group menu actions to fast all curves…
demvlad Feb 27, 2024
1c52573
Code style improvement: function declaration without var
demvlad Feb 27, 2024
937c5f2
added Save menu for next time working
demvlad Feb 27, 2024
f31b740
zoom improvements: added two control buttons: 'zoom in', 'zoom out'
demvlad Feb 27, 2024
a6e9c06
Merge branch 'master' into min_max_chart_settings
demvlad Mar 6, 2024
de30049
The curves zoom by mouse scroll is restored
demvlad Mar 7, 2024
1e9b458
the menu source codes are repalced to js/graph_minmax_setting_menu.js…
demvlad Mar 7, 2024
6d0e68d
Added warning at the status bar while actual log rate is less then re…
demvlad Mar 7, 2024
cf66de1
Apply default MinMax values for new openning logs
demvlad Mar 8, 2024
1d13861
added checkboxed submenu into Save menu to select curves for save
demvlad Mar 8, 2024
6a8219c
added Save checkbox into curves table row at GraphConfig dialog box
demvlad Mar 8, 2024
148e08c
The MinMax data are saved for next using if curves Save checkboxes is…
demvlad Mar 8, 2024
382e433
resolved issue of workspace saving logic
demvlad Mar 8, 2024
b57638a
added the left arrow symbol into submenu apply item, what close submenu
demvlad Mar 9, 2024
cd2284c
the menu1, menu2, menu3 variables changed to main_menu, sub_menu
demvlad Mar 11, 2024
1950212
changed the locking elements while menu is showed
demvlad Mar 11, 2024
f8fadfb
added Esc keydown events handler
demvlad Mar 11, 2024
0bf2e9f
improved 'Selected to this one' menu action: it is posible to edit mi…
demvlad Mar 11, 2024
d96edc5
resolved issue of duplicate Save menu
demvlad Mar 11, 2024
b162687
added font style change while mouse click to menu item
demvlad Mar 11, 2024
616d008
Changed menu captions style
demvlad Mar 11, 2024
53080be
the menu item placement optimization: all auto range menu items place…
demvlad Mar 12, 2024
baeadae
added menu 'This full range' with submenu
demvlad Mar 12, 2024
3bfbcbe
The 'All full range' menu item improvement
demvlad Mar 12, 2024
ec1366b
added captions into main menu
demvlad Mar 13, 2024
7a59057
added totalCount field into frames stat data
demvlad Mar 14, 2024
5ba594b
added method getCurrentLogRowsCount to flightLog.js
demvlad Mar 14, 2024
5786de9
improved actual log rate computing
demvlad Mar 14, 2024
933dd7b
Merge branch 'master' into log_rec_count_improvement
demvlad Mar 14, 2024
a197ba5
Merge branch 'master' into min_max_chart_settings
demvlad Mar 14, 2024
734f5a5
remove the logs maximal time limit
demvlad Mar 14, 2024
8d5efd0
Merge branch 'log_rec_count_improvement' into min_max_chart_settings
demvlad Mar 15, 2024
c4eff80
added menu item action 'centered one scale' into 'All full range'submenu
demvlad Mar 20, 2024
36e29ca
Merge branch 'master' into min_max_chart_settings
demvlad Mar 20, 2024
e02702d
menu view style improvement
demvlad Mar 25, 2024
92db21a
improve of computing min-max stat data in flightLog. The I and Prame…
demvlad Mar 26, 2024
9a4eaad
Improve computing curves min-max values in charts setup dialog box. A…
demvlad Mar 26, 2024
7f2d0ba
resolved issue of default minmax for new EZ_LANDING debug
demvlad Mar 28, 2024
da27bb8
Resolved issue of wrong GraphConfig.getMinMaxForFieldDuringAllTime f…
demvlad Mar 28, 2024
94de447
The Shift key action in the menu is reverted
demvlad Mar 29, 2024
1a75b39
The menu items order is changed
demvlad Mar 29, 2024
54e77d0
The single and group Zoom menu actions is improved
demvlad Mar 29, 2024
790c726
The single and group 'Full range' menu action are improved
demvlad Mar 29, 2024
207aa9a
added hidden span with right arrow into menu item which can have submenu
demvlad Mar 30, 2024
89c6241
added Shift key event handler to show/hide the right arrow symbol in …
demvlad Mar 30, 2024
87b7475
'Save' table caption is renamed to 'Default'
demvlad Mar 30, 2024
9b9ad57
the workspace minmax values save strategy is changed
demvlad Mar 30, 2024
541c264
'This curves action' replaced into submenu
demvlad Mar 31, 2024
c6c813f
code style improvement: added menu helpers function
demvlad Mar 31, 2024
463f53f
Zoom submenu is removed from 'This curve' submenu
demvlad Mar 31, 2024
072c489
added submenu for 'This curve'-'Full range' item while Shift key is p…
demvlad Apr 1, 2024
931de31
The 'Apply' and 'Cancel' buttons are unlocked while minmax menu is open
demvlad Apr 1, 2024
ffcb0ef
Code style improvement: added special function UnlockUsersInterfaceAf…
demvlad Apr 1, 2024
33a91d8
Is set Alt control key instead of Shift
demvlad Apr 1, 2024
4831410
added extended submenu for 'Default' action while Alt-key is pressed
demvlad Apr 1, 2024
c01dd42
resolved issue of keyboard event handlers the Esc and Alt keys
demvlad Apr 2, 2024
83177c5
The integer digits are showed in MinMax menu
demvlad Apr 2, 2024
4a11a8d
resolved issue string empty names for some DEBUG fields
demvlad Apr 2, 2024
6c44968
Code style improvement
demvlad Apr 3, 2024
12c3ed3
EZLANDING friendly debug field names are improved
demvlad Apr 3, 2024
aa2e534
Update src/flightlog.js
demvlad Apr 3, 2024
1c37733
Update src/flightlog.js
demvlad Apr 3, 2024
0967bd0
Update src/flightlog.js
demvlad Apr 3, 2024
4ad02f1
Update src/flightlog.js
demvlad Apr 3, 2024
7973075
the autocompetion is off in min-max input fields
demvlad Apr 4, 2024
42e61c4
Return or top level Back menu items are designed like button
demvlad Apr 4, 2024
618a2a4
added helper function for the menu control
demvlad Apr 4, 2024
5f6fb79
menu button style improved
demvlad Apr 4, 2024
0460438
The min-max input fields autocomplete properety is changed from 'off'…
demvlad Apr 5, 2024
25fbe92
The Cancel button at chart setup dialog box has focus after openning …
demvlad Apr 5, 2024
1b28985
Revert "The integer digits are showed in MinMax menu"
demvlad Apr 8, 2024
d8a7da0
Revert "The min-max input fields autocomplete properety is changed fr…
demvlad Apr 8, 2024
1afcea2
Revert "the autocompetion is off in min-max input fields"
demvlad Apr 8, 2024
0e64977
resolved bug: the runtime error of spectrum type user settings saving…
demvlad Apr 10, 2024
3fef620
Improvement: The changes of current workspace can store by Shift+S key
demvlad Apr 10, 2024
3b69cfc
The Shift-S key actions information is added to Help dialog box
demvlad Apr 13, 2024
fd65a83
table column caption is renamed to 'Keep' instead of 'default'
demvlad Apr 20, 2024
3e648f5
resolved issue of unworked 'As this one' extended submenu
demvlad Apr 20, 2024
752e705
The 'Keep' checkbox is checked by default for new curves
demvlad Apr 20, 2024
1c07393
Extended group full range submenu is improve
demvlad Apr 22, 2024
7fb2505
Extended one curve full range submenu is improved
demvlad Apr 22, 2024
e7af6e3
enabled multiple actions in 'Set zero offset' and 'Set same scale' ex…
demvlad Apr 23, 2024
12dcd15
the curves expo power is set to 1 as default
demvlad Apr 23, 2024
b9808b3
the Alt control key is changed to Shift, to sinchrone with VITE WEB v…
demvlad Apr 23, 2024
a21e1dc
added function in graph to get marked in-out time
demvlad Apr 23, 2024
0215372
added function to compute min-max curves values during marked time in…
demvlad Apr 23, 2024
5ab7a46
added action to extended full range submenu items to set minmax for m…
demvlad Apr 23, 2024
fb7113a
resolved issue in extended 'Set one scale' menu item action
demvlad Apr 23, 2024
9675310
resolved issue minmax compute in marked range
demvlad Apr 23, 2024
7d88b70
the grid field is removed from curves data
demvlad Apr 24, 2024
b7229eb
The main menu items actions auto close main menu
demvlad Apr 24, 2024
375211f
The 'Return' menu item is renamed to 'Close'
demvlad Apr 24, 2024
7e0296c
The 'Keep' checkbox setting is removed
demvlad Apr 24, 2024
9da4f4b
min-max input fields style improvement
demvlad Apr 24, 2024
f967d1e
resolved issue of data storage
demvlad Apr 25, 2024
844da77
The charts are update after manual changes of min-max input fields
demvlad Apr 26, 2024
c252359
The all extended submenu are multy actions
demvlad Apr 26, 2024
3c0c2c1
The unused menu functions are removed from source code
demvlad Apr 27, 2024
5df6bc8
The 'Default' menu actions set as default MinMax so the default Expo …
demvlad Apr 27, 2024
bf87d45
Use event data for single curves menu actions
demvlad Apr 27, 2024
ad772d7
The Workspaces file example is added into project
demvlad Apr 27, 2024
78ffcc8
The 'Close' main menu item active allways
demvlad Apr 27, 2024
45a2884
The short main menu has auto closed items
demvlad Apr 27, 2024
990c363
The mouse click at curves on the legend works like toggle button (mak…
demvlad May 4, 2024
d98ca60
added charts preview after any charts configuration changes
demvlad May 5, 2024
38fd5dc
Charts redrawing is optimized
demvlad May 5, 2024
0393929
PIDsumm computing condition is improved
demvlad May 6, 2024
fea9844
the menu items order is changed
demvlad May 8, 2024
189a52f
resolved issue selected curves Zoom menu actions
demvlad May 8, 2024
78568c5
code style improvement
demvlad May 8, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3,544 changes: 3,544 additions & 0 deletions Workspace/workspaces-ctzsnooze.json

Large diffs are not rendered by default.

246 changes: 123 additions & 123 deletions css/main.css

Large diffs are not rendered by default.

102 changes: 102 additions & 0 deletions css/menu.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,102 @@
:root {
--bgColor: #0fddaf;
--txtColor: #ffffff;
--borColor: rgba(0, 0, 0, 0);
--sizeVar: 8px;
--textPrimary: #4b4760;
--textSecondary: #7f7989;
--borderColor: #cccccc;
}


.flexDiv {
display: flex;
flex-direction: row;
align-items: flex-start;
width: fit-content;
}

.selectWrapper {
width: 100%;
position: relative;
padding-top: calc(var(--sizeVar) / 2);
}

.dropdown-content {
display: none;
border: 1px solid var(--borderColor);
box-sizing: border-box;
border-radius: calc(var(--sizeVar) / 2);
position: absolute;
width: auto;
left: 0;
right: 0;
overflow: visible;
background: #ffffff;
z-index: 300;
min-width: fit-content;
}
.dropdown-content div {
color: var(--textPrimary);
padding: 2px;
cursor: pointer;
white-space: nowrap;
width: auto;
}

.show { display: block;}

.dropdown-content div:hover {
background-color: #f6f6f6;
}

.dropdown-content div:active {
font-style: italic;
}

.bottomBorder {
border-bottom: 1px solid var(--borderColor);
}
.topBorder {
border-top: 1px solid var(--borderColor);
}
.iconDiv {
display: flex;
align-items: center;
justify-content: space-between;
}
.noSpace {
justify-content: flex-start;
gap: 6px;
}
.titleDiv {
pointer-events: none;
font-weight: 600;
}
.justHover i {
opacity: 0;
}
.justHover:hover i {
opacity: 1;
}
.dropdown-content .placeholder {
color: var(--textSecondary);
font-style: italic;
}
.dropdown-content .narrow {
padding-top: 10px;
padding-bottom: 10px;
}
.dropdown-content i {
color: var(--textSecondary);
}
.menu-button {
background-color: #f6f6f6;
font-weight: 700;
border: 1px solid black;
border-radius: 3px;
}
.minmax-control {
min-width: 60px;
}

7 changes: 4 additions & 3 deletions index.html
Original file line number Diff line number Diff line change
Expand Up @@ -17,12 +17,11 @@
<link rel="stylesheet" href="css/keys_dialog.css">
<link rel="stylesheet" href="css/user_settings_dialog.css">
<link rel="stylesheet" href="node_modules/leaflet/dist/leaflet.css">

<link rel="stylesheet" href="css/menu.css">
<script src="js/vendor/modernizr-2.6.2-respond-1.1.0.min.js"></script>
<script src="node_modules/leaflet/dist/leaflet.js"></script>
<script src="node_modules/leaflet-marker-rotation/src/rotatedMarker.js" type="module"></script>
<script src="node_modules/Leaflet.MultiOptionsPolyline/Leaflet.MultiOptionsPolyline.js"></script>

</head>

<body>
Expand Down Expand Up @@ -2519,9 +2518,10 @@ <h4 class="modal-title">Shortcut Keys</h4>
<div class="key">0</div>
<div class="normal">to</div>
<div class="key">9</div>
<div class="key">S</div>
</span>
<div class="description">Save the current displayed graph configuration to workspace/favourite key 0 through
9 (this includes all graph smoothing and expo etc.).</div>
9 (this includes all graph smoothing, expo and min/max values etc.). The Shift-S save the configuration to current workspace.</div>
</li>
<li>
<span class="keys">
Expand Down Expand Up @@ -3236,6 +3236,7 @@ <h4 class="modal-title">Advanced User Settings</h4>
<script src="js/graph_config.js"></script>
<script src="js/graph_legend.js"></script>
<script src="js/workspace_selection.js"></script>
<script src="js/graph_minmax_setting_menu.js"></script>
<script src="js/graph_config_dialog.js"></script>
<script src="js/graph_spectrum_plot.js"></script>
<script src="js/graph_spectrum_calc.js"></script>
Expand Down
131 changes: 118 additions & 13 deletions js/flightlog.js
Original file line number Diff line number Diff line change
Expand Up @@ -80,16 +80,21 @@ function FlightLog(logData) {
* that the flightlog presents as one merged frame.
*/
this.getStats = function(logIndex) {
var
rawStats = getRawStats(logIndex);
let rawStats = getRawStats(logIndex);

if (rawStats.field === undefined) {
rawStats.field = [];
for (let i = 0; i < rawStats.frame.I.field.length; ++i) {
rawStats.field[i] = {
min: Math.min(rawStats.frame.I.field[i].min, rawStats.frame.P.field[i].min),
max: Math.max(rawStats.frame.I.field[i].max, rawStats.frame.P.field[i].max)
};
}

// Just modify the raw stats variable to add this field, the parser won't mind the extra field appearing:
if (rawStats.frame.S) {
rawStats.field = rawStats.frame.I.field.concat(rawStats.frame.S.field);
} else {
rawStats.field = rawStats.frame.I.field;
if (rawStats.frame.S) {
rawStats.field = rawStats.field.concat(rawStats.frame.S.field);
}
}

return rawStats;
};

Expand Down Expand Up @@ -239,7 +244,7 @@ function FlightLog(logData) {
if (!that.isFieldDisabled().SETPOINT) {
fieldNames.push("rcCommands[0]", "rcCommands[1]", "rcCommands[2]", "rcCommands[3]"); // Custom calculated scaled rccommand
}
if (!that.isFieldDisabled().GYRO && !that.isFieldDisabled().PID) {
if (!that.isFieldDisabled().GYRO && !that.isFieldDisabled().SETPOINT) {
fieldNames.push("axisError[0]", "axisError[1]", "axisError[2]"); // Custom calculated error field
}

Expand Down Expand Up @@ -632,7 +637,7 @@ function FlightLog(logData) {
}

// Add the Feedforward PID sum (P+I+D+F)
if (!that.isFieldDisabled().GYRO && !that.isFieldDisabled().PID) {
if (!that.isFieldDisabled().PID) {
for (var axis = 0; axis < 3; axis++) {
let pidSum =
(axisPID[axis][0] !== undefined ? srcFrame[axisPID[axis][0]] : 0) +
Expand Down Expand Up @@ -681,7 +686,7 @@ function FlightLog(logData) {
}

// Calculate the PID Error
if (!that.isFieldDisabled().GYRO && !that.isFieldDisabled().PID) {
if (!that.isFieldDisabled().GYRO && !that.isFieldDisabled().SETPOINT) {
for (var axis = 0; axis < 3; axis++) {
let gyroADCdegrees = (gyroADC[axis] !== undefined ? that.gyroRawToDegreesPerSecond(srcFrame[gyroADC[axis]]) : 0);
destFrame[fieldIndex++] = destFrame[fieldIndexRcCommands + axis] - gyroADCdegrees;
Expand Down Expand Up @@ -1044,6 +1049,85 @@ function FlightLog(logData) {
this.hasGpsData = function() {
return this.getStats()?.frame?.G ? true : false;;
};

this.getMinMaxForFieldDuringAllTime = function(field_name) {
let
stats = this.getStats(),
min = Number.MAX_VALUE,
max = -Number.MAX_VALUE;

let
fieldIndex = this.getMainFieldIndexByName(field_name),
fieldStat = fieldIndex !== undefined ? stats.field[fieldIndex] : false;

if (fieldStat) {
min = Math.min(min, fieldStat.min);
max = Math.max(max, fieldStat.max);
} else {
const mm = this.getMinMaxForFieldDuringTimeInterval(field_name, this.getMinTime(), this.getMaxTime());
if (mm !== undefined) {
min = Math.min(mm.min, min);
max = Math.max(mm.max, max);
}
}

return {min:min, max:max};
}

/**
* Function to compute of min and max curve values during time interval.
* @param field_name String: Curve fields name.
* @param start_time Integer: The interval start time .
* @end_time start_time Integer: The interval end time .
* @returns {min: MinValue, max: MaxValue} if success, or {min: Number.MAX_VALUE, max: Number.MAX_VALUE} if error
*/
this.getMinMaxForFieldDuringTimeInterval = function(field_name, start_time, end_time) {
let chunks = this.getSmoothedChunksInTimeRange(start_time, end_time);
let startFrameIndex;
let minValue = Number.MAX_VALUE,
maxValue = -Number.MAX_VALUE;

const fieldIndex = this.getMainFieldIndexByName(field_name);
if (chunks.length == 0 || fieldIndex == undefined)
return undefined;

//Find the first sample that lies inside the window
for (startFrameIndex = 0; startFrameIndex < chunks[0].frames.length; startFrameIndex++) {
if (chunks[0].frames[startFrameIndex][FlightLogParser.prototype.FLIGHT_LOG_FIELD_INDEX_TIME] >= start_time) {
break;
}
}

// Pick the sample before that to begin plotting from
if (startFrameIndex > 0)
startFrameIndex--;

let frameIndex = startFrameIndex;
findingLoop:
for (let chunkIndex = 0; chunkIndex < chunks.length; chunkIndex++) {
const chunk = chunks[chunkIndex];
for (; frameIndex < chunk.frames.length; frameIndex++) {
const fieldValue = chunk.frames[frameIndex][fieldIndex];
const frameTime = chunk.frames[frameIndex][FlightLogParser.prototype.FLIGHT_LOG_FIELD_INDEX_TIME];
minValue = Math.min(minValue, fieldValue);
maxValue = Math.max(maxValue, fieldValue);
if(frameTime>end_time)
break findingLoop;
}
frameIndex = 0;
}
return {
min: minValue,
max: maxValue
};
};

this.getCurrentLogRowsCount = function () {
const stats = this.getStats(this.getLogIndex());
const countI = stats.frame['I'] ? stats.frame['I'].totalCount : 0;
const countP = stats.frame['P'] ? stats.frame['P'].totalCount : 0;
return countI + countP;
};
}

FlightLog.prototype.accRawToGs = function(value) {
Expand All @@ -1054,8 +1138,6 @@ FlightLog.prototype.gyroRawToDegreesPerSecond = function(value) {
return this.getSysConfig().gyroScale * 1000000 / (Math.PI / 180.0) * value;
};



/***

The rcCommandToDegreesPerSecond function is betaflight version specific
Expand Down Expand Up @@ -1182,6 +1264,12 @@ FlightLog.prototype.rcCommandRawToThrottle = function(value) {
return Math.min(Math.max(((value - this.getSysConfig().minthrottle) / (this.getSysConfig().maxthrottle - this.getSysConfig().minthrottle)) * 100.0, 0.0),100.0);
};

// rcCommandThrottle back transform function
FlightLog.prototype.ThrottleTorcCommandRaw = function(value) {
// Throttle displayed as percentage
return value / 100 * (this.getSysConfig().maxthrottle - this.getSysConfig().minthrottle) + this.getSysConfig().minthrottle;
};

FlightLog.prototype.rcMotorRawToPctPhysical = function(value) {

// Motor displayed as percentage
Expand All @@ -1196,6 +1284,21 @@ FlightLog.prototype.rcMotorRawToPctPhysical = function(value) {
}
return Math.min(Math.max(motorPct, 0.0), 100.0);

};
// rcMotorRaw back transform function
FlightLog.prototype.PctPhysicalTorcMotorRaw = function(value) {
// Motor displayed as percentage
let motorRaw;
if (this.isDigitalProtocol()) {
motorRaw = value / 100 * DSHOT_RANGE + DSHOT_MIN_VALUE;
} else {
const MAX_ANALOG_VALUE = this.getSysConfig().maxthrottle;
const MIN_ANALOG_VALUE = this.getSysConfig().minthrottle;
const ANALOG_RANGE = MAX_ANALOG_VALUE - MIN_ANALOG_VALUE;
motorRaw = value / 100 * ANALOG_RANGE + MIN_ANALOG_VALUE;
}
return motorRaw;

};

FlightLog.prototype.isDigitalProtocol = function() {
Expand Down Expand Up @@ -1341,4 +1444,6 @@ FlightLog.prototype.isFieldDisabled = function() {
RPM : (disabledFields & (1 << 12))!==0,
GYROUNFILT : (disabledFields & (1 << 13))!==0,
};


};
Loading