renamed trackPowerOff to powerOn (inverts value!)

Dieser Commit ist enthalten in:
Reinder Feenstra 2021-04-06 22:55:47 +02:00
Ursprung 1b64fd275e
Commit cc79919789
18 geänderte Dateien mit 63 neuen und 63 gelöschten Zeilen

Datei anzeigen

@ -36,7 +36,7 @@ CommandStation::CommandStation(const std::weak_ptr<World>& world, std::string_vi
[this](bool value)
{
emergencyStop.setAttributeEnabled(value);
trackVoltageOff.setAttributeEnabled(value);
powerOn.setAttributeEnabled(value);
},
std::bind(&CommandStation::setOnline, this, std::placeholders::_1)},
//status{this, "status", CommandStationStatus::Offline, PropertyFlags::ReadOnly},
@ -45,10 +45,10 @@ CommandStation::CommandStation(const std::weak_ptr<World>& world, std::string_vi
{
emergencyStopChanged(value);
}},
trackVoltageOff{this, "track_voltage_off", true, PropertyFlags::ReadWrite | PropertyFlags::NoStore,
powerOn{this, "power_on", false, PropertyFlags::ReadWrite | PropertyFlags::NoStore,
[this](bool value)
{
trackVoltageOffChanged(value);
powerOnChanged(value);
}},
decoders{this, "decoders", nullptr, PropertyFlags::ReadOnly | PropertyFlags::Store | PropertyFlags::SubObject},
controllers{this, "controllers", nullptr, PropertyFlags::ReadOnly | PropertyFlags::Store | PropertyFlags::SubObject},
@ -69,9 +69,9 @@ CommandStation::CommandStation(const std::weak_ptr<World>& world, std::string_vi
Attributes::addObjectEditor(emergencyStop, false);
m_interfaceItems.insertBefore(emergencyStop, notes);
Attributes::addEnabled(trackVoltageOff, online);
Attributes::addObjectEditor(trackVoltageOff, false);
m_interfaceItems.insertBefore(trackVoltageOff, notes);
Attributes::addEnabled(powerOn, online);
Attributes::addObjectEditor(powerOn, false);
m_interfaceItems.insertBefore(powerOn, notes);
m_interfaceItems.add(decoders);
@ -107,11 +107,11 @@ void CommandStation::worldEvent(WorldState state, WorldEvent event)
break;
case WorldEvent::PowerOff:
trackVoltageOff = true;
powerOn = false;
break;
case WorldEvent::PowerOn:
trackVoltageOff = false;
powerOn = true;
break;
case WorldEvent::Stop:
@ -145,10 +145,10 @@ void CommandStation::emergencyStopChanged(bool value)
controller->emergencyStopChanged(value);
}
void CommandStation::trackVoltageOffChanged(bool value)
void CommandStation::powerOnChanged(bool value)
{
for(auto& controller : *controllers)
controller->trackPowerChanged(!value);
controller->powerOnChanged(value);
}
void CommandStation::decoderChanged(const Decoder& decoder, DecoderChangeFlags changes, uint32_t functionNumber)

Datei anzeigen

@ -3,7 +3,7 @@
*
* This file is part of the traintastic source code.
*
* Copyright (C) 2019-2020 Reinder Feenstra
* Copyright (C) 2019-2021 Reinder Feenstra
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
@ -42,7 +42,7 @@ class CommandStation : public IdObject
virtual bool setOnline(bool& value) = 0;
virtual void emergencyStopChanged(bool value);
virtual void trackVoltageOffChanged(bool value);
virtual void powerOnChanged(bool value);
//virtual bool isDecoderSupported(Decoder& decoder) const = 0;
virtual void decoderChanged(const Decoder& decoder, DecoderChangeFlags changes, uint32_t functionNumber);
@ -52,7 +52,7 @@ class CommandStation : public IdObject
Property<std::string> name;
Property<bool> online;
Property<bool> emergencyStop;
Property<bool> trackVoltageOff;
Property<bool> powerOn;
ObjectProperty<DecoderList> decoders;
ObjectProperty<ControllerList> controllers;
Property<std::string> notes;

Datei anzeigen

@ -3,7 +3,7 @@
*
* This file is part of the traintastic source code
*
* Copyright (C) 2019-2020 Reinder Feenstra
* Copyright (C) 2019-2021 Reinder Feenstra
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
@ -72,7 +72,7 @@ std::string CommandStationListTableModel::getText(uint32_t column, uint32_t row)
return cs.emergencyStop ? "\u2022" : "";
case columnTrackPower:
return cs.trackVoltageOff ? UTF8_BALLOT_X : UTF8_CHECKMARK;
return cs.powerOn ? UTF8_CHECKMARK : UTF8_BALLOT_X;
default:
assert(false);

Datei anzeigen

@ -3,7 +3,7 @@
*
* This file is part of the traintastic source code
*
* Copyright (C) 2019-2020 Reinder Feenstra <reinderfeenstra@gmail.com>
* Copyright (C) 2019-2021 Reinder Feenstra <reinderfeenstra@gmail.com>
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
@ -65,12 +65,12 @@ void LocoNetSerial::emergencyStopChanged(bool value)
loconet->emergencyStopChanged(value);
}
void LocoNetSerial::trackVoltageOffChanged(bool value)
void LocoNetSerial::powerOnChanged(bool value)
{
CommandStation::trackVoltageOffChanged(value);
CommandStation::powerOnChanged(value);
if(online)
loconet->trackVoltageOffChanged(value);
loconet->powerOnChanged(value);
}
void LocoNetSerial::decoderChanged(const Decoder& decoder, DecoderChangeFlags changes, uint32_t functionNumber)

Datei anzeigen

@ -31,7 +31,7 @@ class LocoNetSerial : public SerialCommandStation
{
protected:
void emergencyStopChanged(bool value) final;
void trackVoltageOffChanged(bool value) final;
void powerOnChanged(bool value) final;
void decoderChanged(const Decoder& decoder, DecoderChangeFlags changes, uint32_t functionNumber) final;
bool start();

Datei anzeigen

@ -1,9 +1,9 @@
/**
* hardware/commandstation/z21.cpp
* server/src/hardware/commandstation/rocoz21.cpp
*
* This file is part of the traintastic source code
*
* Copyright (C) 2019-2020 Reinder Feenstra <reinderfeenstra@gmail.com>
* Copyright (C) 2019-2021 Reinder Feenstra <reinderfeenstra@gmail.com>
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
@ -131,14 +131,14 @@ void RocoZ21::emergencyStopChanged(bool value)
send(Z21::LanXSetStop());
}
void RocoZ21::trackVoltageOffChanged(bool value)
void RocoZ21::powerOnChanged(bool value)
{
if(online)
{
if(value)
send(Z21::LanXSetTrackPowerOff());
else
send(Z21::LanXSetTrackPowerOn());
else
send(Z21::LanXSetTrackPowerOff());
}
}

Datei anzeigen

@ -1,9 +1,9 @@
/**
* server/src/hardware/commandstation/z21.hpp
* server/src/hardware/commandstation/rocoz21.hpp
*
* This file is part of the traintastic source code.
*
* Copyright (C) 2019-2020 Reinder Feenstra
* Copyright (C) 2019-2021 Reinder Feenstra
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
@ -45,7 +45,7 @@ class RocoZ21 : public CommandStation
bool setOnline(bool& value) final;
//bool isDecoderSupported(Decoder& decoder) const final;
void emergencyStopChanged(bool value) final;
void trackVoltageOffChanged(bool value) final;
void powerOnChanged(bool value) final;
void decoderChanged(const Decoder& decoder, DecoderChangeFlags changes, uint32_t functionNumber) final;
void receive();

Datei anzeigen

@ -1,7 +1,7 @@
/**
* Traintastic
* server/src/hardware/commandstation/usbxpressnetinterface.cpp
*
* Copyright (C) 2019-2020 Reinder Feenstra <reinderfeenstra@gmail.com>
* Copyright (C) 2019-2021 Reinder Feenstra <reinderfeenstra@gmail.com>
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
@ -87,7 +87,7 @@ void USBXpressNetInterface::emergencyStopChanged(bool value)
}
void USBXpressNetInterface::trackVoltageOffChanged(bool value)
void USBXpressNetInterface::powerOnChanged(bool value)
{
}

Datei anzeigen

@ -3,7 +3,7 @@
*
* This file is part of the traintastic source code.
*
* Copyright (C) 2019-2020 Reinder Feenstra
* Copyright (C) 2019-2021 Reinder Feenstra
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
@ -37,7 +37,7 @@ class USBXpressNetInterface : public CommandStation
bool setOnline(bool& value) final;
void emergencyStopChanged(bool value) final;
void trackVoltageOffChanged(bool value) final;
void powerOnChanged(bool value) final;
void decoderChanged(const Decoder& decoder, DecoderChangeFlags changes, uint32_t functionNumber) final;
bool send(const XpressNet::Message& msg);

Datei anzeigen

@ -101,12 +101,12 @@ void XpressNetSerial::emergencyStopChanged(bool value)
xpressnet->emergencyStopChanged(value);
}
void XpressNetSerial::trackVoltageOffChanged(bool value)
void XpressNetSerial::powerOnChanged(bool value)
{
CommandStation::trackVoltageOffChanged(value);
CommandStation::powerOnChanged(value);
if(online)
xpressnet->trackVoltageOffChanged(value);
xpressnet->powerOnChanged(value);
}
void XpressNetSerial::decoderChanged(const Decoder& decoder, DecoderChangeFlags changes, uint32_t functionNumber)

Datei anzeigen

@ -38,7 +38,7 @@ class XpressNetSerial : public SerialCommandStation
void worldEvent(WorldState state, WorldEvent event) final;
void emergencyStopChanged(bool value) final;
void trackVoltageOffChanged(bool value) final;
void powerOnChanged(bool value) final;
void decoderChanged(const Decoder& decoder, DecoderChangeFlags changes, uint32_t functionNumber) final;
bool send(const XpressNet::Message& msg);

Datei anzeigen

@ -3,7 +3,7 @@
*
* This file is part of the traintastic source code.
*
* Copyright (C) 2019-2020 Reinder Feenstra
* Copyright (C) 2019-2021 Reinder Feenstra
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
@ -43,7 +43,7 @@ class Controller : public IdObject
virtual bool setActive(bool& value) = 0;
virtual void emergencyStopChanged(bool value) = 0;
virtual void trackPowerChanged(bool value) = 0;
virtual void powerOnChanged(bool value) = 0;
virtual void decoderChanged(const Decoder& decoder, DecoderChangeFlags changes, uint32_t functionNumber) = 0;
public:

Datei anzeigen

@ -3,7 +3,7 @@
*
* This file is part of the traintastic source code.
*
* Copyright (C) 2019-2020 Reinder Feenstra
* Copyright (C) 2019-2021 Reinder Feenstra
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
@ -94,7 +94,7 @@ void WLANmaus::emergencyStopChanged(bool value)
if(it.second.broadcastFlags & Z21::PowerLocoTurnout)
sendTo(Z21::LanXBCStopped(), it.first);
}
else if(commandStation && !commandStation->trackVoltageOff) // send z21_lan_x_bc_track_power_on if power is on
else if(commandStation && commandStation->powerOn) // send z21_lan_x_bc_track_power_on if power is on
{
for(auto it : m_clients)
if(it.second.broadcastFlags & Z21::PowerLocoTurnout)
@ -102,7 +102,7 @@ void WLANmaus::emergencyStopChanged(bool value)
}
}
void WLANmaus::trackPowerChanged(bool value)
void WLANmaus::powerOnChanged(bool value)
{
if(value)
{
@ -169,7 +169,7 @@ void WLANmaus::receive()
if(!commandStation || commandStation->emergencyStop)
response.db1 |= Z21_CENTRALSTATE_EMERGENCYSTOP;
if(!commandStation || commandStation->trackVoltageOff)
if(!commandStation || !commandStation->powerOn)
response.db1 |= Z21_CENTRALSTATE_TRACKVOLTAGEOFF;
response.calcChecksum();
@ -185,8 +185,8 @@ void WLANmaus::receive()
if(commandStation)
{
commandStation->emergencyStop = false;
commandStation->trackVoltageOff = false;
if(!commandStation->trackVoltageOff)
commandStation->powerOn = true;
if(commandStation->powerOn)
sendTo(Z21::LanXBCTrackPowerOn(), endpoint);
}
});
@ -198,8 +198,8 @@ void WLANmaus::receive()
{
if(commandStation)
{
commandStation->trackVoltageOff = true;
if(commandStation->trackVoltageOff)
commandStation->powerOn = false;
if(!commandStation->powerOn)
sendTo(Z21::LanXBCTrackPowerOff(), endpoint);
}
});
@ -411,7 +411,7 @@ void WLANmaus::receive()
if(!commandStation || commandStation->emergencyStop)
response.centralState |= Z21_CENTRALSTATE_EMERGENCYSTOP;
if(!commandStation || commandStation->trackVoltageOff)
if(!commandStation || !commandStation->powerOn)
response.centralState |= Z21_CENTRALSTATE_TRACKVOLTAGEOFF;
sendTo(response, endpoint);

Datei anzeigen

@ -3,7 +3,7 @@
*
* This file is part of the traintastic source code.
*
* Copyright (C) 2019-2020 Reinder Feenstra
* Copyright (C) 2019-2021 Reinder Feenstra
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
@ -62,7 +62,7 @@ class WLANmaus : public Controller
bool setActive(bool& value) final;
void emergencyStopChanged(bool value) final;
void trackPowerChanged(bool value) final;
void powerOnChanged(bool value) final;
void decoderChanged(const Decoder& decoder, DecoderChangeFlags, uint32_t) final;
void receive();

Datei anzeigen

@ -147,7 +147,7 @@ void LocoNet::receive(const Message& message)
if(m_commandStation)
{
m_commandStation->emergencyStop.setValueInternal(false);
m_commandStation->trackVoltageOff.setValueInternal(false);
m_commandStation->powerOn.setValueInternal(true);
}
});
break;
@ -157,7 +157,7 @@ void LocoNet::receive(const Message& message)
[this]()
{
if(m_commandStation)
m_commandStation->trackVoltageOff.setValueInternal(true);
m_commandStation->powerOn.setValueInternal(false);
});
break;
@ -294,13 +294,13 @@ void LocoNet::emergencyStopChanged(bool value)
{
if(value)
send(Idle());
else if(m_commandStation && !m_commandStation->trackVoltageOff)
else if(m_commandStation && m_commandStation->powerOn)
send(GlobalPowerOn());
}
void LocoNet::trackVoltageOffChanged(bool value)
void LocoNet::powerOnChanged(bool value)
{
if(!value)
if(value)
send(GlobalPowerOn());
else
send(GlobalPowerOff());

Datei anzeigen

@ -3,7 +3,7 @@
*
* This file is part of the traintastic source code.
*
* Copyright (C) 2019-2020 Reinder Feenstra
* Copyright (C) 2019-2021 Reinder Feenstra
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
@ -153,7 +153,7 @@ class LocoNet : public SubObject
void receive(const Message& message);
void emergencyStopChanged(bool value);
void trackVoltageOffChanged(bool value);
void powerOnChanged(bool value);
void decoderChanged(const Decoder& decoder, DecoderChangeFlags changes, uint32_t functionNumber);
void queryLocoSlots();

Datei anzeigen

@ -154,7 +154,7 @@ void XpressNet::receive(const Message& message)
[cs=m_commandStation->shared_ptr<CommandStation>()]()
{
cs->emergencyStop.setValueInternal(false);
cs->trackVoltageOff.setValueInternal(false);
cs->powerOn.setValueInternal(true);
});
}
else if(message == TrackPowerOff())
@ -162,7 +162,7 @@ void XpressNet::receive(const Message& message)
EventLoop::call(
[cs=m_commandStation->shared_ptr<CommandStation>()]()
{
cs->trackVoltageOff.setValueInternal(true);
cs->powerOn.setValueInternal(false);
});
}
break;
@ -185,13 +185,13 @@ void XpressNet::emergencyStopChanged(bool value)
{
if(value)
send(EmergencyStop());
else if(m_commandStation && !m_commandStation->trackVoltageOff)
else if(m_commandStation && m_commandStation->powerOn)
send(NormalOperationResumed());
}
void XpressNet::trackVoltageOffChanged(bool value)
void XpressNet::powerOnChanged(bool value)
{
if(!value)
if(value)
send(NormalOperationResumed());
else
send(TrackPowerOff());

Datei anzeigen

@ -69,7 +69,7 @@ class XpressNet : public SubObject
void receive(const Message& msg);
void emergencyStopChanged(bool value);
void trackVoltageOffChanged(bool value);
void powerOnChanged(bool value);
void decoderChanged(const Decoder& decoder, DecoderChangeFlags changes, uint32_t functionNumber);
[[nodiscard]] bool isInputAddressAvailable(uint16_t address) const;