mirror of https://github.com/rusefi/wideband.git
Can magic constants (#26)
* CAN api * CAN api * CAN api * CAN api Co-authored-by: rusefillc <sdfsdfqsf2334234234>
This commit is contained in:
parent
3146bac645
commit
28ac0c61f0
|
@ -30,7 +30,7 @@ static void SendAck()
|
||||||
CANTxFrame frame;
|
CANTxFrame frame;
|
||||||
|
|
||||||
frame.IDE = CAN_IDE_EXT;
|
frame.IDE = CAN_IDE_EXT;
|
||||||
frame.EID = 0x727573; // ascii "rus"
|
frame.EID = WB_ACK;
|
||||||
frame.RTR = CAN_RTR_DATA;
|
frame.RTR = CAN_RTR_DATA;
|
||||||
frame.DLC = 0;
|
frame.DLC = 0;
|
||||||
|
|
||||||
|
@ -57,7 +57,7 @@ void CanRxThread(void*)
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (frame.DLC == 2 && frame.EID == 0xEF5'0000) {
|
if (frame.DLC == 2 && frame.EID == WB_MGS_ECU_STATUS) {
|
||||||
// This is status from ECU - battery voltage and heater enable signal
|
// This is status from ECU - battery voltage and heater enable signal
|
||||||
|
|
||||||
// data0 contains battery voltage in tenths of a volt
|
// data0 contains battery voltage in tenths of a volt
|
||||||
|
@ -69,7 +69,7 @@ void CanRxThread(void*)
|
||||||
SetHeaterAllowed(heaterAllowed);
|
SetHeaterAllowed(heaterAllowed);
|
||||||
}
|
}
|
||||||
// If it's a bootloader entry request, reboot to the bootloader!
|
// If it's a bootloader entry request, reboot to the bootloader!
|
||||||
else if (frame.DLC == 0 && frame.EID == 0xEF0'0000)
|
else if (frame.DLC == 0 && frame.EID == WB_BL_ENTER)
|
||||||
{
|
{
|
||||||
SendAck();
|
SendAck();
|
||||||
|
|
||||||
|
@ -79,7 +79,7 @@ void CanRxThread(void*)
|
||||||
NVIC_SystemReset();
|
NVIC_SystemReset();
|
||||||
}
|
}
|
||||||
// Check if it's an "index set" message
|
// Check if it's an "index set" message
|
||||||
else if (frame.DLC == 1 && frame.EID == 0xEF4'0000)
|
else if (frame.DLC == 1 && frame.EID == WB_MSG_SET_INDEX)
|
||||||
{
|
{
|
||||||
auto newCfg = GetConfiguration();
|
auto newCfg = GetConfiguration();
|
||||||
newCfg.CanIndexOffset = frame.data8[0];
|
newCfg.CanIndexOffset = frame.data8[0];
|
||||||
|
|
|
@ -2,6 +2,12 @@
|
||||||
|
|
||||||
#define RUSEFI_WIDEBAND_VERSION (0xA0)
|
#define RUSEFI_WIDEBAND_VERSION (0xA0)
|
||||||
|
|
||||||
|
// ascii "rus"
|
||||||
|
#define WB_ACK 0x727573
|
||||||
|
#define WB_BL_ENTER 0xEF0'0000
|
||||||
|
#define WB_MSG_SET_INDEX 0xEF4'0000
|
||||||
|
#define WB_MGS_ECU_STATUS 0xEF5'0000
|
||||||
|
|
||||||
namespace wbo
|
namespace wbo
|
||||||
{
|
{
|
||||||
struct StandardData
|
struct StandardData
|
||||||
|
|
Loading…
Reference in New Issue