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

add dronecan negative rpm in reverse direction #165

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
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
6 changes: 5 additions & 1 deletion Src/DroneCAN/DroneCAN.c
Original file line number Diff line number Diff line change
Expand Up @@ -1020,7 +1020,11 @@ static void send_ESCStatus(void)
current.count = 0;

pkt.temperature = C_TO_KELVIN(degrees_celsius);
pkt.rpm = (e_rpm * 200) / eepromBuffer.motor_poles;
if (forward) {

Choose a reason for hiding this comment

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

Suggested change
if (forward) {
if (forward != eepromBuffer.dir_reversed) {

Tested on top of #164. Reversing the direction in the ESC shouldn't reverse the sign of the RPM. The RPM sign should match the throttle sign if the motor is operating correctly.

Copy link
Contributor Author

@Huibean Huibean Jan 26, 2025

Choose a reason for hiding this comment

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

@tpwrules can you make a PR for this?I am not sure how the negative RPM is actually used in FC(just CW/CCW in here), maybe you PR this will be better?

pkt.rpm = (e_rpm * 200) / eepromBuffer.motor_poles;
} else {
pkt.rpm = (e_rpm * 200) / eepromBuffer.motor_poles * -1;
}
pkt.power_rating_pct = 0; // how do we get this?
pkt.esc_index = eepromBuffer.can.esc_index;

Expand Down
Loading