Ok weird. First the short version, starting at my latest step.
I don’t see why my twist is reversed.
TWIST_LEFT is showing up as TWIST_RIGHT and vice versa.
To test my sanity, I loaded a clean OS7.14 with the default config.
I added some printouts to DetectTwist() in prop_base.h…
I also just removed the preprocessor stuff about NEED_DETECT_TWIST
in saber.h and just had the Loop() override call DetectTwist() all the time.
I twist left, it prints “EVENT_TWIST_RIGHT - how about this?”
I twist right, it prints “EVENT_TWIST_LEFT - so is this correct?”
So is it just my printouts are somehow incorrect?
These are the printouts in prop_base.h
void DetectTwist() {
Vec3 gyro = fusor.gyro();
bool process = false;
if (fabsf(gyro.x) > 200.0 &&
fabsf(gyro.x) > 3.0f * abs(gyro.y) &&
fabsf(gyro.x) > 3.0f * abs(gyro.z)) {
process = DoGesture(gyro.x > 0 ? TWIST_LEFT : TWIST_RIGHT);
} else {
process = DoGesture(TWIST_CLOSE);
}
if (process) {
if (strokes[NELEM(strokes)-1].type == TWIST_LEFT) {
STDOUT << "EVENT_TWIST_LEFT - so is this correct?\n";
}
if (strokes[NELEM(strokes)-1].type == TWIST_RIGHT) {
STDOUT << "EVENT_TWIST_RIGHT - how about this?\n";
}
if ((strokes[NELEM(strokes)-1].type == TWIST_LEFT &&
....... // rest of code here
This is the call in saber.h
void Loop() override {
PropBase::Loop();
DetectTwist();
Here’s the way I got here.
I have an Arcann install that the board is slanted at ~20 degrees, AND the USB is facing toward the blade end.
I set #define ORIENTATION_ROTATION 0,200,0
and it’s happy about up and down, and melt, stab, drag all works fine.
But then I noticed Serial Monitor was showing the opposite EVENT_TWIST_LEFT/RIGHT from what I was doing. So I assumed my ORIENTAION setting needed tweaking.
However, a different saber with standard orientation was also the same way.
So I tried a 3rd saber and also backward single twist directions.
So then I wanted non-modified OS and prop to test with…
-----> goto TOP OF PAGE