Prepared for LUT downloading, IrDASerialPort changed

This commit is contained in:
Thomas Wiedebusch
2022-03-02 14:24:47 +01:00
parent 835f242d95
commit 14eda41bdd
24 changed files with 2086 additions and 358 deletions
@@ -630,6 +630,11 @@ namespace Xylem.Common.Hardware.Interfaces.Ports.SerialPorts
/// <remarks date="2018-Oct-23" author="T.Wiedebusch">
/// - Doubling of sync byte in protocol behind sync byte itself implemented
/// </remarks>
/// <remarks date="2022-Feb-25" author="T.Wiedebusch">
/// - RTS signal trial as MOXA sometimes takes two messages and combines these two one!
/// As the Genesis needs a separated wake-up message with a following delay before the
/// real payload message, this causes a lot of trouble.
/// </remarks>
protected void PhysicalWrite(Byte[] txBuffer)
{
try
@@ -649,7 +654,11 @@ namespace Xylem.Common.Hardware.Interfaces.Ports.SerialPorts
}
}
}
_serialPort.RtsEnable = true;
_serialPort.Write(txByteList.ToArray(), 0, txByteList.Count);
_serialPort.RtsEnable = false;
OnRawRecordSendOut?.Invoke(this, new ListBytePortDataEventArgs(txByteList, DateTimeOffset.UtcNow));
}
@@ -22,15 +22,22 @@ namespace Xylem.Common.Hardware.Interfaces.Ports.SerialPorts
/// - wakeup burst pattern changed from 2 times 0xF0 to 4 times 0x01,
/// - required delay from 500µs to 1ms between wakeup burst and data.
/// </remarks>
/// <remarks date="2022-Mar-03" author="T.Wiedebusch">
/// - Generated the required delay with an 8 Byte pattern, as MOXA interface collects data
/// and sends it in one burst, meaning it sends the wake up and payload without delay.
/// So including a pattern instead will force this delay. At 115.200 kBit/s a Byte of 8 Bit
/// one start and one stop step resulting in 10 bits with a Byte length of 86.8 µs. An 8
/// Byte pattern will generate a 694 µs delay.
/// </remarks>
protected override void SpecificPortWrite(Byte[] tx)
{
//send wake up burst with two 0xF0 byte
//var wakeUpBurst = new Byte[] { 0xF0, 0xF0 };
//send wake up burst
var wakeUpBurst = new Byte[] { 0x01, 0x01, 0x01, 0x01 };
PhysicalWrite(wakeUpBurst);
//delay at least 1ms
Thread.Sleep(1);
//delay at least 500 µs
var delayPattern = new Byte[] { 0x0F, 0x0F, 0x0F, 0x0F, 0x0F, 0x0F, 0x0F, 0x0F };
PhysicalWrite(delayPattern);
//send the IrDA record
PhysicalWrite(tx);