Mattzobricks / MattzoControllers

MattzoController firmware
19 stars 8 forks source link

MCT4BT: ebreak always has to come through! #33

Closed Hilbert70 closed 1 year ago

Hilbert70 commented 1 year ago

Do not check for AllHubsCOnnected, we should change it to: ForAllHubsConnected....

void BLELocomotive::SetEmergencyBrake(const bool enabled)
{
    if (!AllHubsConnected()) {
        // Ignore e-brake command (we're not driving anyway).
        return;
    }

    // Handle e-brake on all channels of our hubs.
    for (BLEHub *hub : Hubs) {
        hub->EmergencyBrake(enabled);
    }
}
Hilbert70 commented 1 year ago

Could be fixes by changing the function into:

void BLELocomotive::SetEmergencyBrake(const bool enabled)
{
    // Handle e-brake on all channels of our hubs.
    for (BLEHub *hub : Hubs) {
        if (hub->IsConnected()) hub->EmergencyBrake(enabled);
    }
}

But after a reconnect one should check if the other hubs have the ebreak enabled

raymondbrink commented 1 year ago

This is fixed with #20.

raymondbrink commented 1 year ago

@Hilbert70 #20 was resolved and merged into develop just before X-mas. Would you mind checking if this is resolved now?

Mattzobricks commented 1 year ago

Successfully tested.

Test:

Works as expected.

Closing issue.