Clamp connector current from InfoBlock connector1CurrentLimitA (v1.0.36).

This commit is contained in:
raduet
2026-09-02 17:21:35 +02:00
parent d3c9855f02
commit 644fcf1692
12 changed files with 8831 additions and 8739 deletions
+10 -4
View File
@@ -379,9 +379,9 @@ void CCS_SerialLoop(void) {
void CCS_Init(void){
CP_Init();
CP_SetDuty(100);
CCS_MaxLoad.maxVoltage = PSU_MAX_VOLTAGE; // 1000V
CCS_MaxLoad.maxVoltage = PSU_MAX_VOLTAGE; // 1000V
CCS_MaxLoad.minVoltage = PSU_MIN_VOLTAGE; //150V
CCS_MaxLoad.maxCurrent = PSU_MAX_CURRENT*10; //100A
CCS_MaxLoad.maxCurrent = Board_GetConnectorCurrentLimit_0p1A();
CCS_MaxLoad.minCurrent = PSU_MIN_CURRENT*10; //1A
CCS_MaxLoad.maxPower = PSU_MAX_POWER; //30000W
uart3_last_packet_tick = HAL_GetTick();
@@ -391,6 +391,11 @@ void CCS_Init(void){
log_printf(LOG_INFO, "CCS init\n");
}
void CCS_UpdateMaxLoadFromInfoBlock(void)
{
CCS_MaxLoad.maxCurrent = Board_GetConnectorCurrentLimit_0p1A();
}
ISR_FAST static uint16_t crc16_ibm(const uint8_t* data, uint16_t length) {
uint16_t crc = 0xFFFFu;
for (uint16_t i = 0; i < length; i++) {
@@ -549,9 +554,10 @@ ISR_FAST static void apply_command(uint8_t cmd, const uint8_t* payload, uint16_t
}
case CMD_E2M_SET_OUTPUT_VOLTAGE: {
const e2m_set_output_t* p = (const e2m_set_output_t*)payload;
const uint16_t clamped_current = Board_ClampCurrent_0p1A(p->current_0p1A);
CONN.RequestedVoltage = p->voltage_V;
CONN.WantedCurrent = p->current_0p1A;
PowerSetpoint_OnCommand(p->voltage_V, p->current_0p1A);
CONN.WantedCurrent = clamped_current;
PowerSetpoint_OnCommand(p->voltage_V, clamped_current);
break;
}
case CMD_E2M_ISOLATION_CONTROL: {