Ka-Radio32 icon indicating copy to clipboard operation
Ka-Radio32 copied to clipboard

different joystick support

Open mogyoros opened this issue 4 years ago • 1 comments

Hi there,

I am really happy for this project, so I built one from what I had at home. ESP32dev board, MAX98357A as i2s amplifer (mono for the moment), SSD1306 I2C OLED display. Since I did not had rotary encoders, and I did not like the push button scenario, I went for the joystick implementation, since I had that in hand, like this one: KY-023_dual_axis_joystick_module_arduino This is not built with switches, but with potentio meter. It has two axes with analog output, plus one switch. Its a perfect choice to implement play/pause with the switch, and volume and channel adjustment with the two axis. So I configured it in the boards/pattern.csv file, but I have observed, that it always did decreased the volume to minimum. (in this case only one axis was connected). This is beacuse it has a different implmentation than one described in HardwareConfig.md. At the two side state it outputs either 0 or Vcc, but in the normal center state it outputs Vcc/2. Going throught the code, I found in main/ClickJoystick.c the relevant part that reads the adc channel and modifies the states according the value read.

        if (voltage < 1000) {ps[0] = false; ps[1] = false;} 
        if (voltage >3000) {ps[0] = true; ps[1] = false;} 
        if ((voltage >= 1000)&&(voltage <= 3000)) {ps[0] = false; ps[1] = true;}

This has to be modified to:

        if (voltage < 1000) {ps[0] = false; ps[1] = true;} 
        if (voltage >3000) {ps[0] = true; ps[1] = false;} 
        if ((voltage >= 1000)&&(voltage <= 3000)) {ps[0] = false; ps[1] = false;}       

Maybe this could be somehow handled with a parameter in the code and the config. Hope you find it useful for your project. Cheers, Tamas

mogyoros avatar May 13 '20 08:05 mogyoros

Thanks, i will check it

karawin avatar May 15 '20 20:05 karawin