mirror of
https://github.com/betaflight/betaflight.git
synced 2025-07-24 16:55:36 +03:00
Use ARRAYLEN macro where applicable
This commit is contained in:
parent
8462dd1bea
commit
90e792e243
9 changed files with 19 additions and 13 deletions
|
@ -23,6 +23,7 @@ extern "C" {
|
|||
#include "common/axis.h"
|
||||
#include "common/sensor_alignment.h"
|
||||
#include "common/sensor_alignment_impl.h"
|
||||
#include "common/utils.h"
|
||||
#include "drivers/sensor.h"
|
||||
#include "sensors/boardalignment.h"
|
||||
#include "sensors/sensors.h"
|
||||
|
@ -289,7 +290,7 @@ static void testBuildAlignmentWithStandardAlignment(sensor_align_e alignment, se
|
|||
|
||||
buildAlignmentFromStandardAlignment(&sensorAlignment, alignment);
|
||||
|
||||
for (int i = 0; i < (int)(sizeof(sensorAlignment.raw) / sizeof(sensorAlignment.raw[0])); i++) {
|
||||
for (unsigned i = 0; i < ARRAYLEN(sensorAlignment.raw); i++) {
|
||||
EXPECT_EQ(expectedSensorAlignment.raw[i], sensorAlignment.raw[i]) << "Sensor alignment was not updated. alignment: " << alignment;
|
||||
}
|
||||
}
|
||||
|
@ -314,7 +315,7 @@ TEST(AlignSensorTest, AttemptBuildAlignmentFromCustomAlignment)
|
|||
|
||||
sensorAlignment_t expectedSensorAlignment = SENSOR_ALIGNMENT(1, 2, 3);
|
||||
|
||||
for (int i = 0; i < (int)(sizeof(sensorAlignment.raw) / sizeof(sensorAlignment.raw[0])); i++) {
|
||||
for (unsigned i = 0; i < ARRAYLEN(sensorAlignment.raw); i++) {
|
||||
EXPECT_EQ(expectedSensorAlignment.raw[i], sensorAlignment.raw[i]) << "Custom alignment should not be updated.";
|
||||
}
|
||||
}
|
||||
|
@ -327,7 +328,7 @@ TEST(AlignSensorTest, AttemptBuildAlignmentFromDefaultAlignment)
|
|||
|
||||
sensorAlignment_t expectedSensorAlignment = SENSOR_ALIGNMENT(1, 2, 3);
|
||||
|
||||
for (int i = 0; i < (int)(sizeof(sensorAlignment.raw) / sizeof(sensorAlignment.raw[0])); i++) {
|
||||
for (unsigned i = 0; i < ARRAYLEN(sensorAlignment.raw); i++) {
|
||||
EXPECT_EQ(expectedSensorAlignment.raw[i], sensorAlignment.raw[i]) << "Default alignment should not be updated.";
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue