-
-
Notifications
You must be signed in to change notification settings - Fork 383
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
VESC Spindle via UART #531
base: main
Are you sure you want to change the base?
Conversation
@@ -50,35 +51,6 @@ static void _outbytes(uint8_t* buf, size_t len) { | |||
serialPort->write(buf, len); | |||
} | |||
|
|||
/* CRC16 implementation acording to CCITT standards */ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In case anyone wonders why i decided to extract this to its own file:
I didn't want to add a redundant implementation for CRC16 if there is already a perfectly working copy available.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Instead of just calling it "crc.cpp", how about identifying the variant, i.e. "crc16_ccitt.cpp"
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done
|
FluidNC/src/xmodem.cpp
Outdated
@@ -129,13 +101,13 @@ static void flushinput(void) { | |||
static bool held = false; | |||
static uint8_t held_packet[1024]; | |||
static void flush_packet(size_t packet_len, size_t& total_len) { | |||
if (held) { | |||
// Remove trailing ctrl-z's on the final packet | |||
if (held) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please undo the formatting breakage. Run clang-format on everything that you touch.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should be fixed now. For some reason the autoformat did that... Had to disable it to be able to save the file without it changing that :)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe your autoformat is not using clang-format? If it is using clang-format, then the .clang-format rules in the repo should, in principle, govern the styling.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think that's what I'm using as visual studio code should pick up on that automatically as far as i can tell. All i did was open the project in visual studio code with platformio and some other add-ons installed. As far as i know i haven't done any other formatting configurations. Maybe one of the add-ons is interfering with that somehow... I need to check that next time.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe this will help https://code.visualstudio.com/docs/cpp/cpp-ide . In principle, if you have the C++ extensions enabled, you get clang-format, but maybe you have some other extensions that use a different formatter, or there is some other setting override. Vscode is pretty much infinitely customizable, which means that no two people have a similar experience.
vesc_spindle.md |
Would it be better to add a poles parameter to the config file, so the firmware and speed_map can use real RPM? |
That would certainly be a possibility however the vesc_tool only shows ERPM too so it would add a point of confusion there instead. Even though their use of ERPM and RPM is a bit inconsistent... |
Would M3S10000 be referring to ERPM in your case? That seems like a bad idea, especially for use with CAM software that uses real RPM. |
Yes that would be ERPM. So i think you are right. Adding that parameter would be safer. |
Poles is similar to flutes on a bit. You tell the CAM software about the flutes and it then can work in RPM. |
No not really as the number of flutes does not actually affect the rpms of the spindle for the same drive waveform of the motor whereas the number of poles of the brushless motor does. |
OK, I guess the rough analogy is lost on you, but we agree on the required changes to the code. |
Yes sorry about that :)
The reason i don't agree with that analogy is that if I'd have a 2 flute endmill in the spindle and the motor has 7 pole pairs and then i do an M3 S1000 the spindle would spin at 1000RPM.
If i were to swap out the endmill for a 4 flute one the spindle would still be spinning at 1000RPM for an M3 S1000.
Now imagine i swapped out the motor for a different one with 14 pole pairs. That M3 S1000 would then result in only 500RPM instead of the expected 1000.
Anyway long story short. I'll add that option and a description of how to determine the number of poles for a given motor to properly configure said option.
…On July 19, 2022 9:31:14 PM UTC, bdring ***@***.***> wrote:
OK, I guess the rough analogy is lost on you, but we agree on the required changes to the code.
--
Reply to this email directly or view it on GitHub:
#531 (comment)
You are receiving this because you authored the thread.
Message ID: ***@***.***>
|
Updated documentation: |
Noticed some issues with the queue filling up due to repeated calls to setSpeedfromISR |
Added a workaround similar to what is done in VFDSpindle. |
This PR adds support for connecting a VESC to FluidNC via UART and using it as a spindle.
It also checks for any faults occuring in the motor controller and stops gcode execution + sets an alarm.
VESC can be controlled with 3 modes:
https://vesc-project.com/node/1796
https://electric-skateboard.builders/t/vesc-faq-duty-cycle-vs-current-control-ppm-settings/1218
Can be configured as follows (speed mode):
Modes are called like this: