Adjust trainer resistance from HR

Anyone who knows a way to use ERG adjusted to heart rate? I would like a way to lower the resistance when the HR gets above a certain threshold to avoid getting into the spiral of death. Using Neo 2T with Fenix 6.