Skip to content

Commit 8653b1f

Browse files
chizarchmelevskij
authored andcommitted
set latest vtx_power to prevent out of boundary error (betaflight#3815)
fixing issue betaflight#3814
1 parent 9da8aec commit 8653b1f

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

src/js/tabs/vtx.js

+5
Original file line numberDiff line numberDiff line change
@@ -229,6 +229,11 @@ vtx.initialize = function (callback) {
229229
TABS.vtx.VTXTABLE_POWERLEVEL_LIST[i - 1].vtxtable_powerlevel_label = vtxConfig.vtx_table.powerlevels_list[i - 1].label;
230230
}
231231

232+
// Setting the latest vtx power to prevent out of bounds error
233+
if (FC.VTX_CONFIG.vtx_power > TABS.vtx.VTXTABLE_POWERLEVEL_LIST.length) {
234+
FC.VTX_CONFIG.vtx_power = TABS.vtx.VTXTABLE_POWERLEVEL_LIST.length;
235+
}
236+
232237
vtxcallback_after_read();
233238
}
234239

0 commit comments

Comments
 (0)