Skip to content

Commit

Permalink
increase clang column limit
Browse files Browse the repository at this point in the history
  • Loading branch information
timhendriks93 committed Jul 27, 2024
1 parent 331f3a1 commit e786e8b
Show file tree
Hide file tree
Showing 14 changed files with 39 additions and 74 deletions.
2 changes: 1 addition & 1 deletion .clang-format
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ BreakConstructorInitializersBeforeComma: false
BreakConstructorInitializers: BeforeColon
BreakAfterJavaFieldAnnotations: false
BreakStringLiterals: true
ColumnLimit: 80
ColumnLimit: 100
CommentPragmas: '^ IWYU pragma:'
CompactNamespaces: false
ConstructorInitializerAllOnOneLineOrOnePerLine: false
Expand Down
6 changes: 2 additions & 4 deletions examples/MultipleScenes/MultipleScenes.ino
Original file line number Diff line number Diff line change
Expand Up @@ -36,10 +36,8 @@ void setup() {
animation.onPositionChange(move);

// Add multiple scenes based on PROGMEM data
animation.addScene(SceneA::ANIMATION_DATA, SceneA::LENGTH, SceneA::FPS,
SceneA::FRAMES);
animation.addScene(SceneB::ANIMATION_DATA, SceneB::LENGTH, SceneB::FPS,
SceneB::FRAMES);
animation.addScene(SceneA::ANIMATION_DATA, SceneA::LENGTH, SceneA::FPS, SceneA::FRAMES);
animation.addScene(SceneB::ANIMATION_DATA, SceneB::LENGTH, SceneB::FPS, SceneB::FRAMES);

// Trigger the animation loop mode
animation.loop();
Expand Down
4 changes: 2 additions & 2 deletions examples/WebSocketLiveMode/WebSocketLiveMode.ino
Original file line number Diff line number Diff line change
Expand Up @@ -36,8 +36,8 @@ void move(byte servoID, int position) {
BlenderServoAnimation animation;

// Callback function writing live stream data to the animation
void onWebSocketEvent(AsyncWebSocket *server, AsyncWebSocketClient *client,
AwsEventType type, void *arg, uint8_t *data, size_t len) {
void onWebSocketEvent(AsyncWebSocket *server, AsyncWebSocketClient *client, AwsEventType type,
void *arg, uint8_t *data, size_t len) {
if (type != WS_EVT_DATA) {
return;
}
Expand Down
6 changes: 2 additions & 4 deletions src/BlenderServoAnimation.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,7 @@ bool BlenderServoAnimation::hasScenes() {
return this->addIndex > 0;
}

void BlenderServoAnimation::addScene(const byte *data, int size, byte fps,
int frames) {
void BlenderServoAnimation::addScene(const byte *data, int size, byte fps, int frames) {
AnimationData *animationData = new AnimationData(data, size);
Scene *scene = new Scene(&this->servoManager, animationData, fps, frames);
this->registerScene(scene);
Expand Down Expand Up @@ -174,8 +173,7 @@ void BlenderServoAnimation::loop() {
}

void BlenderServoAnimation::pause() {
if (!this->scene ||
this->modeIsIn(4, MODE_DEFAULT, MODE_PAUSE, MODE_STOP, MODE_LIVE)) {
if (!this->scene || this->modeIsIn(4, MODE_DEFAULT, MODE_PAUSE, MODE_STOP, MODE_LIVE)) {
return;
}

Expand Down
3 changes: 1 addition & 2 deletions src/Command.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,7 @@ byte Command::getServoID() {
}

int Command::getServoPosition() {
return this->values[INDEX_POSITION_BYTE] |
this->values[INDEX_POSITION_SIG_BYTE] << BITS;
return this->values[INDEX_POSITION_BYTE] | this->values[INDEX_POSITION_SIG_BYTE] << BITS;
}

void Command::reset() {
Expand Down
6 changes: 2 additions & 4 deletions src/Scene.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,7 @@

using BlenderServoAnimationLibrary::Scene;

Scene::Scene(ServoManager *servoManager, AnimationData *data, byte fps,
int frames) {
Scene::Scene(ServoManager *servoManager, AnimationData *data, byte fps, int frames) {
this->servoManager = servoManager;
this->data = data;
this->fps = fps;
Expand Down Expand Up @@ -68,8 +67,7 @@ unsigned int Scene::getMicrosDiff(unsigned long currentMicros) {
}

bool Scene::isNewFrame(unsigned long currentMicros) {
return this->lastMicros == 0 ||
this->getMicrosDiff(currentMicros) >= this->frameMicros;
return this->lastMicros == 0 || this->getMicrosDiff(currentMicros) >= this->frameMicros;
}

bool Scene::hasFinished() {
Expand Down
3 changes: 1 addition & 2 deletions src/Servo.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,7 @@ void Servo::move(int position, bool useOffset) {
position += this->offset;
}

if (position == this->currentPosition ||
this->positionExceedsThreshold(position)) {
if (position == this->currentPosition || this->positionExceedsThreshold(position)) {
return;
}

Expand Down
12 changes: 4 additions & 8 deletions test/animation/test_live/test_live.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -26,18 +26,14 @@ void test_prevented(void) {
TEST_ASSERT_EQUAL(BlenderServoAnimation::MODE_PLAY, animation.getMode());
animation.pause();
animation.playSingle(0);
TEST_ASSERT_EQUAL(BlenderServoAnimation::MODE_PLAY_SINGLE,
animation.getMode());
TEST_ASSERT_EQUAL(BlenderServoAnimation::MODE_PLAY_SINGLE, animation.getMode());
animation.live(mock);
TEST_ASSERT_EQUAL(BlenderServoAnimation::MODE_PLAY_SINGLE,
animation.getMode());
TEST_ASSERT_EQUAL(BlenderServoAnimation::MODE_PLAY_SINGLE, animation.getMode());
animation.pause();
animation.playRandom();
TEST_ASSERT_EQUAL(BlenderServoAnimation::MODE_PLAY_RANDOM,
animation.getMode());
TEST_ASSERT_EQUAL(BlenderServoAnimation::MODE_PLAY_RANDOM, animation.getMode());
animation.live(mock);
TEST_ASSERT_EQUAL(BlenderServoAnimation::MODE_PLAY_RANDOM,
animation.getMode());
TEST_ASSERT_EQUAL(BlenderServoAnimation::MODE_PLAY_RANDOM, animation.getMode());
animation.pause();
TEST_ASSERT_EQUAL(BlenderServoAnimation::MODE_PAUSE, animation.getMode());
animation.live(mock);
Expand Down
12 changes: 4 additions & 8 deletions test/animation/test_loop/test_loop.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -60,18 +60,14 @@ void test_prevented(void) {
TEST_ASSERT_EQUAL(BlenderServoAnimation::MODE_PLAY, animation.getMode());
animation.pause();
animation.playSingle(0);
TEST_ASSERT_EQUAL(BlenderServoAnimation::MODE_PLAY_SINGLE,
animation.getMode());
TEST_ASSERT_EQUAL(BlenderServoAnimation::MODE_PLAY_SINGLE, animation.getMode());
animation.loop();
TEST_ASSERT_EQUAL(BlenderServoAnimation::MODE_PLAY_SINGLE,
animation.getMode());
TEST_ASSERT_EQUAL(BlenderServoAnimation::MODE_PLAY_SINGLE, animation.getMode());
animation.pause();
animation.playRandom();
TEST_ASSERT_EQUAL(BlenderServoAnimation::MODE_PLAY_RANDOM,
animation.getMode());
TEST_ASSERT_EQUAL(BlenderServoAnimation::MODE_PLAY_RANDOM, animation.getMode());
animation.loop();
TEST_ASSERT_EQUAL(BlenderServoAnimation::MODE_PLAY_RANDOM,
animation.getMode());
TEST_ASSERT_EQUAL(BlenderServoAnimation::MODE_PLAY_RANDOM, animation.getMode());
animation.stop();
TEST_ASSERT_EQUAL(BlenderServoAnimation::MODE_STOP, animation.getMode());
animation.loop();
Expand Down
12 changes: 4 additions & 8 deletions test/animation/test_play/test_play.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -57,18 +57,14 @@ void test_prevented(void) {
TEST_ASSERT_EQUAL(BlenderServoAnimation::MODE_LOOP, animation.getMode());
animation.pause();
animation.playSingle(0);
TEST_ASSERT_EQUAL(BlenderServoAnimation::MODE_PLAY_SINGLE,
animation.getMode());
TEST_ASSERT_EQUAL(BlenderServoAnimation::MODE_PLAY_SINGLE, animation.getMode());
animation.play();
TEST_ASSERT_EQUAL(BlenderServoAnimation::MODE_PLAY_SINGLE,
animation.getMode());
TEST_ASSERT_EQUAL(BlenderServoAnimation::MODE_PLAY_SINGLE, animation.getMode());
animation.pause();
animation.playRandom();
TEST_ASSERT_EQUAL(BlenderServoAnimation::MODE_PLAY_RANDOM,
animation.getMode());
TEST_ASSERT_EQUAL(BlenderServoAnimation::MODE_PLAY_RANDOM, animation.getMode());
animation.play();
TEST_ASSERT_EQUAL(BlenderServoAnimation::MODE_PLAY_RANDOM,
animation.getMode());
TEST_ASSERT_EQUAL(BlenderServoAnimation::MODE_PLAY_RANDOM, animation.getMode());
animation.stop();
TEST_ASSERT_EQUAL(BlenderServoAnimation::MODE_STOP, animation.getMode());
animation.play();
Expand Down
21 changes: 7 additions & 14 deletions test/animation/test_play_random/test_play_random.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,7 @@ void test_play_random(void) {

animation.playRandom();

TEST_ASSERT_EQUAL(BlenderServoAnimation::MODE_PLAY_RANDOM,
animation.getMode());
TEST_ASSERT_EQUAL(BlenderServoAnimation::MODE_PLAY_RANDOM, animation.getMode());
TEST_ASSERT_NOT_EQUAL(nullptr, animation.getCurrentScene());
TEST_ASSERT_EQUAL(1, animation.getPlayIndex());
TEST_ASSERT_FALSE(animation.scenePlayed(0));
Expand All @@ -37,8 +36,7 @@ void test_play_random(void) {
animation.run(i);
}

TEST_ASSERT_EQUAL(BlenderServoAnimation::MODE_PLAY_RANDOM,
animation.getMode());
TEST_ASSERT_EQUAL(BlenderServoAnimation::MODE_PLAY_RANDOM, animation.getMode());
TEST_ASSERT_EQUAL(0, animation.getPlayIndex());
TEST_ASSERT_TRUE(animation.scenePlayed(0));
TEST_ASSERT_TRUE(animation.scenePlayed(1));
Expand All @@ -48,8 +46,7 @@ void test_play_random(void) {
animation.run(i);
}

TEST_ASSERT_EQUAL(BlenderServoAnimation::MODE_PLAY_RANDOM,
animation.getMode());
TEST_ASSERT_EQUAL(BlenderServoAnimation::MODE_PLAY_RANDOM, animation.getMode());
TEST_ASSERT_EQUAL(2, animation.getPlayIndex());
TEST_ASSERT_EQUAL(20, logIndex);
TEST_ASSERT_FALSE(animation.scenePlayed(0));
Expand Down Expand Up @@ -81,11 +78,9 @@ void test_prevented(void) {
TEST_ASSERT_EQUAL(BlenderServoAnimation::MODE_PLAY, animation.getMode());
animation.pause();
animation.playSingle(0);
TEST_ASSERT_EQUAL(BlenderServoAnimation::MODE_PLAY_SINGLE,
animation.getMode());
TEST_ASSERT_EQUAL(BlenderServoAnimation::MODE_PLAY_SINGLE, animation.getMode());
animation.playRandom();
TEST_ASSERT_EQUAL(BlenderServoAnimation::MODE_PLAY_SINGLE,
animation.getMode());
TEST_ASSERT_EQUAL(BlenderServoAnimation::MODE_PLAY_SINGLE, animation.getMode());
animation.stop();
TEST_ASSERT_EQUAL(BlenderServoAnimation::MODE_STOP, animation.getMode());
animation.playRandom();
Expand All @@ -104,13 +99,11 @@ void test_allowed(void) {

TEST_ASSERT_EQUAL(BlenderServoAnimation::MODE_DEFAULT, animation.getMode());
animation.playRandom();
TEST_ASSERT_EQUAL(BlenderServoAnimation::MODE_PLAY_RANDOM,
animation.getMode());
TEST_ASSERT_EQUAL(BlenderServoAnimation::MODE_PLAY_RANDOM, animation.getMode());
animation.pause();
TEST_ASSERT_EQUAL(BlenderServoAnimation::MODE_PAUSE, animation.getMode());
animation.playRandom();
TEST_ASSERT_EQUAL(BlenderServoAnimation::MODE_PLAY_RANDOM,
animation.getMode());
TEST_ASSERT_EQUAL(BlenderServoAnimation::MODE_PLAY_RANDOM, animation.getMode());
}

int main(int argc, char **argv) {
Expand Down
15 changes: 5 additions & 10 deletions test/animation/test_play_single/test_play_single.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,7 @@ void test_play_single(void) {

animation.playSingle(2);

TEST_ASSERT_EQUAL(BlenderServoAnimation::MODE_PLAY_SINGLE,
animation.getMode());
TEST_ASSERT_EQUAL(BlenderServoAnimation::MODE_PLAY_SINGLE, animation.getMode());
TEST_ASSERT_EQUAL(2, animation.getPlayIndex());

for (long i = 0; i < ANIMATION_MICROS; i += FRAME_MICROS) {
Expand Down Expand Up @@ -58,11 +57,9 @@ void test_prevented(void) {
TEST_ASSERT_EQUAL(BlenderServoAnimation::MODE_PLAY, animation.getMode());
animation.pause();
animation.playRandom();
TEST_ASSERT_EQUAL(BlenderServoAnimation::MODE_PLAY_RANDOM,
animation.getMode());
TEST_ASSERT_EQUAL(BlenderServoAnimation::MODE_PLAY_RANDOM, animation.getMode());
animation.playSingle(0);
TEST_ASSERT_EQUAL(BlenderServoAnimation::MODE_PLAY_RANDOM,
animation.getMode());
TEST_ASSERT_EQUAL(BlenderServoAnimation::MODE_PLAY_RANDOM, animation.getMode());
animation.stop();
TEST_ASSERT_EQUAL(BlenderServoAnimation::MODE_STOP, animation.getMode());
animation.playSingle(0);
Expand All @@ -81,13 +78,11 @@ void test_allowed(void) {

TEST_ASSERT_EQUAL(BlenderServoAnimation::MODE_DEFAULT, animation.getMode());
animation.playSingle(0);
TEST_ASSERT_EQUAL(BlenderServoAnimation::MODE_PLAY_SINGLE,
animation.getMode());
TEST_ASSERT_EQUAL(BlenderServoAnimation::MODE_PLAY_SINGLE, animation.getMode());
animation.pause();
TEST_ASSERT_EQUAL(BlenderServoAnimation::MODE_PAUSE, animation.getMode());
animation.playSingle(0);
TEST_ASSERT_EQUAL(BlenderServoAnimation::MODE_PLAY_SINGLE,
animation.getMode());
TEST_ASSERT_EQUAL(BlenderServoAnimation::MODE_PLAY_SINGLE, animation.getMode());
}

void test_prevent_sudden_index_change(void) {
Expand Down
6 changes: 2 additions & 4 deletions test/animation/test_stop/test_stop.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -101,14 +101,12 @@ void test_allowed(void) {
TEST_ASSERT_EQUAL(BlenderServoAnimation::MODE_STOP, animation.getMode());
animation.run(10000);
animation.playSingle(0);
TEST_ASSERT_EQUAL(BlenderServoAnimation::MODE_PLAY_SINGLE,
animation.getMode());
TEST_ASSERT_EQUAL(BlenderServoAnimation::MODE_PLAY_SINGLE, animation.getMode());
animation.stop();
TEST_ASSERT_EQUAL(BlenderServoAnimation::MODE_STOP, animation.getMode());
animation.run(10000);
animation.playRandom();
TEST_ASSERT_EQUAL(BlenderServoAnimation::MODE_PLAY_RANDOM,
animation.getMode());
TEST_ASSERT_EQUAL(BlenderServoAnimation::MODE_PLAY_RANDOM, animation.getMode());
animation.stop();
TEST_ASSERT_EQUAL(BlenderServoAnimation::MODE_STOP, animation.getMode());
animation.run(10000);
Expand Down
5 changes: 2 additions & 3 deletions test/test_scene/test_scene.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -42,9 +42,8 @@ void test_stop(void) {
Scene scene(&servoManager, data, FPS, FRAMES);

positionLog exp[15] = {
{0, 375}, {1, 375}, {0, 376}, {1, 376}, {0, 377},
{1, 379}, {0, 380}, {1, 383}, {0, 378}, {1, 381},
{0, 376}, {1, 379}, {0, 375}, {1, 377}, {1, 375},
{0, 375}, {1, 375}, {0, 376}, {1, 376}, {0, 377}, {1, 379}, {0, 380}, {1, 383},
{0, 378}, {1, 381}, {0, 376}, {1, 379}, {0, 375}, {1, 377}, {1, 375},
};

for (int i = 0; i < FRAME_MICROS * 4; i += FRAME_MICROS) {
Expand Down

0 comments on commit e786e8b

Please sign in to comment.