Skip to content
Open
Show file tree
Hide file tree
Changes from 1 commit
Commits
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
Prev Previous commit
Next Next commit
style(mixer): address SonarQube minor issues
Use for-of loops and Array.at(-1) as suggested by static analysis.
  • Loading branch information
sensei-hacker committed Jun 8, 2026
commit 8e03a7aa3c629d6b0cb328444b957046b2dc4510
14 changes: 7 additions & 7 deletions js/outputMapping.js
Original file line number Diff line number Diff line change
Expand Up @@ -116,9 +116,9 @@ var OutputMappingCollection = function () {

function isTimerDefault(timerId, flag) {
let found = false;
for (let i = 0; i < data.length; i++) {
if (data[i]['timerId'] !== timerId) continue;
let flags = data[i]['usageFlags'];
for (const entry of data) {
if (entry['timerId'] !== timerId) continue;
const flags = entry['usageFlags'];
if (BitHelper.bit_check(flags, TIM_USE_MOTOR) || BitHelper.bit_check(flags, TIM_USE_SERVO)) return false;
if (BitHelper.bit_check(flags, flag)) found = true;
}
Expand All @@ -129,11 +129,11 @@ var OutputMappingCollection = function () {
self.isTimerDefaultLed = function(timerId) {
// LED can also be identified by specialLabels, so check both.
let hasLed = false;
for (let i = 0; i < data.length; i++) {
if (data[i]['timerId'] !== timerId) continue;
let flags = data[i]['usageFlags'];
for (const entry of data) {
if (entry['timerId'] !== timerId) continue;
const flags = entry['usageFlags'];
if (BitHelper.bit_check(flags, TIM_USE_MOTOR) || BitHelper.bit_check(flags, TIM_USE_SERVO)) return false;
if (BitHelper.bit_check(flags, TIM_USE_LED) || data[i]['specialLabels'] === SPECIAL_LABEL_LED) hasLed = true;
if (BitHelper.bit_check(flags, TIM_USE_LED) || entry['specialLabels'] === SPECIAL_LABEL_LED) hasLed = true;
}
return hasLed;
}
Expand Down
4 changes: 2 additions & 2 deletions tabs/mixer.js
Original file line number Diff line number Diff line change
Expand Up @@ -95,8 +95,8 @@ mixerTab.initialize = function (callback, scrollPosition) {
for (let i = 0; i < outputCount; i++) {
let timerId = FC.OUTPUT_MAPPING.getTimerId(i);
let color = FC.OUTPUT_MAPPING.getOutputTimerColor(i);
if (groups.length > 0 && groups[groups.length - 1].timerId === timerId) {
groups[groups.length - 1].count++;
if (groups.length > 0 && groups.at(-1).timerId === timerId) {
groups.at(-1).count++;
} else {
groups.push({ timerId, count: 1, color });
}
Expand Down