Major master controller firmware update!

I have finally managed to rewrite some parts of firmware code I wasn’t particularly happy with, namely the collective head switch parser! It was a mess, used huge amounts of memory, yet only allowed using around 17 physical buttons.

I understood that with 2 more collective heads that will soon be added to Simchair collection, a major cleanup was needed, along with some changes related to use of flash memory to store configurations more efficiently. This allowed me to design a cleaner configuration structure that could be parsed more efficiently, and thus, I was able to add more buttons!

As of now, we can use up to 32 buttons of types 1 and 2, and up to 9 buttons of types 3 and 4 – buttons from 33 to 42 are reserved for to be assigned as middle buttons. With a mode switch support, this is 96 virtual buttons plus 33 available for middle switch positions. The latter are now defined explicitly, allowing for a wider range of configurations. These changes should allow for pretty much any collective configuration, with twice the buttons compared to what we had before.

Another good thing – all heads now have common data structures, that are populated in setup subroutines from corresponding configuration structures. This reduces chances of breaking something when adding features and makes things cleaner =)

Please sync with the repo and reflash, report bugs if you find any!

Here’s how new head switches configuration looks:

// COLLECTIVE SWITCHPANEL SWITCH MATRIX – NOW SUPPORTS UP TO 32
// BUTTONS + 10 ADDITIONAL BUTTONS FOR TYPES 3 AND 4
// 4 SWITCH TYPES ARE SUPPORTED:
// 1: button
// 2: momentary press button
// 3: selector button (button + middle button press when switch is centered)
// 4: selector momentary press button (momentary press button + middle button momentary press when switch is centered)
// ASSIGN THE BUTTON AFTER TYPES 3 AND 4 TO TYPE 5 (SLAVE) AND SET JOYSTICK BUTTON YOU WANT TO BE THE MIDDLE BUTTON IN 3RD COLUMN!
// BUTTONS FROM 33 TO 42 ARE RESERVED FOR MIDDLE BUTTONS

//0 – disabled, 1 – button, 2 – 3 – selector_button, 4 – selector, 5 – slave
const sw_matrix ab412_switch_matrix[] PROGMEM =
{
// i t m is i – id, t – type, m – middle button for types 3 and 4
{1, 1, 0},
{2, 1, 0},
{3, 2, 0},
{4, 2, 0},
{5, 2, 0},
{6, 2, 0},
{7, 2, 0},
{8, 2, 0},
{9, 3, 33},
{10,5, 33},
{11,3, 34},
{12,5, 34},
{13,3, 35},
{14,5, 35},
{15,4, 36},
{16,5, 36},

};


Realistic throttle latch operation for all collective levers

When I added support of sending a button press at zero throttle position for new throttle latch, I thought that nothing actually prevents me from doing the same thing for levers with tactile idle stop mark!

So, I have added a similar mode for Huey-style lever (which still looks better with a tactile mark design, as in the real Huey the idle stop latch is driven by a solenoid). So, to press the cutoff button (throttle latch button in Dreamfoil 407 for Xplane11) with a turn of the throttle grip, in case of the tactile mark lever, one has to press the assigned idle release button on the head before moving throttle grip past the idle stop detent. This pretty much makes all levers very similar in the sense of realism, the only thing absent in tactile mark levers being the actual detent of the idle stop. Not a big deal tbh!

For levers with physical latch, the button will always be pressed when the throttle grip reaches its zero position.

Here’s how it looks in the configuration:

#define BUTTON_PRESS_ON_THROTTLE_CUTOFF 1// this feature will send a joystick button press when the throttle is fully closed
#define THROTTLE_LATCH_MODE “TACTILE” // PHYSICAL for physical latch mod or TACTILE for levers with tactile marks
#define PHYSICAL_LATCH_MOD_JOY_BUTTON 32 // joystick button number as seen in joy.cpl for the 1st Leonardo in the list
#define THROTTLE_MIN_AXIS_VALUE 0 // check this if the default doesn’t work, print raw_throttle value in e_single_collective.ino and set this line to its value, corresponding to a fully closed throttle