[loconet] extened loco slot read/write log data

Dieser Commit ist enthalten in:
Reinder Feenstra 2025-12-22 15:22:13 +01:00
Ursprung a5db20c3b8
Commit 42015e2064
2 geänderte Dateien mit 48 neuen und 1 gelöschten Zeilen

Datei anzeigen

@ -432,7 +432,42 @@ std::string toString(const Message& message)
case OPC_WR_SL_DATA:
{
const auto& slotData = static_cast<const SlotDataBase&>(message);
if(slotData.slot == SLOT_FAST_CLOCK)
if(slotData.slot >= SLOT_LOCO_MIN && slotData.slot <= SLOT_LOCO_MAX)
{
const auto& locoSlot = static_cast<const SlotReadData&>(message);
s.append(" slot=").append(std::to_string(locoSlot.slot));
if(locoSlot.isFree())
{
s.append(" free");
}
else
{
if(locoSlot.isActive())
{
s.append(" active");
}
if(locoSlot.isBusy())
{
s.append(" busy");
}
s.append(" address=").append(std::to_string(locoSlot.address()));
if(locoSlot.isEmergencyStop())
{
s.append(" speed=estop");
}
else
{
s.append(" speed=").append(std::to_string(locoSlot.speed()));
}
s.append(" dir=").append(locoSlot.direction() == Direction::Forward ? "fwd" : "rev");
for(uint8_t fn = 0; fn <= 8; ++fn)
{
s.append(" f").append(std::to_string(fn)).append(locoSlot.f(fn) ? "=on" : "=off");
}
s.append(" id=").append(std::to_string(locoSlot.id()));
}
}
else if(slotData.slot == SLOT_FAST_CLOCK)
{
const auto& fastClock = static_cast<const FastClockSlotData&>(message);
s.append(" slot=fastclock");

Datei anzeigen

@ -1263,6 +1263,18 @@ struct SlotReadData : SlotReadDataBase
else
snd &= ~SL_F8;
}
uint16_t id() const
{
return (static_cast<uint16_t>(id2) << 7) | id1;
}
void setId(uint16_t value)
{
assert(value <= 0x3FFF);
id2 = (value >> 7) & 0x7F;
id1 = value & 0x7F;
}
};
static_assert(sizeof(SlotReadData) == 14);