[HAL][DAC] Fix HAL DAC calibration procedure (function HAL_DACEx_SelfCalibrate() ) to manage case of calibration factor equal to range maximum value (previously, in this case calibration factor was reset, leading to voltage accuracy not optimal)
diff --git a/Src/stm32h7xx_hal_dac_ex.c b/Src/stm32h7xx_hal_dac_ex.c
index 15d998a..b85533f 100644
--- a/Src/stm32h7xx_hal_dac_ex.c
+++ b/Src/stm32h7xx_hal_dac_ex.c
@@ -713,8 +713,12 @@
 
     if ((hdac->Instance->SR & (DAC_SR_CAL_FLAG1 << (Channel & 0x10UL))) == 0UL)
     {
-      /* Trimming is actually one value more */
-      trimmingvalue++;
+      /* Check trimming value below maximum */
+      if (trimmingvalue < 0x1FU)
+      {
+        /* Trimming is actually one value more */
+        trimmingvalue++;
+      }
       /* Set right trimming */
       MODIFY_REG(hdac->Instance->CCR, (DAC_CCR_OTRIM1 << (Channel & 0x10UL)), (trimmingvalue << (Channel & 0x10UL)));
     }