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

Changed workings of VFD code, added H2A VFD #544

Merged
merged 13 commits into from
Aug 16, 2020
Merged

Conversation

atlaste
Copy link
Collaborator

@atlaste atlaste commented Aug 13, 2020

  • Changed how the VFD code works. New features:
    • Automatic retries of incorrect responses
    • Possible initialization of VFD's
    • Abstract VFD class; should make it much, much easier to implement new VFD's
    • Checking of CRC16 and address; that makes it possible for multiple modbus devices to exist.
    • Regular polling of state changed
  • Added H2A VFD
  • Moved Huanyang VFD to a VFD specialization
  • Changed vcxproj generator to include the ESP32 include paths, for better intellisense support

NOTE: I added my machine config, to have a working config with an H2A. We should eventually get rid of this.
NOTE: This PR includes the previously fixed grbl_init() call.

@atlaste
Copy link
Collaborator Author

atlaste commented Aug 14, 2020

Moved some code around to ensure that the rs485 task is created after the uart setup.

@atlaste atlaste mentioned this pull request Aug 14, 2020
@atlaste
Copy link
Collaborator Author

atlaste commented Aug 14, 2020

  • Fixed bug in VFD_DEBUG_MODE that gave the incorrect output for CRC validation failure.
  • Fixed bug in RX length of set_speed in Huanyang spindle

@atlaste
Copy link
Collaborator Author

atlaste commented Aug 14, 2020

  • Fixed a bug in the spindle code with states. As a result, the VFD didn't update ? state correctly.
  • Updated TODO/FIXME. Some of these should eventually be implemented (but it's really just "extra's")

Stefan de Bruijn added 2 commits August 15, 2020 11:35
…poses.

Fixed report compatibility with vanilla grbl. Some values were reported in a slightly different format.
@atlaste
Copy link
Collaborator Author

atlaste commented Aug 15, 2020

Fixed a few small bugs in reporting of spindle speed. This works.

Grbl_Esp32/src/Machines/3axis_rs485.h Outdated Show resolved Hide resolved
Grbl_Esp32/src/Machines/3axis_rs485.h Outdated Show resolved Hide resolved
Grbl_Esp32/src/Machines/3axis_rs485.h Outdated Show resolved Hide resolved
Grbl_Esp32/src/Machines/3axis_rs485.h Outdated Show resolved Hide resolved
Grbl_Esp32/src/Spindles/VFDSpindle.cpp Outdated Show resolved Hide resolved
Grbl_Esp32/src/Spindles/VFDSpindle.cpp Outdated Show resolved Hide resolved
Grbl_Esp32/src/Spindles/VFDSpindle.cpp Outdated Show resolved Hide resolved
Grbl_Esp32/src/Spindles/VFDSpindle.cpp Show resolved Hide resolved
Grbl_Esp32/src/Spindles/VFDSpindle.h Outdated Show resolved Hide resolved
@atlaste
Copy link
Collaborator Author

atlaste commented Aug 16, 2020

Updated as per review by Mitch (thanks).

@MitchBradley MitchBradley merged commit a436ddf into bdring:Devt Aug 16, 2020
atlaste added a commit to atlaste/Grbl_Esp32 that referenced this pull request Oct 13, 2020
* Renamed Huanyang to VFD for H2A work

* Fixed Huanyang spindle implementation again.
Fixed includes in vcxproj generator

* Changed the VFD implementation. Implemented H2A along the way.
UNTESTED!

* Fixed retry loop in VFD. Added SettingsDefinition. Fixed name conflict within GRBL (`init()`).

* Added VFD_DEBUG_MODE.

* Fixed usability of VFD_DEBUG_MODE. Added a TODO in the H2ASpindle code.
Removed it from the test machine config

* Fixed bug in VFD spindle: the uart should be set up first, before running the rs485 task.

* Fixed bug in VFD_DEBUG_MODE output. Fixed bug in RX length of set_speed command for Huanyang VFD.

* Fixed a bug in the spindle code with states. Also, VFD didn't update state correctly.
Updated TODO/FIXME

* Added some more functionality to the Null spindle, to aid testing purposes.
Fixed report compatibility with vanilla grbl. Some values were reported in a slightly different format.

* Fixed commands.h

* Fixed review by Mitch

Co-authored-by: Stefan de Bruijn <stefan@nubilosoft.com>
@Harvie
Copy link

Harvie commented Nov 26, 2020

Have you tested this? We have some issues with huanyang VFD in grblHAL:

terjeio/grblHAL#68

When i do M3 S8000 the VFD shows 7999 RPM rather than 8000. Is this the same case with grbl_esp32 code in this PR? Perhaps you can kindly give us some insight regarding this rounding problem...

@atlaste
Copy link
Collaborator Author

atlaste commented Nov 27, 2020

Have you tested this? We have some issues with huanyang VFD in grblHAL:

Yes, I've done extensive testing on my H2A (Huanyang 2A) VFD after and while implementing it and bart has done extensive testing on a normal Huanyang VFD. Very noteworthy is that H2A reports the real RPM value, while Huanyang reports the register value (and not the real RPM value!).

The reason it shows 7999 RPM probably has to do with the conversion from frequency to RPM. You have to realize that a VFD works internally with a frequency, so even if you query the RPM value, it will translate the frequency to RPM. For Huanyang, modbus works with the frequencies (integer values), for H2A modbus actually works with RPM values (also integer values). In other words, there will be a difference in what you request and what you get, even if it's running at full speed.

Regardless, one of the registers gives you the spindle frequency value. So using that, you can determine the rounding error. F.ex. if you have 400Hz (common), and a 24k RPM spindle, the error will be +/- 1 Hz, or: +/- 60 RPM. While query'ing the H2A spindle during the first testing, I've actually seen differences of up to 2 Hz. Some details are described in the H2A MD file that's in the Spindle folder in the repo.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants