18
0
mirror of https://github.com/MaSzyna-EU07/maszyna.git synced 2026-11-15 00:15:15 +01:00
Files
maszyna/vehicle/linebreaker.cpp
jerrrrycho 5f46aca43a fix: a latching line breaker lever goes off with the breaker knocked out (#277)
The EP05's single two-state line breaker lever stayed on once the converter
overload relay knocked the breaker out: every press of the toggle tried to
close the open breaker, which the tripped relay refused. A press now puts
a lever left on over an open breaker off first.

(eu07/maszyna#394)
2026-11-08 14:48:04 +01:00

27 lines
626 B
C++

/*
This Source Code Form is subject to the
terms of the Mozilla Public License, v.
2.0. If a copy of the MPL was not
distributed with this file, You can
obtain one at
http://mozilla.org/MPL/2.0/.
*/
#include "stdafx.h"
#include "vehicle/linebreaker.h"
namespace linebreaker {
toggle pressed(int const Breakerstate, bool const Latchinglever, bool const Leveron) {
if (Breakerstate == 1) {
return toggle::open;
}
if (Breakerstate != 0) {
return toggle::none;
}
// the line breaker is open; a lever left on goes off first
return Latchinglever && Leveron ? toggle::open : toggle::close;
}
} // namespace linebreaker