MIDI CC messages, Over-riding the default value

Hello!

I am using Pieter P's fabulous Control Surface Library, and I have a question about overriding default behavior.

using ccbutton (https://tttapa.github.io/Control-Surface/Doc/Doxygen/d9/d2e/CCButton_8ino-example.html) I can easily make a button that fires 127 on press and 0 on release, using this line cut from working code:

CCButton button10 = {10, {MIDI_CC::General_Purpose_Controller_1, CHANNEL_1},}

My question: can I control the values that it sends, without editing the library? Is there a way to modify the above line to override the default and send, say 60 on press and 30 on release?

Thank you for reading, and any advice you can lend.

If you go to the documentation for CCButton, you'll see that the third, optional constructor argument is the MIDI Sender. You can click its type, DigitalCCSender, and then you'll see that it has two optional arguments as well, the "on" value, and the "off" value.

In other words, you can use the following code for a button connected to pin 10, GP Controller #1 on Channel 1, with a value of 60 on press and 30 on release:

CCButton button10 = {
  10,                                                 // button pin
  {MIDI_CC::General_Purpose_Controller_1, CHANNEL_1}, // MIDI address
  { 60, 30 },                                         // MIDI sender {on value, off value}
};

You can also change the values later in your program:

CCButton button10 = {
  10,                                                 // button pin
  {MIDI_CC::General_Purpose_Controller_1, CHANNEL_1}, // MIDI address
};

void setup() {
  button10.sender.setOnValue(60);
  button10.sender.setOffValue(30);
  Control_Surface.begin();
}

Pieter

You are a genius and a gentleman.