mirror of https://github.com/rusefi/wideband.git
only reboot one controller at a time
This commit is contained in:
parent
a4eb0f7e74
commit
0bbc32104d
|
@ -111,7 +111,7 @@ Configuration* GetConfiguration()
|
||||||
auto sel1 = readSelPin(ID_SEL1_PORT, ID_SEL1_PIN);
|
auto sel1 = readSelPin(ID_SEL1_PORT, ID_SEL1_PIN);
|
||||||
auto sel2 = readSelPin(ID_SEL2_PORT, ID_SEL2_PIN);
|
auto sel2 = readSelPin(ID_SEL2_PORT, ID_SEL2_PIN);
|
||||||
|
|
||||||
// See https://github.com/mck1117/wideband/issues/11
|
// See https://github.com/mck1117/wideband/issues/11 to explain this madness
|
||||||
switch (3 * sel1 + sel2) {
|
switch (3 * sel1 + sel2) {
|
||||||
case 0: c.CanIndexOffset = 2; break;
|
case 0: c.CanIndexOffset = 2; break;
|
||||||
case 1: c.CanIndexOffset = 0; break;
|
case 1: c.CanIndexOffset = 0; break;
|
||||||
|
|
|
@ -94,14 +94,18 @@ void CanRxThread(void*)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// 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 == WB_BL_ENTER)
|
else if (frame.DLC == 1 && frame.EID == WB_BL_ENTER)
|
||||||
{
|
{
|
||||||
SendAck();
|
// If 0xFF (force update all) or our ID, reset to bootloader, otherwise ignore
|
||||||
|
if (frame.data8[0] == 0xFF || frame.data8[0] == GetConfiguration()->CanIndexOffset)
|
||||||
|
{
|
||||||
|
SendAck();
|
||||||
|
|
||||||
// Let the message get out before we reset the chip
|
// Let the message get out before we reset the chip
|
||||||
chThdSleep(50);
|
chThdSleep(50);
|
||||||
|
|
||||||
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 == WB_MSG_SET_INDEX)
|
else if (frame.DLC == 1 && frame.EID == WB_MSG_SET_INDEX)
|
||||||
|
|
Loading…
Reference in New Issue