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

AS5048A encoder support (AEGHB-725) #382

Merged
merged 1 commit into from
Jul 16, 2024

Conversation

demianzenkov
Copy link
Contributor

  • Support for AS5048A (14-bit, SPI) encoder added

Copy link

github-actions bot commented Jul 5, 2024

Warnings
⚠️ The Pull Request description looks very brief, please check if more details can be added.

👋 Hello demianzenkov, we appreciate your contribution to this project!


Click to see more instructions ...


This automated output is generated by the PR linter DangerJS, which checks if your Pull Request meets the project's requirements and helps you fix potential issues.

DangerJS is triggered with each push event to a Pull Request and modify the contents of this comment.

Please consider the following:
- Danger mainly focuses on the PR structure and formatting and can't understand the meaning behind your code or changes.
- Danger is not a substitute for human code reviews; it's still important to request a code review from your colleagues.
- Resolve all warnings (⚠️ ) before requesting a review from human reviewers - they will appreciate it.
- To manually retry these Danger checks, please navigate to the Actions tab and re-run last Danger workflow.

Review and merge process you can expect ...


We do welcome contributions in the form of bug reports, feature requests and pull requests.

1. An internal issue has been created for the PR, we assign it to the relevant engineer.
2. They review the PR and either approve it or ask you for changes or clarifications.
3. Once the GitHub PR is approved we do the final review, collect approvals from core owners and make sure all the automated tests are passing.
- At this point we may do some adjustments to the proposed change, or extend it by adding tests or documentation.
4. If the change is approved and passes the tests it is merged into the default branch.

Generated by 🚫 dangerJS against 6064126

@github-actions github-actions bot changed the title AS5048A encoder support AS5048A encoder support (AEGHB-725) Jul 5, 2024
@leeebo leeebo added the motor label Jul 11, 2024
Copy link
Contributor

@YanKE01 YanKE01 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hello, thank you for adding support for AS5048A to esp_simplefoc. There are also some code styles to pay attention to. You can use format.sh to standardize the code format after importing the idf environment.

In addition, for easy testing, please add TEST_CASE in test_esp_simplefoc.

@demianzenkov
Copy link
Contributor Author

TEST_CASE added

Copy link
Contributor

@YanKE01 YanKE01 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi, there are still some issues to be resolved, mainly including that you need to add the added "as5048a.cpp" to the CMakeLists.txt of the component, so as to ensure the normal operation of the component. In addition, can you provide the TEST_CASE log when as5048a is running normally? Mainly including the changes in angles.

@demianzenkov
Copy link
Contributor Author

demianzenkov commented Jul 11, 2024

In addition, can you provide the TEST_CASE log when as5048a is running normally? Mainly including the changes in angles.

There is an angle log in the test case:
ESP_LOGI(TAG, "angle:%.2f", as5048a.getSensorAngle());
Should I add debug log message with the angle to the getSensorAngle() method?

@YanKE01
Copy link
Contributor

YanKE01 commented Jul 11, 2024

There is no need to add logs to the getSensorAngle() method, I don't have AS5048A as a sensor on my side, so I hope you can provide some test logs.

@demianzenkov
Copy link
Contributor Author

The log looks like this:

I (1338) AS5048a: angle:4.86
I (2341) AS5048a: angle:4.96
I (3341) AS5048a: angle:5.24
I (4341) AS5048a: angle:5.41
I (5341) AS5048a: angle:5.57
I (6341) AS5048a: angle:5.89
I (7341) AS5048a: angle:6.16
I (8341) AS5048a: angle:0.25
I (9341) AS5048a: angle:0.61
I (10341) AS5048a: angle:1.04

Should I add add it anywhere?

@YanKE01
Copy link
Contributor

YanKE01 commented Jul 11, 2024

It looks like everything is working fine, no need to add logs elsewhere.

components/motor/esp_simplefoc/CHANGELOG.md Outdated Show resolved Hide resolved

set(INC_FILES "port/esp/include/" "port/angle_sensor")
set(IGNORE_FILES "port/esp/esp_hal_adc.cpp" "port/esp/esp_hal_mcpwm.cpp"
"port/esp/esp_hal_bldc_3pwm.cpp" "port/angle_sensor/mt6701.cpp")
"port/esp/esp_hal_bldc_3pwm.cpp" "port/angle_sensor/mt6701.cpp" "port/angle_sensor/as5048a.cpp")
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@demianzenkov Please run pre-commit install under this project. Then during git commit stage, it should auto-find and modify the format or spelling issues.

As you have already added commits, please run SKIP=no-commit-to-branch pre-commit run --files components/motor/esp_simplefoc to manually run pre-commit on the files you have committed

Copy link
Contributor Author

@demianzenkov demianzenkov Jul 12, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I ran pre-commit but seems it didn't change any files.

esp-iot-solution % SKIP=no-commit-to-branch pre-commit run --files components/motor/esp_simplefoc
Check copyright notices..............................(no files to check)Skipped
file contents sorter.................................(no files to check)Skipped
trim trailing whitespace.............................(no files to check)Skipped
fix end of files.....................................(no files to check)Skipped
check that executables have shebangs.................(no files to check)Skipped
check that scripts with shebangs are executable......(no files to check)Skipped
mixed line ending....................................(no files to check)Skipped
fix double quoted strings............................(no files to check)Skipped
Do not use more than one slash in the branch name.......................Skipped
Do not use uppercase letters in the branch name.........................Skipped
astyle formatter.....................................(no files to check)Skipped
Check File Permissions...............................(no files to check)Skipped
Validate executable-list.txt.............................................Passed
codespell............................................(no files to check)Skipped

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@demianzenkov Sorry for the Incorrect command, it seems the pre-commit skipped all checks.

Please run SKIP=no-commit-to-branch pre-commit run --files components/motor/esp_simplefoc/**/*

Copy link
Collaborator

@leeebo leeebo Jul 15, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If it works as normal, #382 (comment) will be fixed automatically

components/motor/esp_simplefoc/idf_component.yml Outdated Show resolved Hide resolved
@YanKE01
Copy link
Contributor

YanKE01 commented Jul 12, 2024

Hello, please merge the current 5 commits into one commit so that we can do the final merge. @demianzenkov

@demianzenkov
Copy link
Contributor Author

@YanKE01 commits squashed.

@YanKE01
Copy link
Contributor

YanKE01 commented Jul 15, 2024

sha=a491e4b18a206e63e9c69ebd366dd35c37c69934

@leeebo
Copy link
Collaborator

leeebo commented Jul 15, 2024

sha=6064126c792384023f5a7a84612d662e577b8143

- 14-bit rotary position encoder AS5048A support added
@demianzenkov
Copy link
Contributor Author

@leeebo license announcement added, commits squashed again.

@zhanzhaocheng zhanzhaocheng merged commit 8624656 into espressif:master Jul 16, 2024
3 of 4 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants