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
+27 -9
View File
@@ -1,6 +1,7 @@
#pragma once
#include <stdint.h>
#include "charger_config.h"
typedef enum{
RELAY_AUX0 = 0,
@@ -40,22 +41,39 @@ typedef enum{
uint8_t IN_ReadInput(inputNum_t input_n);
// Версия устройства
#define VERSION_OFFSET (0x1E4)
// ConfigBlock: new bootloader at 0x08007800, legacy at 0x080001E4
#define VERSION_OFFSET (0x08007800u)
#define VERSION_OFFSET_LEGACY (0x080001E4u)
typedef struct __attribute__((packed)) {
uint32_t serialNumber; // Байты 0-3
uint8_t stationType; // Байт 4
uint8_t boardVersion; // Байт 5
uint8_t addrEdcan; // Байт 6
uint8_t maxPower; // Байт 7
uint8_t pad[7]; // bytes 8-14, see edcan.h
uint32_t serialNumber; // Байты 0-3
uint8_t stationType; // Байт 4
uint8_t boardVersion; // Байт 5
uint8_t addrEdcan; // Байт 6
uint8_t contactorConfig; // Байт 7
uint8_t connectorConfig; // Байт 8
uint8_t maxPower; // Байт 9, 5 кВт/bit
uint8_t psuType; // Байт 10
uint8_t meterType; // Байт 11
uint8_t balancerType; // Байт 12
uint8_t autostartMode; // Байт 13
uint8_t motorEnable; // Байт 14
uint16_t connector1CurrentLimitA; // Байты 15-16, A; 0 = legacy PSU_MAX_CURRENT
uint8_t reserved[45]; // Байты 17-63
uint16_t connector2CurrentLimitA; // Байты 17-18
uint16_t connector3CurrentLimitA; // Байты 19-20
uint8_t reserved[43]; // Байты 21-63
} InfoBlock_t;
#if defined(__STDC_VERSION__) && (__STDC_VERSION__ >= 201112L)
_Static_assert(sizeof(InfoBlock_t) == 64, "InfoBlock_t must be 64 bytes");
#endif
extern InfoBlock_t *InfoBlock;
void Board_SelectInfoBlockAddress(void);
void Board_LoadInfoBlockLimits(void);
uint16_t Board_GetConnectorCurrentLimit_0p1A(void);
uint16_t Board_ClampCurrent_0p1A(uint16_t current_0p1A);
PsuType_t Board_GetPsuType(void);
uint16_t Board_GetPsuMaxCurrentA(void);
uint32_t Board_GetPsuMaxPowerW(void);