Touch button not working on Proffie v3 board

Spawned this issue off from the previous thread

Hi!

I have a Proffie v3.9 board wired up with touch buttons and accent LEDs. For the sake of reproducing this I’ve simplified the config down.

What I’m seeing with this setup is that the touch value being reported by the board to serial monitor stays at the TOUCH_MAX value of 8192 no matter if I’m touching the touch button or not.

Additionally, bladePowerPin4 is powered on when the blade is off even though my simplified config does not have it configured. In the case where I have a config which utilizes bladePowerPin4 it’s constantly flickering when the blade is off but behaves as defined in the blade style when the blade is on.

#ifdef CONFIG_TOP
#include "proffieboard_v3_config.h"
#define NUM_BLADES 1
#define NUM_BUTTONS 1
#define VOLUME 50
#define SAVE_STATE
const unsigned int maxLedsPerStrip = 144;
#define CLASH_THRESHOLD_G 5.0
#define ENABLE_AUDIO
#define ENABLE_MOTION
#define ENABLE_WS2811
#define ENABLE_SD
#define COLOR_CHANGE_DIRECT
//#define DISABLE_DIAGNOSTIC_COMMANDS
#define SPEAK_TOUCH_VALUES

#endif

#ifdef CONFIG_PROP
#include "../props/saber_fett263_buttons.h"
#endif

#ifdef CONFIG_PRESETS
Preset presets[] = {
  {
    "Dark;common", "",
    StylePtr<InOutHelper<Red,300,800>>(),
    "dark"
  },
  {
    "Blue;common", "",
    StylePtr<InOutHelper<Red,300,800>>(),
    "blue"
  }
};

BladeConfig blades[] = {
  {
    0,
    WS281XBladePtr<136, bladePin, Color8::GRB, PowerPINS<bladePowerPin2, bladePowerPin3>>(),
    CONFIGARRAY(presets)
  }
};
#endif

#ifdef CONFIG_BUTTONS
TouchButton PowerButton(BUTTON_POWER, powerButtonPin, 2000, "pow");
#endif

I tried this myself, and it does indeed not work.
I know I tested it at some point, but I think that was a very long time ago, because the code does not work with current V3 boards as written.

I’ve uploaded a fixed version of stm32l4_touchbutton.h to github.
You can either download the latest version from there and replace then one in your ProffieOS, or just get the latest master version from github and try that.

Let me know if it works for you.
Once it does, I will include it in an updated version of ProffieOS.

Yup touch button values are being recognized now. But now I’m seeing an issue where touching one of the buttons somehow triggers all of my other defined touch buttons.

Below is the serial monitor output with 2 touch buttons defined, “pow” and “aux”. This is when I press only the main “pow” button and “aux” also gets triggered.

Activating polyphonic font.
Activating SmoothSwing V2
Accent Swings Enabled.
Polyphonic swings: 16
Monophonic swings: 0
Accent Slashes NOT Detected: 
unit = 0 vol = 0.50, Playing Dark/boot/boot1.wav
channels: 1 rate: 44100 bits: 16
I2C init..
MotiWelcome to ProffieOS v7.8
For available serial commands, see:
https://pod.hubbe.net/tools/serial-monitor-commands.html
EVENT: ?48 millis=9096
EVENT MENU TURN LEFT
EVENT: ?48 millis=9327
EVENT MENU TURN LEFT
EVENT: ?48 millis=9359
EVENT MENU TURN LEFT
EVENT: ?48 millis=9560
EVENT MENU TURN LEFT
EVENT: ?48 millis=10220
EVENT MENU TURN LEFT
EVENT: Power-Pressed#1 millis=11932
EVENT: Power-Pressed millis=11932
EVENT: Aux-Pressed#1 mods Power millis=11937
EVENT: Aux-Pressed mods Power millis=11937
EVENT: Aux-Released#1 mods PowerAux millis=11946
EVENT: Aux-Released mods PowerAux millis=11946
EVENT: Aux-Shortclick#1 mods Power millis=11946
EVENT: Aux-Shortclick mods Power millis=11946
Playing vmbegin.wav, channels: 1 rate: 44100 bits: 16
EVENT: Power-Released#1 millis=11987
EVENT: Power-Released millis=11987

Also the issue with bladePowerPin4 being powered on is resolved as well

Hmm, I only tested one button.
I will try it again to make sure 2 and 3 buttons work properly.

Found and fixed another bug. Seems to work better now.
I’m still having problems with “auxPin” though. It’s not reporting reasonable touch values for some reason. Not sure if that is something unique to my setup or if it’s another bug somewhere. Please test and let me know.

Yep they’re now being triggered independently. I have mine set for powerButtonPin and aux2Pin currently and disabled auxPin since it wasn’t working for me as well. Was thinking it was just an issue on my end. This saber is wired for all 3 button pins so if you have a fix for it I can re-enable auxPin and test it.

Thank you again!

Just commenting to see if this issue has been resolved in the most recent rev updates or if wiring to aux2pin is still the suggested route?

I’m afraid we still haven’t figured out why auxPin doesn’t handle touch buttons well. Not a lot of people use it, so it’s not been a high priority.

All good…going to aux2pin isn’t a huge pain anyhow I was just curious! Thanks Fred