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

Bugfix/wt901 via SerialPIO #96

Draft
wants to merge 5 commits into
base: main
Choose a base branch
from

Conversation

Apehaenger
Copy link
Contributor

Got WT901 via SerialPIO now working reliable. Also tested if WT901_INSTEAD_OF_SOUND still works = yes.
It's still draft as I wait for Deyan to test it also (he's on the road for a week), but like to comment before forget ;-)

Neopixel:
For easier communication-error identification (as well as helper during my debugging), I added a magenta color to Neopixel which flashes whenever an overflow or packet error occurs (Pico's LED was a bad idea by me, as it's hidden by RTK2B).
If accepted and merged, we probably should also add other SerialPIO devices to check if they also get affected by the SerialPIO timing issue. "Sound" probably also, but the sound packets are much smaller. CoverUI?!
For this I had to slow down the normal Emergency flash rate by one more bit. Without this, visual identification wasn't possible and you quickly got blind :-/

This PR also contain a tiny nv_config fix for a compiler warning, as long as #80 isn't merged.

serial->begin(baudrate);
delay(1000);
uint8_t unlock[] = {0xFF,0xF0,0xF0,0xF0,0xF0};
/*uint8_t unlock[] = {0xFF,0xF0,0xF0,0xF0,0xF0}; // undocumented / unknown?
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Couldn't find this unlock code in any documentation. Only in a doubtful Amazon comment. So I disabled it.

Copy link

Choose a reason for hiding this comment

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

https://forum.arduino.cc/t/help-calibrating-witmotion-inclinometer-through-ttl-with-mega2560/941394/1
This is what my Google-fu gave me, not sure if it is related thou

Copy link
Owner

Choose a reason for hiding this comment

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

it is needed I remember sniffing the configuration of the GUI app to see how they do it because just sending config didn't work

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Thanks for your comments!
After reading @FadeFx comment and link I immediately thought: "Could be an Auto-Baud detection sequence", but in-between tested it. It's not :-)
Will uncomment it again.

delay(10);
writeRegister(RSW, 0b0000000000010110);
writeRegister(RRATE, 0x08); // Return rate 0x06 = 10Hz (default), 0x08 = 50Hz, 0x09 = 100Hz
Copy link
Contributor Author

Choose a reason for hiding this comment

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

IMU_CYCLETIME is 20ms, so I reduced WT's return rate to 50Hz

@Apehaenger Apehaenger changed the title Bugfix/wt901 Bugfix/wt901 via SerialPIO May 17, 2024
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.

None yet

3 participants