Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

update libraries and clang-format #4

Closed
wants to merge 4 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
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
3 changes: 2 additions & 1 deletion .clang-format
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,10 @@ NamespaceIndentation: All
AlignAfterOpenBracket: AlwaysBreak
AlignConsecutiveBitFields: Consecutive
AlignConsecutiveMacros: AcrossEmptyLines
AlignTrailingComments: true
AllowShortCaseLabelsOnASingleLine: true
AllowShortIfStatementsOnASingleLine: AllIfsAndElse
AlignTrailingComments:
OverEmptyLines: 1

# spacing
BitFieldColonSpacing: Both
Expand Down
7 changes: 4 additions & 3 deletions .github/workflows/clang-format.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,10 @@ jobs:
name: Formatting Check
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Checkout repo
uses: actions/checkout@v3
- name: Run clang-format style check for C/C++/Protobuf programs.
uses: jidicula/clang-format-action@v4.6.2
uses: jidicula/clang-format-action@v4.11.0
with:
clang-format-version: '13'
clang-format-version: '16'
check-path: 'src'
2 changes: 1 addition & 1 deletion lib/libraries/saab_can
2 changes: 1 addition & 1 deletion platformio.ini
Original file line number Diff line number Diff line change
Expand Up @@ -13,4 +13,4 @@ platform = atmelavr
board = uno
framework = arduino
monitor_speed = 115200
lib_deps = waspinator/AccelStepper@^1.61
lib_deps = waspinator/AccelStepper@1.64
2 changes: 1 addition & 1 deletion src/drivers/stepper_x27_driver.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ namespace stepper_x27_driver {

stepper_x27_go_home();
stepper_handle->disableOutputs();
operator delete(stepper_handle);
delete stepper_handle;
stepper_handle = nullptr;

return true;
Expand Down
22 changes: 11 additions & 11 deletions src/drivers/stepper_x27_driver.h
Original file line number Diff line number Diff line change
Expand Up @@ -10,17 +10,17 @@ namespace stepper_x27_driver {
typedef struct {
AccelStepper::MotorInterfaceType mode; // Stepper wire mode

uint8_t pin1; // Pin 1
uint8_t pin2; // Pin 2
uint8_t pin3; // Pin 3
uint8_t pin4; // Pin 4

uint32_t start_offset; // Stepper start offset
uint32_t full_range; // Stepper full range (angle)
uint32_t short_range; // Stepper main range (angle) (0 for full range)
uint32_t steps; // Stepper total steps
uint32_t speed; // Stepper max speed
uint32_t acceleration; // Stepper acceleration
uint8_t pin1; // Pin 1
uint8_t pin2; // Pin 2
uint8_t pin3; // Pin 3
uint8_t pin4; // Pin 4

uint32_t start_offset; // Stepper start offset
uint32_t full_range; // Stepper full range (angle)
uint32_t short_range; // Stepper main range (angle) (0 for full range)
uint32_t steps; // Stepper total steps
uint32_t speed; // Stepper max speed
uint32_t acceleration; // Stepper acceleration
} stepper_x27_cfg;

/**
Expand Down
4 changes: 3 additions & 1 deletion src/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
#include <saab_can/utilities/can_reader_util.h>
#include <stdint.h>
#include <stdio.h>
#include <stdlib.h>

#define MAIN_TAG "MAIN"
#define PACKET_TIMEOUT_MS 5000
Expand Down Expand Up @@ -43,7 +44,8 @@ void setup() {
delete can_handle;
}

sc_can_reader_subscription_t sub1 = {.id = "SUB_1", .frame_id = GAUGE_CAN_ID, .cb = handle_gauge_value_frame};
sc_can_reader_subscription_t sub1 = {.id = {}, .frame_id = GAUGE_CAN_ID, .cb = handle_gauge_value_frame};
snprintf(sub1.id, SC_CAN_RDR_SUB_ID_LENGTH, "SUB_1");
sc_can_reader_subscribe(sub1);

stepper_x27_driver::stepper_x27_cfg config = {};
Expand Down