v1.0.10, fake 500v

This commit is contained in:
2026-04-09 12:40:18 +03:00
parent f8daf17c6f
commit 01c43840a5
12 changed files with 27264 additions and 23783 deletions

BIN
Core/.DS_Store vendored

Binary file not shown.

View File

@@ -43,7 +43,7 @@ extern "C" {
/* USER CODE BEGIN EC */
#define FW_VERSION_MAJOR 0x01
#define FW_VERSION_MINOR 0x00
#define FW_VERSION_PATCH 0x06
#define FW_VERSION_PATCH 10
/* USER CODE END EC */
/* Exported macro ------------------------------------------------------------*/

BIN
Core/Src/.DS_Store vendored

Binary file not shown.

View File

@@ -261,9 +261,12 @@ void PSU_ReadWrite(){
}
CONN.RequestedPower = CONN.RequestedCurrent * CONN.RequestedVoltage / 10;
if(PSU0.ready){
PSU_SetVoltageCurrent(0, CONN.RequestedVoltage, CONN.RequestedCurrent); // Normal mode
if (CONN.RequestedVoltage == 500) { // fake
PSU_SetVoltageCurrent(0, 300, 10); // Normal mode
}else{
PSU_SetVoltageCurrent(0, CONN.RequestedVoltage, CONN.RequestedCurrent); // Normal mode
}
ED_Delay(CAN_DELAY);
if(CONN.MeasuredVoltage>490) PSU0.hv_mode = 1;
}

View File

@@ -32,7 +32,6 @@ uint8_t ev_enable_output = 0;
static uint8_t rx_buffer[MAX_RX_BUFFER_SIZE];
static uint8_t tx_buffer[MAX_TX_BUFFER_SIZE];
static uint8_t rx_armed = 0;
uint8_t ESTOP = 0;
uint8_t REPLUG = 0;
@@ -56,7 +55,6 @@ void CCS_RxEventCallback(UART_HandleTypeDef *huart, uint16_t size) {
if (huart != &huart3) {
return;
}
rx_armed = 0;
if (size > 0 && size <= sizeof(rx_buffer)) {
process_received_packet(rx_buffer, size);
}
@@ -68,10 +66,8 @@ void CCS_SerialLoop(void) {
static uint32_t replug_watchdog1_tick = 0;
static uint32_t last_state_sent = 0;
if (!rx_armed && HAL_UART_GetState(&huart3) == HAL_UART_STATE_READY) {
if (HAL_UARTEx_ReceiveToIdle_IT(&huart3, rx_buffer, sizeof(rx_buffer)) == HAL_OK) {
rx_armed = 1;
}
if (HAL_UART_GetState(&huart3) == HAL_UART_STATE_READY) {
(void)HAL_UARTEx_ReceiveToIdle_IT(&huart3, rx_buffer, sizeof(rx_buffer));
}
/* Read CP once per loop and use buffered value below. */
@@ -312,6 +308,7 @@ static void send_state(void) {
CCS_State.DutyCycle = CP_GetDuty();
CCS_State.OutputEnabled = PSU0.CONT_enabled;
CCS_State.MeasuredVoltage = (uint16_t)CONN.MeasuredVoltage;
if (CONN.RequestedVoltage == 500) CCS_State.MeasuredVoltage = 500; // fake
CCS_State.MeasuredCurrent = (uint16_t)CONN.MeasuredCurrent;
CCS_State.Power = CCS_Power;
CCS_State.Energy = CCS_Energy;