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

Using [adxl345 my_custom_name] doesn't work for vibrations graphs #44

Open
1 task done
taganaka75 opened this issue Jan 14, 2024 · 8 comments
Open
1 task done
Labels
bug Something isn't working done Issue is done but not merged on main

Comments

@taganaka75
Copy link

K-Shake&Tune module branch

  • I confirm using the main branch

Version

v2.5.0-2-g0696a60b

Describe the bug and expected behavior

I've a printer with RatOS installed,
When i run VIBRATIONS_CALIBRATION command i recieve the error "Invalid adxl345 id (got ff vs e5).

If i run VIBRATIONS_CALIBRATION ACCEL_CHIP="toolboard" or VIBRATIONS_CALIBRATION ACCEL_CHIP=toolboard
the commad start correctly and execute the data log but after:
"Machine and motors vibration graph generation..."
"This may take some time (3-5min)
I recieve the message "No CSV files found in the /tmp folder to create the vibration graphs!"

In the /tmp directory there are the .csv files with this name:
"adxl345-toolboard-sp20_00n1.csv" ecc.

What's i'm doing wrong?

Additional information and klippy.log

klippy.log

@taganaka75 taganaka75 added the bug Something isn't working label Jan 14, 2024
@taganaka75
Copy link
Author

If I rename "adxl345-toolboard-sp20_00n1.csv" to "toolboard-sp20_00n1.csv"the files in the /tmp folder, the program works and generate the plot...

@Frix-x
Copy link
Owner

Frix-x commented Jan 14, 2024

Hello,
I don't think you are doing something wrong but currently custom named accelerometer doesn't work for the vibration graphs.

So if you have something like [adxl345 whatevername], this will not work. Shake&Tune is for now compatible only with vanilla [adxl345] or [lis2dw], etc... without any custom name. But I already have it in the backlog and do plan on working on this subject soon.

The main problem I need to overcome is that whatevername can be either an adxl345 or a lis2dw or any other Klipper supported accelerometer and it will change the CSV filename. So I need to find a way in my Klipper macro to be able to detect which chip is associated with this custom name in order to pass it to my Python scripts to look for the correct csv filenames and I'm not sure how to do this at the moment...

@Frix-x Frix-x changed the title No CSV files found in the /tmp folder to create the vibration graphs! Using [adxl345 my_custom_name] doesn't work for vibrations graphs Jan 14, 2024
@The-Original-Reth
Copy link

This is my attempt to fix this.
What it does it is checks to see if adxl_y is the same as adxl_x if true then it just does normal operation.
if adxl_y is not the same as adxl_x then it will run X with adxl_x and Y with adxl_y

K-SnT_vibrations - seperate adxl for x and y.txt

@taganaka75
Copy link
Author

i've modified is_workflow.py line 139
from:
globbed_files = glob.glob(f'/tmp/{chip_name}-.csv')
to:
globbed_files = glob.glob(f'/tmp/adxl345-{chip_name}-
.csv')

now VIBRATIONS_CALIBRATION ACCEL_CHIP=toolboard
works perfectly

@The-Original-Reth
Copy link

will this work for lis2dw also, or is adxl fixed in there

@ndanyluk
Copy link

ndanyluk commented Mar 6, 2024

Hey @Frix-x thanks for this awesome module! Currently this issue also affects bed slingers as well since you need 2 adxls by necessity (one for toolhead and one for the bed).

I'll take a look at the code and see if I can at least fix this for bedflingers (which we could enforce a set "toolhead" and "bed" naming scheme to have it follow a convention S&T can follow

@Frix-x
Copy link
Owner

Frix-x commented Mar 6, 2024

Hey @Frix-x thanks for this awesome module! Currently this issue also affects bed slingers as well since you need 2 adxls by necessity (one for toolhead and one for the bed).

I'll take a look at the code and see if I can at least fix this for bedflingers (which we could enforce a set "toolhead" and "bed" naming scheme to have it follow a convention S&T can follow

Thanks for the proposal.
I have a plan already but need to find time to work on it. But to sum up, I want to retrieve the acelerometer type from the Klipper macro by using jinja and looking at the "printer" object in order to send it to the Python script and replace the hardcoded "adxl345" string with this. If you find out how to do this, it would be wonderful and I'll be happy to accept a PR :)

@Frix-x Frix-x added the done Issue is done but not merged on main label May 19, 2024
@Frix-x
Copy link
Owner

Frix-x commented May 19, 2024

Just to let you know that the new version is almost finished. And in this new version, I've made a fix for this problem.

Now S&T runs as a real Klipper extras plugin: so I've got access to the accelerometer objects directly in the Python side, and I've added some logic to use the best accelerometer each time, based on the ones configured in the [resonance_tester] config section. So this should no longer be a problem!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working done Issue is done but not merged on main
Projects
None yet
Development

No branches or pull requests

4 participants