mirror of
https://github.com/MaSzyna-EU07/maszyna.git
synced 2026-10-17 12:09:19 +02:00
hardware protocol v2: configuration, wiring and debug panel
Adds the WITH_HARDWARE_PROTOCOL_V2 build option and the eu07.ini entries which configure it: uart2 declares a serial link and may be repeated for several controllers, the remaining uart2* entries tune frame size, heartbeat, rate limits and logging. UART v1 is untouched and both may be active at the same time on different ports. The driver mode starts the manager when at least one link is configured and pumps it from the input polling loop, and the debug panel gains a Hardware Protocol v2 section reporting link and session condition, packet rates, round trip time, protocol and transport error counters and whatever diagnostics the device itself reports, with switches for protocol and frame logging.
This commit is contained in:
@@ -182,7 +182,7 @@ void protocol_session::send( message_type const Type, std::uint8_t const Flags,
|
||||
++m_diagnostics.tx_frames;
|
||||
m_txrate.add();
|
||||
|
||||
if( true == m_config.debug_frames )
|
||||
if( true == debug_flags.log_frames )
|
||||
{
|
||||
WriteLog( "hardware: tx " + std::string( to_string( Type ) ) + ", " + std::to_string( Payload.size() ) + " bytes" );
|
||||
}
|
||||
@@ -206,7 +206,7 @@ void protocol_session::send_nack( std::uint32_t const Transaction, message_type
|
||||
send( message_type::nack, packetflag_response | packetflag_error, writer );
|
||||
++m_diagnostics.nacks;
|
||||
|
||||
if( true == m_config.debug )
|
||||
if( true == debug_flags.log_messages )
|
||||
{
|
||||
WriteLog( "hardware: nack " + std::string( to_string( Type ) ) + ", " + std::string( to_string( Error ) ) );
|
||||
}
|
||||
@@ -318,7 +318,7 @@ void protocol_session::handle_packet( decoded_packet const &Packet )
|
||||
m_lastreceivedsequence = Packet.header.sequence;
|
||||
m_sequenceseen = true;
|
||||
|
||||
if( true == m_config.debug_frames )
|
||||
if( true == debug_flags.log_frames )
|
||||
{
|
||||
WriteLog( "hardware: rx " + std::string( to_string( Packet.header.type ) ) + ", " + std::to_string( Packet.payload.size() ) + " bytes" );
|
||||
}
|
||||
@@ -366,7 +366,7 @@ void protocol_session::handle_packet( decoded_packet const &Packet )
|
||||
|
||||
case message_type::device_ready:
|
||||
m_state = session_state::ready;
|
||||
if( true == m_config.debug )
|
||||
if( true == debug_flags.log_messages )
|
||||
{
|
||||
WriteLog( "hardware: device '" + m_devicename + "' is ready" );
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user