From 78792b965a0d2b7759c94fa0ea7e148fdbd808e1 Mon Sep 17 00:00:00 2001 From: ilyacodes <33097525+ilyacodes@users.noreply.github.com> Date: Sat, 7 Oct 2023 10:48:44 -0400 Subject: [PATCH] Introduce and start using new SEND_BYTES command for improved performance (#8) * Support commands up to 512 bytes in length This is convenient for some larger CMD_SEND_BYTES payloads, but not strictly required. Since we have space in the Arduino memory, might as well use it. * Introduce new CMD_SEND_BYTES Create a new CMD_SEND_BYTES and corresponding response, which can be used to send multiple bytes in a single command. This reduces command/response overhead, especially for larger numbers of bytes. * Start using new CMD_SEND_BYTES from C# The previous commit introduced CMD_SEND_BYTES to the firmware, now let's start using it. This is done by adding a new function to use the command, and transitioning SendData(data) to use it. * Update copyrights * Add WRITE_TRANSFER_SPEED command Add support for a new command WRITE_TRANSFER_SPEED, which allows the independent setting of tx and rx transfer speeds in kilobaud. This is useful for some manufacturer-specific features such as high-speed keyloading. Currently not used by the software, being added for future use. * Fix one remaining version * Add version-based support for new commands We don't want to break backwards compatibility with the existing KFDshields using the current adapter protocol version, so add some feature flags that enable the new commands if the adapter FW has already been bumped up. This lets us gracefully fail to existing commands if the KFD hardware is still on old FW. --- LICENSE.txt | 1 + README.md | 1 + fw/ino/kfd-avr/ControlOpCodes.h | 5 + fw/ino/kfd-avr/SerialProtocol.cpp | 6 +- fw/ino/kfd-avr/TwiProtocol.cpp | 49 ++++- fw/ino/kfd-avr/TwiProtocol.h | 5 + fw/ino/kfd-avr/Versions.h | 6 +- fw/ino/kfd-avr/kfd-avr.ino | 91 +++++++- .../Properties/AssemblyInfo.cs | 6 +- .../Protocol/Adapter/AdapterProtocol.cs | 208 +++++++++++++++++- .../KFDtool.BSL430/Properties/AssemblyInfo.cs | 4 +- .../KFDtool.Cmd/Properties/AssemblyInfo.cs | 5 +- .../Properties/AssemblyInfo.cs | 4 +- sw/control/KFDtool.Gui/MainWindow.xaml.cs | 26 +-- .../KFDtool.Gui/Properties/AssemblyInfo.cs | 6 +- .../KFDtool.P25/Properties/AssemblyInfo.cs | 4 +- .../TransferConstructs/InteractTwiKfdtool.cs | 4 +- .../KFDtool.Shared/Properties/AssemblyInfo.cs | 4 +- 18 files changed, 377 insertions(+), 58 deletions(-) diff --git a/LICENSE.txt b/LICENSE.txt index 1c7e7b1..45d6c1b 100644 --- a/LICENSE.txt +++ b/LICENSE.txt @@ -1,5 +1,6 @@ Copyright 2019-2020 KFDtool, LLC Copyright 2021-2023 Natalie Moore +Copyright 2023 Ilya Smirnov Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal diff --git a/README.md b/README.md index a63c1c2..9f5d30e 100644 --- a/README.md +++ b/README.md @@ -178,6 +178,7 @@ Contributors * [Ellie Dugger](https://github.com/duggerd) * [Matt Ames](https://github.com/mattames) +* [Ilya Smirnov](https://github.com/ilyacodes) License / Legal --------------- diff --git a/fw/ino/kfd-avr/ControlOpCodes.h b/fw/ino/kfd-avr/ControlOpCodes.h index 92eaef3..4e695e7 100644 --- a/fw/ino/kfd-avr/ControlOpCodes.h +++ b/fw/ino/kfd-avr/ControlOpCodes.h @@ -9,6 +9,7 @@ #define CMD_SELF_TEST 0x15 #define CMD_SEND_KEY_SIG 0x16 #define CMD_SEND_BYTE 0x17 +#define CMD_SEND_BYTES 0x18 /* RESPONSE OPCODES */ #define RSP_ERROR 0x20 @@ -19,6 +20,7 @@ #define RSP_SELF_TEST 0x25 #define RSP_SEND_KEY_SIG 0x26 #define RSP_SEND_BYTE 0x27 +#define RSP_SEND_BYTES 0x28 /* BROADCAST OPCODES */ #define BCST_RECEIVE_BYTE 0x31 @@ -34,6 +36,9 @@ /* WRITE OPCODES */ #define WRITE_MDL_REV 0x01 #define WRITE_SER 0x02 +#define WRITE_DEFAULT_TRANSFER_SPEED 0x03 +#define WRITE_TX_TRANSFER_SPEED 0x04 +#define WRITE_RX_TRANSFER_SPEED 0x05 /* ERROR OPCODES */ #define ERR_OTHER 0x00 diff --git a/fw/ino/kfd-avr/SerialProtocol.cpp b/fw/ino/kfd-avr/SerialProtocol.cpp index 6a974cd..c3f3498 100644 --- a/fw/ino/kfd-avr/SerialProtocol.cpp +++ b/fw/ino/kfd-avr/SerialProtocol.cpp @@ -11,7 +11,7 @@ #define ESC_PLACEHOLDER 0x71 uint16_t inDataCount = 0; -uint8_t inData[128]; +uint8_t inData[512]; void spConnect(void) { @@ -147,7 +147,7 @@ void spTxDataBack(const uint8_t* inData, uint16_t inLength) { uint16_t outLength; - uint8_t outData[128]; + uint8_t outData[512]; outLength = spFrameData(inData, inLength, outData); @@ -158,7 +158,7 @@ void spTxDataWait(const uint8_t* inData, uint16_t inLength) { uint16_t outLength; - uint8_t outData[128]; + uint8_t outData[512]; outLength = spFrameData(inData, inLength, outData); diff --git a/fw/ino/kfd-avr/TwiProtocol.cpp b/fw/ino/kfd-avr/TwiProtocol.cpp index e1730e9..d28e32c 100644 --- a/fw/ino/kfd-avr/TwiProtocol.cpp +++ b/fw/ino/kfd-avr/TwiProtocol.cpp @@ -2,10 +2,6 @@ #include "TwiProtocol.h" -#define BIT_TIME FCPU/4000 -#define HALF_BIT_TIME BIT_TIME/2 -#define SIG_TIME BIT_TIME*4 - #if defined(__AVR_ATmega328P__) // pin 3 is INT1 #define CLEAR_INTERRUPTS EIFR=2 @@ -40,6 +36,25 @@ volatile uint16_t TXByte; volatile uint16_t RXByte; volatile uint16_t hasReceived; +// Durations for tx/rx/sig +volatile uint16_t bitTimeTx = FCPU / 4000; +volatile uint16_t bitTimeRx = FCPU / 4000; +volatile uint16_t bitTimeRxHalf = FCPU / 8000; +volatile uint16_t bitTimeSig = FCPU / 1000; + +void twiSetDefaultTransferSpeed() { + twiSetTxTransferSpeed(4); + twiSetRxTransferSpeed(4); +} + +void twiSetTxTransferSpeed(uint8_t kilobaud) { + bitTimeTx = (FCPU / kilobaud) / 1000; +} + +void twiSetRxTransferSpeed(uint8_t kilobaud) { + bitTimeRx = (FCPU / kilobaud) / 1000; +} + uint8_t reverseByte(uint8_t b) { const uint8_t table[] = { @@ -289,7 +304,7 @@ void twiSendKeySig(void) TCCR1B = 0b00000001; // set prescaler and CTC mode TIMSK1 = 0b00000010; // set interrupt callback - OCR1A = SIG_TIME; // set value to count up to + OCR1A = bitTimeSig; // set value to count up to interrupts(); // go! while (busySending); // wait for completion @@ -299,9 +314,8 @@ void twiSendKeySig(void) ENABLE_KFD_RX_INT } -void twiSendPhyByte(uint8_t byteToSend) +void twiSendPhyByteHelper(uint8_t byteToSend) { - DISABLE_KFD_RX_INT halGpio1High(); halActLedOff(); @@ -327,13 +341,28 @@ void twiSendPhyByte(uint8_t byteToSend) TCCR1B = 0b00000001; // set prescaler TIMSK1 = 0b00000010; // set compare match mode - OCR1A = BIT_TIME; // set value to count up to + OCR1A = bitTimeTx; // set value to count up to interrupts(); // go! while (busySending); // wait for completion halGpio1Low(); halActLedOn(); +} + +void twiSendPhyBytes(uint8_t* byteToSend, uint16_t count) +{ + DISABLE_KFD_RX_INT + for (uint32_t i = 0; i < count; i++) { + twiSendPhyByteHelper(byteToSend[i]); + } + ENABLE_KFD_RX_INT +} + +void twiSendPhyByte(uint8_t byteToSend) +{ + DISABLE_KFD_RX_INT + twiSendPhyByteHelper(byteToSend); ENABLE_KFD_RX_INT } @@ -355,7 +384,7 @@ void Port_1(void) TCCR1B = 0b00000001; // set prescaler TIMSK1 = 0b00000010; // set compare match mode - OCR1A = HALF_BIT_TIME; // set value to count up to + OCR1A = bitTimeRx / 2; // set value to count up to interrupts(); // go! } @@ -364,7 +393,7 @@ ISR(TIMER1_COMPA_vect) TCNT1 = 0; // clear counter value if (timerType == 0) // receive byte mode { - OCR1A = BIT_TIME; // set value to count up to + OCR1A = bitTimeRx; // set value to count up to if (rxBitsLeft == 0) { TCCR1B = 0; // stop timer by declocking diff --git a/fw/ino/kfd-avr/TwiProtocol.h b/fw/ino/kfd-avr/TwiProtocol.h index 2962dc7..067b544 100644 --- a/fw/ino/kfd-avr/TwiProtocol.h +++ b/fw/ino/kfd-avr/TwiProtocol.h @@ -7,10 +7,15 @@ void twiInit(void); uint8_t twiSelfTest(void); +void twiSetDefaultTransferSpeed(); +void twiSetTxTransferSpeed(uint8_t kilobaud); +void twiSetRxTransferSpeed(uint8_t kilobaud); + uint16_t twiReceiveByte(uint8_t *c); void twiSendKeySig(void); +void twiSendPhyBytes(uint8_t* byteToSend, uint16_t count); void twiSendPhyByte(uint8_t byteToSend); void Port_1(void); diff --git a/fw/ino/kfd-avr/Versions.h b/fw/ino/kfd-avr/Versions.h index ecbfceb..09d65cf 100644 --- a/fw/ino/kfd-avr/Versions.h +++ b/fw/ino/kfd-avr/Versions.h @@ -3,12 +3,12 @@ /* FIRMWARE VERSION */ #define VER_FW_MAJOR 0x01 -#define VER_FW_MINOR 0x04 -#define VER_FW_PATCH 0x00 +#define VER_FW_MINOR 0x07 +#define VER_FW_PATCH 0x03 /* ADAPTER PROTOCOL VERSION */ #define VER_AP_MAJOR 0x02 -#define VER_AP_MINOR 0x00 +#define VER_AP_MINOR 0x01 #define VER_AP_PATCH 0x00 #endif /* VERSIONS_H_ */ diff --git a/fw/ino/kfd-avr/kfd-avr.ino b/fw/ino/kfd-avr/kfd-avr.ino index 0ec7bef..637f432 100644 --- a/fw/ino/kfd-avr/kfd-avr.ino +++ b/fw/ino/kfd-avr/kfd-avr.ino @@ -7,7 +7,7 @@ #include "UID.h" uint16_t cmdCount; -uint8_t cmdData[128]; +uint8_t cmdData[512]; uint16_t rxReady; uint8_t rxTemp; @@ -279,6 +279,72 @@ void loop() spTxDataWait(rspData, sizeof(rspData)); } } + else if (cmdData[1] == WRITE_DEFAULT_TRANSFER_SPEED) // write default transfer speed + { + if (cmdCount == 2) + { + twiSetDefaultTransferSpeed(); + + uint8_t rspData[1]; + + rspData[0] = RSP_WRITE_INFO; + + spTxDataWait(rspData, sizeof(rspData)); + } + else // invalid command length + { + uint8_t rspData[2]; + + rspData[0] = RSP_ERROR; + rspData[1] = ERR_INVALID_CMD_LENGTH; + + spTxDataWait(rspData, sizeof(rspData)); + } + } + else if (cmdData[1] == WRITE_TX_TRANSFER_SPEED) // write new tx transfer speed + { + if (cmdCount == 3) + { + twiSetTxTransferSpeed(cmdData[2]); + + uint8_t rspData[1]; + + rspData[0] = RSP_WRITE_INFO; + + spTxDataWait(rspData, sizeof(rspData)); + } + else // invalid command length + { + uint8_t rspData[2]; + + rspData[0] = RSP_ERROR; + rspData[1] = ERR_INVALID_CMD_LENGTH; + + spTxDataWait(rspData, sizeof(rspData)); + } + } + else if (cmdData[1] == WRITE_RX_TRANSFER_SPEED) // write new rx transfer speed + { + if (cmdCount == 3) + { + twiSetRxTransferSpeed(cmdData[2]); + + uint8_t rspData[1]; + + rspData[0] = RSP_WRITE_INFO; + + spTxDataWait(rspData, sizeof(rspData)); + } + else // invalid command length + { + uint8_t rspData[2]; + + rspData[0] = RSP_ERROR; + rspData[1] = ERR_INVALID_CMD_LENGTH; + + spTxDataWait(rspData, sizeof(rspData)); + } + } else // invalid write opcode { uint8_t rspData[2]; @@ -427,6 +493,29 @@ void loop() spTxDataWait(rspData, sizeof(rspData)); } } + else if (cmdData[0] == CMD_SEND_BYTES) // send bytes + { + uint16_t dataCount = (uint16_t)cmdData[2] * 256 + cmdData[3]; + if (cmdCount == dataCount + 4) + { + twiSendPhyBytes(cmdData + 4, dataCount); + + uint8_t rspData[1]; + + rspData[0] = RSP_SEND_BYTES; + + spTxDataWait(rspData, sizeof(rspData)); + } + else // invalid command length + { + uint8_t rspData[2]; + + rspData[0] = RSP_ERROR; + rspData[1] = ERR_INVALID_CMD_LENGTH; + + spTxDataWait(rspData, sizeof(rspData)); + } + } else // invalid command opcode { uint8_t rspData[2]; diff --git a/sw/control/KFDtool.Adapter/Properties/AssemblyInfo.cs b/sw/control/KFDtool.Adapter/Properties/AssemblyInfo.cs index 730f9ca..fdb45ca 100644 --- a/sw/control/KFDtool.Adapter/Properties/AssemblyInfo.cs +++ b/sw/control/KFDtool.Adapter/Properties/AssemblyInfo.cs @@ -10,7 +10,7 @@ [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("")] [assembly: AssemblyProduct("KFDtool")] -[assembly: AssemblyCopyright("Copyright 2019-2020 Ellie Dugger")] +[assembly: AssemblyCopyright("Copyright 2019-2020 Ellie Dugger, 2023 Ilya Smirnov")] [assembly: AssemblyTrademark("")] [assembly: AssemblyCulture("")] @@ -32,5 +32,5 @@ // You can specify all the values or you can default the Build and Revision Numbers // by using the '*' as shown below: // [assembly: AssemblyVersion("1.0.*")] -[assembly: AssemblyVersion("1.5.0.0")] -[assembly: AssemblyFileVersion("1.5.0.0")] +[assembly: AssemblyVersion("1.7.3.0")] +[assembly: AssemblyFileVersion("1.7.3.0")] diff --git a/sw/control/KFDtool.Adapter/Protocol/Adapter/AdapterProtocol.cs b/sw/control/KFDtool.Adapter/Protocol/Adapter/AdapterProtocol.cs index f035a18..039c864 100644 --- a/sw/control/KFDtool.Adapter/Protocol/Adapter/AdapterProtocol.cs +++ b/sw/control/KFDtool.Adapter/Protocol/Adapter/AdapterProtocol.cs @@ -20,6 +20,7 @@ public class AdapterProtocol private const byte CMD_SELF_TEST = 0x15; private const byte CMD_SEND_KEY_SIG = 0x16; private const byte CMD_SEND_BYTE = 0x17; + private const byte CMD_SEND_BYTES = 0x18; /* RESPONSE OPCODES */ private const byte RSP_ERROR = 0x20; @@ -30,6 +31,7 @@ public class AdapterProtocol private const byte RSP_SELF_TEST = 0x25; private const byte RSP_SEND_KEY_SIG = 0x26; private const byte RSP_SEND_BYTE = 0x27; + private const byte RSP_SEND_BYTES = 0x28; /* BROADCAST OPCODES */ private const byte BCST_RECEIVE_BYTE = 0x31; @@ -45,6 +47,9 @@ public class AdapterProtocol /* WRITE OPCODES */ private const byte WRITE_MDL_REV = 0x01; private const byte WRITE_SER = 0x02; + private const byte WRITE_DEFAULT_TRANSFER_SPEED = 0x03; + private const byte WRITE_TX_TRANSFER_SPEED = 0x04; + private const byte WRITE_RX_TRANSFER_SPEED = 0x05; /* ERROR OPCODES */ private const byte ERR_OTHER = 0x00; @@ -57,6 +62,11 @@ public class AdapterProtocol private KfdSerialProtocol Lower; + /* Protocol versioning and feature flags */ + private Version ProtocolVersion; + private bool FeatureAvailableSendBytes => ProtocolVersion >= new Version(2, 1, 0); + private bool FeatureAvailableSetTransferSpeed => ProtocolVersion >= new Version(2, 1, 0); + public AdapterProtocol(string portName, TwiKfdDevice deviceType) { if (deviceType == TwiKfdDevice.Kfdtool) @@ -87,9 +97,14 @@ public void Close() public void Clear() { Lower.Clear(); + ProtocolVersion = ReadAdapterProtocolVersion(); + if (FeatureAvailableSetTransferSpeed) + { + SetDefaultTransferSpeed(); + } } - public byte[] ReadAdapterProtocolVersion() + public Version ReadAdapterProtocolVersion() { List cmd = new List(); @@ -124,10 +139,7 @@ public byte[] ReadAdapterProtocolVersion() if (rsp[1] == READ_AP_VER) { byte[] ver = new byte[3]; - ver[0] = rsp[2]; - ver[1] = rsp[3]; - ver[2] = rsp[4]; - return ver; + return new Version(rsp[2], rsp[3], rsp[4]); } else { @@ -481,6 +493,122 @@ public void WriteInfo(byte mdlId, byte hwRevMaj, byte hwRevMin) } } + public void SetDefaultTransferSpeed() + { + List cmd = new List(); + + /* + * CMD: WRITE DEFAULT TRANSFER SPEED + * + * [0] CMD_WRITE_INFO + * [1] WRITE_DEFAULT_TRANSFER_SPEED + * [2] speed in kilobaud + */ + + cmd.Add(CMD_WRITE_INFO); + cmd.Add(WRITE_DEFAULT_TRANSFER_SPEED); + + Lower.Send(cmd); + + List rsp = Lower.Read(AP_TIMEOUT); + + /* + * RSP: WRITE INFO + * + * [0] RSP_WRITE_INFO + */ + + if (rsp.Count == 1) + { + if (rsp[0] != RSP_WRITE_INFO) + { + throw new Exception("invalid response opcode"); + } + } + else + { + throw new Exception("invalid response length"); + } + } + + public void SetTxTransferSpeed(byte kilobaud) + { + List cmd = new List(); + + /* + * CMD: WRITE TX TRANSFER SPEED + * + * [0] CMD_WRITE_INFO + * [1] WRITE_TX_TRANSFER_SPEED + * [2] speed in kilobaud + */ + + cmd.Add(CMD_WRITE_INFO); + cmd.Add(WRITE_TX_TRANSFER_SPEED); + cmd.Add(kilobaud); + + Lower.Send(cmd); + + List rsp = Lower.Read(AP_TIMEOUT); + + /* + * RSP: WRITE INFO + * + * [0] RSP_WRITE_INFO + */ + + if (rsp.Count == 1) + { + if (rsp[0] != RSP_WRITE_INFO) + { + throw new Exception("invalid response opcode"); + } + } + else + { + throw new Exception("invalid response length"); + } + } + + public void SetRxTransferSpeed(byte kilobaud) + { + List cmd = new List(); + + /* + * CMD: WRITE RX TRANSFER SPEED + * + * [0] CMD_WRITE_INFO + * [1] WRITE_RX_TRANSFER_SPEED + * [2] speed in kilobaud + */ + + cmd.Add(CMD_WRITE_INFO); + cmd.Add(WRITE_RX_TRANSFER_SPEED); + cmd.Add(kilobaud); + + Lower.Send(cmd); + + List rsp = Lower.Read(AP_TIMEOUT); + + /* + * RSP: WRITE INFO + * + * [0] RSP_WRITE_INFO + */ + + if (rsp.Count == 1) + { + if (rsp[0] != RSP_WRITE_INFO) + { + throw new Exception("invalid response opcode"); + } + } + else + { + throw new Exception("invalid response length"); + } + } + public void EnterBslMode() { List cmd = new List(); @@ -667,11 +795,77 @@ public void SendByte(byte data) } } + public void SendBytes(List data) + { + List cmd = new List(); + + /* + * CMD: SEND BYTES + * + * [0] CMD_SEND_BYTE + * [1] reserved (set to 0x00) + * [2] MSB of total data bytes + * [3] LSB of total data bytes + * [4..] bytes to send + */ + + cmd.Add(CMD_SEND_BYTES); + cmd.Add(0x00); + cmd.Add((byte)(data.Count >> 8)); + cmd.Add((byte)(data.Count)); + cmd.AddRange(data); + + Lower.Send(cmd); + + List rsp = Lower.Read(AP_TIMEOUT); + + /* + * RSP: SEND BYTES + * + * [0] RSP_SEND_BYTE + */ + + if (rsp.Count == 1) + { + if (rsp[0] != RSP_SEND_BYTES) + { + throw new Exception("invalid response opcode"); + } + } + else + { + throw new Exception("invalid response length"); + } + } + public void SendData(List data) { - foreach (byte b in data) + if (data.Count == 0) + { + return; + } + + if (FeatureAvailableSendBytes) { - SendByte(b); + const int dataBytesPerCommand = 500; + if (data.Count <= dataBytesPerCommand) + { + SendBytes(data); + } + else + { + for (int offset = 0; offset < data.Count; offset += dataBytesPerCommand) + { + SendBytes(data.Skip(offset).Take(dataBytesPerCommand).ToList()); + } + } + } + else + { + foreach (byte b in data) + { + SendByte(b); + } } } diff --git a/sw/control/KFDtool.BSL430/Properties/AssemblyInfo.cs b/sw/control/KFDtool.BSL430/Properties/AssemblyInfo.cs index d113edc..749bbee 100644 --- a/sw/control/KFDtool.BSL430/Properties/AssemblyInfo.cs +++ b/sw/control/KFDtool.BSL430/Properties/AssemblyInfo.cs @@ -32,5 +32,5 @@ // You can specify all the values or you can default the Build and Revision Numbers // by using the '*' as shown below: // [assembly: AssemblyVersion("1.0.*")] -[assembly: AssemblyVersion("1.5.0.0")] -[assembly: AssemblyFileVersion("1.5.0.0")] +[assembly: AssemblyVersion("1.7.3.0")] +[assembly: AssemblyFileVersion("1.7.3.0")] diff --git a/sw/control/KFDtool.Cmd/Properties/AssemblyInfo.cs b/sw/control/KFDtool.Cmd/Properties/AssemblyInfo.cs index 36e89e4..9b9df22 100644 --- a/sw/control/KFDtool.Cmd/Properties/AssemblyInfo.cs +++ b/sw/control/KFDtool.Cmd/Properties/AssemblyInfo.cs @@ -32,6 +32,5 @@ // You can specify all the values or you can default the Build and Revision Numbers // by using the '*' as shown below: // [assembly: AssemblyVersion("1.0.*")] -[assembly: AssemblyVersion("1.5.0.0")] -[assembly: AssemblyFileVersion("1.5.0.0")] -[assembly: AssemblyInformationalVersion("1.5.0")] +[assembly: AssemblyVersion("1.7.3.0")] +[assembly: AssemblyFileVersion("1.7.3.0")] diff --git a/sw/control/KFDtool.Container/Properties/AssemblyInfo.cs b/sw/control/KFDtool.Container/Properties/AssemblyInfo.cs index 021fc14..585260f 100644 --- a/sw/control/KFDtool.Container/Properties/AssemblyInfo.cs +++ b/sw/control/KFDtool.Container/Properties/AssemblyInfo.cs @@ -32,5 +32,5 @@ // You can specify all the values or you can default the Build and Revision Numbers // by using the '*' as shown below: // [assembly: AssemblyVersion("1.0.*")] -[assembly: AssemblyVersion("1.5.0.0")] -[assembly: AssemblyFileVersion("1.5.0.0")] +[assembly: AssemblyVersion("1.7.3.0")] +[assembly: AssemblyFileVersion("1.7.3.0")] diff --git a/sw/control/KFDtool.Gui/MainWindow.xaml.cs b/sw/control/KFDtool.Gui/MainWindow.xaml.cs index 711c1ab..d525cfc 100644 --- a/sw/control/KFDtool.Gui/MainWindow.xaml.cs +++ b/sw/control/KFDtool.Gui/MainWindow.xaml.cs @@ -751,9 +751,13 @@ private void SelectDevice(MenuItem mi) Version apVersion = new Version(apVerStr); - if (apVersion.Major > 2) // TODO: handle this better + if (apVersion.Major != 2) // TODO: handle this better { - MessageBox.Show(string.Format("Adapter protocol version not compatible ({0})", apVerStr), "Error", MessageBoxButton.OK, MessageBoxImage.Error); + MessageBox.Show(string.Format( + "Adapter protocol version not compatible ({0})\n\n" + + "This version of KFDtool supports adapter protocol versions 2.x.x.\n\n" + + "Please update your adapter firmware.", + apVerStr), "Error", MessageBoxButton.OK, MessageBoxImage.Error); return; } @@ -797,27 +801,19 @@ private void Exit_MenuItem_Click(object sender, RoutedEventArgs e) private void About_MenuItem_Click(object sender, RoutedEventArgs e) { -#if DEBUG MessageBox.Show( string.Format( - "KFDtool Control Application{0}{0}Copyright 2019-2020 Ellie Dugger{0}{0}Copyright 2021-2023 Natalie Moore{0}{0}Version: {1} DEBUG{0}{0}", - Environment.NewLine, - Settings.AssemblyInformationalVersion - ), - "About", - MessageBoxButton.OK - ); -#else - MessageBox.Show( - string.Format( - "KFDtool Control Application{0}{0}Copyright 2019-2020 Ellie Dugger{0}{0}Copyright 2021-2023 Natalie Moore{0}{0}Version: {1}{0}{0}", + "KFDtool Control Application{0}{0}Copyright 2019-2020 Ellie Dugger{0}{0}Copyright 2021-2023 Natalie Moore{0}{0}Copyright 2023 Ilya Smirnov{0}{0}Version: {1}" +#if DEBUG + + " DEBUG" +#endif + + "{0}{0}", Environment.NewLine, Settings.AssemblyInformationalVersion ), "About", MessageBoxButton.OK ); -#endif } } } diff --git a/sw/control/KFDtool.Gui/Properties/AssemblyInfo.cs b/sw/control/KFDtool.Gui/Properties/AssemblyInfo.cs index 37d80b4..26c6810 100644 --- a/sw/control/KFDtool.Gui/Properties/AssemblyInfo.cs +++ b/sw/control/KFDtool.Gui/Properties/AssemblyInfo.cs @@ -51,6 +51,6 @@ // You can specify all the values or you can default the Build and Revision Numbers // by using the '*' as shown below: // [assembly: AssemblyVersion("1.0.*")] -[assembly: AssemblyVersion("1.7.2.0")] -[assembly: AssemblyFileVersion("1.7.2.0")] -[assembly: AssemblyInformationalVersion("1.7.2")] +[assembly: AssemblyVersion("1.7.3.0")] +[assembly: AssemblyFileVersion("1.7.3.0")] +[assembly: AssemblyInformationalVersion("1.7.3")] diff --git a/sw/control/KFDtool.P25/Properties/AssemblyInfo.cs b/sw/control/KFDtool.P25/Properties/AssemblyInfo.cs index dca48bc..97723fd 100644 --- a/sw/control/KFDtool.P25/Properties/AssemblyInfo.cs +++ b/sw/control/KFDtool.P25/Properties/AssemblyInfo.cs @@ -32,5 +32,5 @@ // You can specify all the values or you can default the Build and Revision Numbers // by using the '*' as shown below: // [assembly: AssemblyVersion("1.0.*")] -[assembly: AssemblyVersion("1.5.0.0")] -[assembly: AssemblyFileVersion("1.5.0.0")] +[assembly: AssemblyVersion("1.7.3.0")] +[assembly: AssemblyFileVersion("1.7.3.0")] diff --git a/sw/control/KFDtool.P25/TransferConstructs/InteractTwiKfdtool.cs b/sw/control/KFDtool.P25/TransferConstructs/InteractTwiKfdtool.cs index 7f4b9d3..44adbb9 100644 --- a/sw/control/KFDtool.P25/TransferConstructs/InteractTwiKfdtool.cs +++ b/sw/control/KFDtool.P25/TransferConstructs/InteractTwiKfdtool.cs @@ -32,9 +32,9 @@ public static string ReadAdapterProtocolVersion(BaseDevice device) ap.Clear(); - byte[] ver = ap.ReadAdapterProtocolVersion(); + Version ver = ap.ReadAdapterProtocolVersion(); - version = string.Format("{0}.{1}.{2}", ver[0], ver[1], ver[2]); + version = string.Format("{0}.{1}.{2}", ver.Major, ver.Minor, ver.Build); } catch (Exception) { diff --git a/sw/control/KFDtool.Shared/Properties/AssemblyInfo.cs b/sw/control/KFDtool.Shared/Properties/AssemblyInfo.cs index 50efd77..0505982 100644 --- a/sw/control/KFDtool.Shared/Properties/AssemblyInfo.cs +++ b/sw/control/KFDtool.Shared/Properties/AssemblyInfo.cs @@ -32,5 +32,5 @@ // You can specify all the values or you can default the Build and Revision Numbers // by using the '*' as shown below: // [assembly: AssemblyVersion("1.0.*")] -[assembly: AssemblyVersion("1.5.0.0")] -[assembly: AssemblyFileVersion("1.5.0.0")] +[assembly: AssemblyVersion("1.7.3.0")] +[assembly: AssemblyFileVersion("1.7.3.0")]