Remove FAKE_500V Everest workaround; use real setpoints on the bus (v1.0.24).

This commit is contained in:
raduet
2026-06-30 18:30:07 +02:00
parent a583e12132
commit 86b0bfc0fc
7 changed files with 7066 additions and 7098 deletions
-5
View File
@@ -9,11 +9,6 @@
#define PSU_NUM 1
/* Everest / стенд: запрос «500 В» на шине — реально на PSU задаются U/I ниже; статус может оставаться 500 В (serial.c). */
#define FAKE_EVREQ_VOLTAGE_V 500u
#define FAKE_PSU_VOLTAGE_V 300u
#define FAKE_PSU_CURRENT_0P1A 10u
/* Fast discharge: PSU off/on cycle on step-down setpoint (unloaded bus). */
#define PSD_ENABLE 1u
#define PSD_MAX_CMD_CURRENT_0P1A 20u /* 2.0 A */
+1 -1
View File
@@ -27,7 +27,7 @@ extern "C" {
/* USER CODE BEGIN EC */
#define FW_VERSION_MAJOR 1
#define FW_VERSION_MINOR 0
#define FW_VERSION_PATCH 23
#define FW_VERSION_PATCH 24
/* USER CODE END EC */
/* Exported macro ------------------------------------------------------------*/
+1 -5
View File
@@ -283,11 +283,7 @@ void PSU_ReadWrite(){
uint8_t block_setpoint = PowerSetpoint_HasPending() || PowerSetpoint_IsBusy();
if (PSU0.ready && !block_setpoint) {
if (CONN.RequestedVoltage == FAKE_EVREQ_VOLTAGE_V) {
PSU_SetVoltageCurrent(0, (uint16_t)FAKE_PSU_VOLTAGE_V, (uint16_t)FAKE_PSU_CURRENT_0P1A);
} else {
PSU_SetVoltageCurrent(0, CONN.RequestedVoltage, CONN.RequestedCurrent); // Normal mode
}
PSU_SetVoltageCurrent(0, CONN.RequestedVoltage, CONN.RequestedCurrent);
ED_Delay(CAN_DELAY);
}
}
+3 -18
View File
@@ -47,7 +47,6 @@ static uint8_t enabled = 0;
static uint8_t pwm_duty_percent = 100;
uint8_t isolation_enable = 0;
static uint32_t last_host_seen = 0;
static uint8_t fake_500_voltage_mode = 0;
static uint8_t everest_timed_out = 0;
static uint8_t everest_timeout_warn_latched = 0;
static uint8_t everest_timeout_stop_latched = 0;
@@ -454,9 +453,6 @@ static void send_state(void) {
CCS_State.DutyCycle = CP_GetDuty();
CCS_State.OutputEnabled = PSU0.CONT_enabled;
CCS_State.MeasuredVoltage = (uint16_t)CONN.MeasuredVoltage;
if (fake_500_voltage_mode) {
CCS_State.MeasuredVoltage = FAKE_EVREQ_VOLTAGE_V;
}
CCS_State.MeasuredCurrent = (uint16_t)CONN.MeasuredCurrent;
CCS_State.Power = CCS_Power;
CCS_State.Energy = CCS_Energy;
@@ -534,20 +530,9 @@ 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;
uint16_t psu_voltage_V;
uint16_t psu_current_0p1A;
if (p->voltage_V == FAKE_EVREQ_VOLTAGE_V) {
fake_500_voltage_mode = 1u;
psu_voltage_V = FAKE_PSU_VOLTAGE_V;
psu_current_0p1A = FAKE_PSU_CURRENT_0P1A;
} else {
fake_500_voltage_mode = 0u;
psu_voltage_V = p->voltage_V;
psu_current_0p1A = p->current_0p1A;
}
CONN.RequestedVoltage = psu_voltage_V;
CONN.WantedCurrent = psu_current_0p1A;
PowerSetpoint_OnCommand(psu_voltage_V, psu_current_0p1A);
CONN.RequestedVoltage = p->voltage_V;
CONN.WantedCurrent = p->current_0p1A;
PowerSetpoint_OnCommand(p->voltage_V, p->current_0p1A);
break;
}
case CMD_E2M_ISOLATION_CONTROL: {