Pause CAN broadcast on engine stop #3665

This commit is contained in:
rusefillc 2021-12-07 10:35:52 -05:00
parent 3b61714fa6
commit b778aa7173
3 changed files with 14 additions and 0 deletions

View File

@ -116,6 +116,11 @@ public:
// todo: technical debt: enableOverdwellProtection #3553
bool enableOverdwellProtection = true;
/**
* Sometimes for instance during shutdown we need to completely supress CAN TX
*/
bool allowCanTx = true;
// used by HW CI
bool isPwmEnabled = true;

View File

@ -496,6 +496,11 @@ void configureRusefiLuaHooks(lua_State* l) {
return 1;
});
lua_register(l, "enableCanTx", [](lua_State* l) {
engine->allowCanTx = lua_toboolean(l, 1);
return 0;
});
lua_register(l, "crc8_j1850", [](lua_State* l) {
uint8_t data[8];
uint32_t length = getArray(l, 1, data, sizeof(data));

View File

@ -53,6 +53,10 @@ CanTxMessage::~CanTxMessage() {
return;
}
if (!engine->allowCanTx) {
return;
}
if (engineConfiguration->verboseCan) {
efiPrintf("Sending CAN message: SID %x/%x %x %x %x %x %x %x %x %x", CAN_SID(m_frame), m_frame.DLC,
m_frame.data8[0], m_frame.data8[1],