adafruit / Adafruit_Seesaw

Arduino library driver for seesaw multi-use chip
93 stars 64 forks source link

Bug fixes and improvements for Joy Featherwing ESP32 sample #69

Closed theficus closed 2 years ago

theficus commented 2 years ago

I've been using this code as the base for a project I'm working on and I found a couple of unfortunate mistakes I missed before that I'm fixing here. Center point determination is wrong when the controller is all the way left because I'm comparing the wrong axis. 😊

I also added some additional position calculation samples. For what I'm using the Joy Featherwing for, I need to calculate the degrees and offset from center, so I added some extra code to demonstrate this.

Example of logging:

Analog stick position change!
        Is centered: false
        Position: X=340 Y=1023
        Radian: X=-43.000000 Y=127.000000
        Degrees: -18.705210
        Position from center: 134.082064