Add TonHe 30kW PSU control with LV/HV restart (v1.0.37).

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
raduet
2026-09-23 14:05:53 +02:00
co-authored by Cursor
parent 644fcf1692
commit 10691b77f2
15 changed files with 10132 additions and 8832 deletions
+8 -3
View File
@@ -220,6 +220,10 @@ int main(void)
log_printf(LOG_INFO, "Connector current limit: %u.%u A\n",
(unsigned)(Board_GetConnectorCurrentLimit_0p1A() / 10u),
(unsigned)(Board_GetConnectorCurrentLimit_0p1A() % 10u));
log_printf(LOG_INFO, "PSU type: %u (%u W / %u A)\n",
(unsigned)Board_GetPsuType(),
(unsigned)Board_GetPsuMaxPowerW(),
(unsigned)Board_GetPsuMaxCurrentA());
log_printf(LOG_INFO, "FW version: %d.%d.%d\n", infoPacket.fw_version_major, infoPacket.fw_version_minor, infoPacket.fw_version_patch);
CAN1_MinimalReInit();
PSU_Init();
@@ -261,11 +265,12 @@ void SystemClock_Config(void)
/** Initializes the RCC Oscillators according to the specified parameters
* in the RCC_OscInitTypeDef structure.
*/
RCC_OscInitStruct.OscillatorType = RCC_OSCILLATORTYPE_HSE|RCC_OSCILLATORTYPE_LSE;
RCC_OscInitStruct.OscillatorType = RCC_OSCILLATORTYPE_HSE|RCC_OSCILLATORTYPE_LSI|RCC_OSCILLATORTYPE_LSE;
RCC_OscInitStruct.HSEState = RCC_HSE_ON;
RCC_OscInitStruct.HSEPredivValue = RCC_HSE_PREDIV_DIV5;
RCC_OscInitStruct.LSEState = RCC_LSE_ON;
RCC_OscInitStruct.LSEState = RCC_LSE_OFF;
RCC_OscInitStruct.HSIState = RCC_HSI_ON;
RCC_OscInitStruct.LSIState = RCC_LSI_ON;
RCC_OscInitStruct.Prediv1Source = RCC_PREDIV1_SOURCE_PLL2;
RCC_OscInitStruct.PLL.PLLState = RCC_PLL_ON;
RCC_OscInitStruct.PLL.PLLSource = RCC_PLLSOURCE_HSE;
@@ -292,7 +297,7 @@ void SystemClock_Config(void)
Error_Handler();
}
PeriphClkInit.PeriphClockSelection = RCC_PERIPHCLK_RTC|RCC_PERIPHCLK_ADC;
PeriphClkInit.RTCClockSelection = RCC_RTCCLKSOURCE_LSE;
PeriphClkInit.RTCClockSelection = RCC_RTCCLKSOURCE_LSI;
PeriphClkInit.AdcClockSelection = RCC_ADCPCLK2_DIV6;
if (HAL_RCCEx_PeriphCLKConfig(&PeriphClkInit) != HAL_OK)
{