This will do it for you, add on line after ....keyCommands = {.......
--Alternate flaps
{down = device_commands.Button_1, up = device_commands.Button_2, cockpit_device_id = devices.CONTROL_SYSTEM, value_down = 1.0, value_up = 1.0, name = _('Alternate Flaps Up middle'), category = _('Flight Control')},
{down = device_commands.Button_3, up = device_commands.Button_2, cockpit_device_id = devices.CONTROL_SYSTEM, value_down = 1.0, value_up = 1.0, name = _('Alternate Flaps Landing middle'), category = _('Flight Control')},
Set bindings for Flap UP and Flap DWN and the MID (T/O) will look after itself....