# BrakeMagic

If you didn't know about it before, everyone got introduced to "brake magic" during the 2021 Azerbaijan Grand Prix where Lewis Hamilton accidentally left his on and locked his front wheels into T1 after standing start restart.

For Lewis, the brake magic is a toggle that does a number of changes to brakes, particularily useful for keeping the front tires and brakes warm during safety car. In DDC, the brake magic is a system that applies a given percent of brake application when on. The amount can be adjusted on the fly, and can be defined in your presets, or stored per preset if using EEPROM.&#x20;

Brake magic requires the sim to support [secondary brake ](https://dahl-design.gitbook.io/ddc/switch-library/car-control-functions)inputs. &#x20;

#### brakeMagicT()

{% tabs %}
{% tab title="Description" %}
Use a toggle switch to turn brake magic on/off. Has 2 modes.

* 0: Brake magic
* 1: Pulsing toggle switch

The amount of brake application given can be read from the controllers brake axis. Brake magic on/off defaults to button field 7 for SimHub communication. It is returned as property \[DahlDesign.DDCmagicActive].&#x20;

Brake magic % is defined by the variable `brakeMagicValue` found in 41\_Presets.ino. It defaults to all presets with 50, which is 5%.&#x20;

Brake magic % can be adjusted on the fly with a [ThrottleHold](https://dahl-design.gitbook.io/ddc/switch-library/car-control-functions/throttlehold) switch.&#x20;
{% endtab %}

{% tab title="Example" %}
`void brakeMagicT(int row, int col)`

For a switch on row 3 column 5 -> `brakeMagicT(3,5);`
{% endtab %}

{% tab title="Requirements" %}

* Sim that supports secondary brake input
* 1 button number
  {% endtab %}
  {% endtabs %}

#### brakeMagicM()

{% tabs %}
{% tab title="Description" %}
Use a momentary button to turn brake magic on/off. Has 2 modes.

* 0: Brake magic
* 1: Regular momentry button

The amount of brake application given can be read from the controllers brake axis. Brake magic on/off defaults to button field 7 for SimHub communication. It is returned as property \[DahlDesign.DDCmagicActive].&#x20;

Brake magic % is defined by the variable `brakeMagicValue` found in 41\_Presets.ino. It defaults to all presets with 50, which is 5%.&#x20;

Brake magic % can be adjusted on the fly with a [ThrottleHold](https://dahl-design.gitbook.io/ddc/switch-library/car-control-functions/throttlehold) switch.&#x20;
{% endtab %}

{% tab title="Example" %}
`void brakeMagicM(int row, int col)`

For a switch on row 3 column 5 -> `brakeMagicM(3,5);`
{% endtab %}

{% tab title="Requirements" %}

* Sim that supports secondary brake input
* 1 button number
  {% endtab %}
  {% endtabs %}
