Mirror TSActive on RSD. Don't do anything else.

This commit is contained in:
Jasper Blanckenburg 2024-07-11 22:16:07 +02:00
parent 1cbfd28288
commit 4a7b54acd2
4 changed files with 103 additions and 85 deletions

View File

@ -10,7 +10,8 @@
#include "stm32h7xx_hal.h"
#define CAN_ID_AMS_STATUS 0x00A
#define CAN_ID_AMS_IN 0x00B
#define CAN_ID_SLAVE_STATUS_BASE 0x080
#define CAN_ID_CHARGER_ACTIVE 0x200

View File

@ -10,6 +10,8 @@
#include "can-halal.h"
#include "slave_handler.h"
#include "b_cccv_algo.h"
#include "charger_control.h"
void initCan(FDCAN_HandleTypeDef *hcan)
{
@ -20,11 +22,11 @@ void initCan(FDCAN_HandleTypeDef *hcan)
void ftcan_msg_received_cb(uint16_t id, size_t datalen, const uint8_t *data)
{
if ((id & 0xFF0) == CAN_ID_SLAVE_STATUS_BASE) {
slaves_handle_status(data);
// slaves_handle_status(data);
return;
}
if (id == CAN_ID_CHARGER_ACTIVE)
/*if (id == CAN_ID_CHARGER_ACTIVE)
{
if(data[0] == 1)
{
@ -36,5 +38,20 @@ void ftcan_msg_received_cb(uint16_t id, size_t datalen, const uint8_t *data)
stopcharging();
}
return;
}*/
switch (id) {
case CAN_ID_AMS_STATUS: {
int sdc_closed = data[0] >> 7;
if (sdc_closed == 0) {
charger_control_disable_remote();
}
break;
}
case CAN_ID_AMS_IN: {
int active = data[0] & 0x01;
if (active) {
charger_control_enable_remote();
}
}
}
}

View File

@ -155,12 +155,12 @@ int main(void)
if((HAL_GetTick() - lasttick) > 1000)
{
float maxvoltage = slaves_get_maximum_voltage();
lasttick = HAL_GetTick();
chargingloop(slaves_get_maximum_voltage());
// float maxvoltage = slaves_get_maximum_voltage();
// lasttick = HAL_GetTick();
// chargingloop(slaves_get_maximum_voltage());
HAL_GPIO_TogglePin(STATUS_LED_2_GPIO_Port, STATUS_LED_2_Pin);
}
// HAL_GPIO_TogglePin(STATUS_LED_2_GPIO_Port, STATUS_LED_2_Pin);
// HAL_Delay(500);
}
/* USER CODE END 3 */

View File

@ -36,7 +36,7 @@
<stringAttribute key="com.st.stm32cube.ide.mcu.debug.stlink.stlink_txt_serial_number" value=""/>
<stringAttribute key="com.st.stm32cube.ide.mcu.debug.stlink.watchdog_config" value="none"/>
<booleanAttribute key="com.st.stm32cube.ide.mcu.debug.stlinkenable_rtos" value="false"/>
<stringAttribute key="com.st.stm32cube.ide.mcu.debug.stlinkrestart_configurations" value="{&quot;fVersion&quot;:1,&quot;fItems&quot;:[{&quot;fDisplayName&quot;:&quot;Reset&quot;,&quot;fIsSuppressible&quot;:false,&quot;fResetAttribute&quot;:&quot;Software system reset&quot;,&quot;fResetStrategies&quot;:[{&quot;fDisplayName&quot;:&quot;Software system reset&quot;,&quot;fLaunchAttribute&quot;:&quot;system_reset&quot;,&quot;fGdbCommands&quot;:[&quot;monitor reset\r\n&quot;],&quot;fCmdOptions&quot;:[&quot;-g&quot;]},{&quot;fDisplayName&quot;:&quot;Hardware reset&quot;,&quot;fLaunchAttribute&quot;:&quot;hardware_reset&quot;,&quot;fGdbCommands&quot;:[&quot;monitor reset hardware\r\n&quot;],&quot;fCmdOptions&quot;:[&quot;-g&quot;]},{&quot;fDisplayName&quot;:&quot;Core reset&quot;,&quot;fLaunchAttribute&quot;:&quot;core_reset&quot;,&quot;fGdbCommands&quot;:[&quot;monitor reset core\r\n&quot;],&quot;fCmdOptions&quot;:[&quot;-g&quot;]},{&quot;fDisplayName&quot;:&quot;None&quot;,&quot;fLaunchAttribute&quot;:&quot;no_reset&quot;,&quot;fGdbCommands&quot;:[],&quot;fCmdOptions&quot;:[&quot;-g&quot;]}],&quot;fGdbCommandGroup&quot;:{&quot;name&quot;:&quot;Additional commands&quot;,&quot;commands&quot;:[]},&quot;fStartApplication&quot;:true}]}"/>
<stringAttribute key="com.st.stm32cube.ide.mcu.debug.stlinkrestart_configurations" value="{&quot;fVersion&quot;:1,&quot;fItems&quot;:[{&quot;fDisplayName&quot;:&quot;Reset&quot;,&quot;fIsSuppressible&quot;:false,&quot;fResetAttribute&quot;:&quot;Software system reset&quot;,&quot;fResetStrategies&quot;:[{&quot;fDisplayName&quot;:&quot;Software system reset&quot;,&quot;fLaunchAttribute&quot;:&quot;system_reset&quot;,&quot;fGdbCommands&quot;:[&quot;monitor reset\n&quot;],&quot;fCmdOptions&quot;:[&quot;-g&quot;]},{&quot;fDisplayName&quot;:&quot;Hardware reset&quot;,&quot;fLaunchAttribute&quot;:&quot;hardware_reset&quot;,&quot;fGdbCommands&quot;:[&quot;monitor reset hardware\n&quot;],&quot;fCmdOptions&quot;:[&quot;-g&quot;]},{&quot;fDisplayName&quot;:&quot;Core reset&quot;,&quot;fLaunchAttribute&quot;:&quot;core_reset&quot;,&quot;fGdbCommands&quot;:[&quot;monitor reset core\n&quot;],&quot;fCmdOptions&quot;:[&quot;-g&quot;]},{&quot;fDisplayName&quot;:&quot;None&quot;,&quot;fLaunchAttribute&quot;:&quot;no_reset&quot;,&quot;fGdbCommands&quot;:[],&quot;fCmdOptions&quot;:[&quot;-g&quot;]}],&quot;fGdbCommandGroup&quot;:{&quot;name&quot;:&quot;Additional commands&quot;,&quot;commands&quot;:[]},&quot;fStartApplication&quot;:true}]}"/>
<booleanAttribute key="com.st.stm32cube.ide.mcu.rtosproxy.enableRtosProxy" value="false"/>
<stringAttribute key="com.st.stm32cube.ide.mcu.rtosproxy.rtosProxyCustomProperties" value=""/>
<stringAttribute key="com.st.stm32cube.ide.mcu.rtosproxy.rtosProxyDriver" value="threadx"/>