mirror of
https://github.com/betaflight/betaflight-configurator.git
synced 2025-07-18 22:05:13 +03:00
Fix array overflow in receiver when no active channels
This commit is contained in:
parent
1547294c0e
commit
90dc937e74
1 changed files with 18 additions and 13 deletions
|
@ -464,22 +464,27 @@ TABS.receiver.initialize = function (callback) {
|
||||||
}
|
}
|
||||||
|
|
||||||
function update_ui() {
|
function update_ui() {
|
||||||
// update bars with latest data
|
|
||||||
for (var i = 0; i < RC.active_channels; i++) {
|
|
||||||
meter_fill_array[i].css('width', ((RC.channels[i] - meter_scale.min) / (meter_scale.max - meter_scale.min) * 100).clamp(0, 100) + '%');
|
|
||||||
meter_label_array[i].text(RC.channels[i]);
|
|
||||||
}
|
|
||||||
|
|
||||||
// push latest data to the main array
|
if (RC.active_channels > 0) {
|
||||||
for (var i = 0; i < RC.active_channels; i++) {
|
|
||||||
RX_plot_data[i].push([samples, RC.channels[i]]);
|
|
||||||
}
|
|
||||||
|
|
||||||
// Remove old data from array
|
// update bars with latest data
|
||||||
while (RX_plot_data[0].length > 300) {
|
for (var i = 0; i < RC.active_channels; i++) {
|
||||||
for (var i = 0; i < RX_plot_data.length; i++) {
|
meter_fill_array[i].css('width', ((RC.channels[i] - meter_scale.min) / (meter_scale.max - meter_scale.min) * 100).clamp(0, 100) + '%');
|
||||||
RX_plot_data[i].shift();
|
meter_label_array[i].text(RC.channels[i]);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// push latest data to the main array
|
||||||
|
for (var i = 0; i < RC.active_channels; i++) {
|
||||||
|
RX_plot_data[i].push([samples, RC.channels[i]]);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Remove old data from array
|
||||||
|
while (RX_plot_data[0].length > 300) {
|
||||||
|
for (var i = 0; i < RX_plot_data.length; i++) {
|
||||||
|
RX_plot_data[i].shift();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// update required parts of the plot
|
// update required parts of the plot
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue