Beispiel #1
0
        private RadioInfo readOpenGD77RadioInfo()
        {
            /*
             * String gd77CommPort = SetupDiWrap.ComPortNameFromFriendlyNamePrefix("OpenGD77");
             * try
             * {
             *      _port = new SerialPort(gd77CommPort, 115200, Parity.None, 8, StopBits.One);
             *      _port.ReadTimeout = 1000;
             *      _port.Open();
             * }
             * catch (Exception)
             * {
             *      _port = null;
             *      MessageBox.Show("Failed to open comm port", "Error");
             *      return;
             * }*/


            sendCommand(0);
            sendCommand(1);
            sendCommand(2, 0, 0, 3, 1, 0, "CPS");
            sendCommand(2, 0, 16, 3, 1, 0, "Read");
            sendCommand(2, 0, 32, 3, 1, 0, "Radio");
            sendCommand(2, 0, 48, 3, 1, 0, "Info");
            sendCommand(3);
            sendCommand(6, 4);            // flash red LED

            OpenGD77CommsTransferData dataObjRead = new OpenGD77CommsTransferData(OpenGD77CommsTransferData.CommsAction.NONE);

            dataObjRead.mode = OpenGD77CommsTransferData.CommsDataMode.DataModeReadRadioInfo;
            dataObjRead.localDataBufferStartPosition = 0;
            dataObjRead.transferLength = 0;
            dataObjRead.dataBuff       = new byte[128];

            RadioInfo radioInfo = new RadioInfo();

            if (ReadRadioInfo(dataObjRead))
            {
                radioInfo = ByteArrayToRadioInfo(dataObjRead.dataBuff);
            }

            sendCommand(5);

            /*
             * if (_port != null)
             * {
             *      try
             *      {
             *              _port.Close();
             *      }
             *      catch (Exception)
             *      {
             *              MessageBox.Show("Failed to close OpenGD77 comm port", "Warning");
             *      }
             * }
             */
            return(radioInfo);
        }
Beispiel #2
0
        private void writeToOpenGD77()
        {
            String gd77CommPort = SetupDiWrap.ComPortNameFromFriendlyNamePrefix("OpenGD77");

            try
            {
                _port             = new SerialPort(gd77CommPort, 115200, Parity.None, 8, StopBits.One);
                _port.ReadTimeout = 1000;
                _port.Open();
            }
            catch (Exception)
            {
                _port = null;
                MessageBox.Show("Failed to open comm port", "Error");
                return;
            }

            // Commands to control the screen etc in the firmware
            sendCommand(0);
            sendCommand(1);
            sendCommand(2, 0, 0, 3, 1, 0, "CPS");
            sendCommand(2, 0, 16, 3, 1, 0, "Writing");
            sendCommand(2, 0, 32, 3, 1, 0, "DMRID");
            sendCommand(2, 0, 48, 3, 1, 0, "Database");
            sendCommand(3);
            sendCommand(6, 4);            // flash red LED


            OpenGD77CommsTransferData dataObj = new OpenGD77CommsTransferData(OpenGD77CommsTransferData.CommsAction.NONE);

            dataObj.mode = OpenGD77CommsTransferData.CommsDataMode.DataModeWriteFlash;

            SIG_PATTERN_BYTES[3] = (byte)(0x4a + _stringLength + 4);

            dataObj.dataBuff = GenerateUploadData();
            dataObj.localDataBufferStartPosition = 0;
            dataObj.startDataAddressInTheRadio   = 0x30000;
            dataObj.transferLength = (dataObj.dataBuff.Length / 32) * 32;
            WriteFlash(dataObj);
            progressBar1.Value = 0;
            sendCommand(5);
            if (_port != null)
            {
                try
                {
                    _port.Close();
                }
                catch (Exception)
                {
                    MessageBox.Show("Failed to close OpenGD77 comm port", "Warning");
                }
            }
        }
Beispiel #3
0
        private bool flashWriteSector(ref byte[] sendbuffer, ref byte[] readbuffer, OpenGD77CommsTransferData dataObj)
        {
            dataObj.data_sector = -1;

            sendbuffer[0] = (byte)'W';
            sendbuffer[1] = 3;
            _port.Write(sendbuffer, 0, 2);
            while (_port.BytesToRead == 0)
            {
                Thread.Sleep(0);
            }
            _port.Read(readbuffer, 0, 64);

            return((readbuffer[0] == sendbuffer[0]) && (readbuffer[1] == sendbuffer[1]));
        }
Beispiel #4
0
        private bool ReadRadioInfo(OpenGD77CommsTransferData dataObj)
        {
            byte[] sendbuffer = new byte[512];
            byte[] readbuffer = new byte[512];
            int    currentDataAddressInLocalBuffer = 0;


            sendbuffer[0] = (byte)'R';
            sendbuffer[1] = (byte)dataObj.mode;
            sendbuffer[2] = (byte)(0);
            sendbuffer[3] = (byte)(0);
            sendbuffer[4] = (byte)(0);
            sendbuffer[5] = (byte)(0);
            sendbuffer[6] = (byte)(0);
            sendbuffer[7] = (byte)(0);


            _port.Write(sendbuffer, 0, 8);
            while (_port.BytesToRead == 0)
            {
                Thread.Sleep(0);
            }
            _port.Read(readbuffer, 0, 64);

            if (readbuffer[0] == 'R')
            {
                int len = (readbuffer[1] << 8) + (readbuffer[2] << 0);
                for (int i = 0; i < len; i++)
                {
                    dataObj.dataBuff[currentDataAddressInLocalBuffer++] = readbuffer[i + 3];
                }
            }
            else
            {
                Console.WriteLine(String.Format("read stopped (error at {0:X8})", 0));
                close_data_mode();
                return(false);
            }

            close_data_mode();
            return(true);
        }
Beispiel #5
0
        public void ReadFlashOrEEPROM(OpenGD77CommsTransferData dataObj)
        {
            int old_progress = 0;

            byte[] sendbuffer = new byte[512];
            byte[] readbuffer = new byte[512];
            byte[] com_Buf    = new byte[256];

            int currentDataAddressInTheRadio    = dataObj.startDataAddressInTheRadio;
            int currentDataAddressInLocalBuffer = dataObj.localDataBufferStartPosition;

            int size = (dataObj.startDataAddressInTheRadio + dataObj.transferLength) - currentDataAddressInTheRadio;

            while (size > 0)
            {
                if (size > 32)
                {
                    size = 32;
                }

                sendbuffer[0] = (byte)'R';
                sendbuffer[1] = (byte)dataObj.mode;
                sendbuffer[2] = (byte)((currentDataAddressInTheRadio >> 24) & 0xFF);
                sendbuffer[3] = (byte)((currentDataAddressInTheRadio >> 16) & 0xFF);
                sendbuffer[4] = (byte)((currentDataAddressInTheRadio >> 8) & 0xFF);
                sendbuffer[5] = (byte)((currentDataAddressInTheRadio >> 0) & 0xFF);
                sendbuffer[6] = (byte)((size >> 8) & 0xFF);
                sendbuffer[7] = (byte)((size >> 0) & 0xFF);
                _port.Write(sendbuffer, 0, 8);
                while (_port.BytesToRead == 0)
                {
                    Thread.Sleep(0);
                }
                _port.Read(readbuffer, 0, 64);

                if (readbuffer[0] == 'R')
                {
                    int len = (readbuffer[1] << 8) + (readbuffer[2] << 0);
                    for (int i = 0; i < len; i++)
                    {
                        dataObj.dataBuff[currentDataAddressInLocalBuffer++] = readbuffer[i + 3];
                    }

                    int progress = (currentDataAddressInTheRadio - dataObj.startDataAddressInTheRadio) * 100 / dataObj.transferLength;
                    if (old_progress != progress)
                    {
                        _progressCallback(progress);
                        old_progress = progress;
                    }

                    currentDataAddressInTheRadio = currentDataAddressInTheRadio + len;
                }
                else
                {
                    Console.WriteLine(String.Format("read stopped (error at {0:X8})", currentDataAddressInTheRadio));
                    close_data_mode();
                }
                size = (dataObj.startDataAddressInTheRadio + dataObj.transferLength) - currentDataAddressInTheRadio;
            }
            close_data_mode();
        }
Beispiel #6
0
        private bool flashWritePrepareSector(int address, ref byte[] sendbuffer, ref byte[] readbuffer, OpenGD77CommsTransferData dataObj)
        {
            dataObj.data_sector = address / 4096;

            sendbuffer[0] = (byte)'W';
            sendbuffer[1] = 1;
            sendbuffer[2] = (byte)((dataObj.data_sector >> 16) & 0xFF);
            sendbuffer[3] = (byte)((dataObj.data_sector >> 8) & 0xFF);
            sendbuffer[4] = (byte)((dataObj.data_sector >> 0) & 0xFF);
            _port.Write(sendbuffer, 0, 5);
            while (_port.BytesToRead == 0)
            {
                Thread.Sleep(0);
            }
            _port.Read(readbuffer, 0, 64);

            return((readbuffer[0] == sendbuffer[0]) && (readbuffer[1] == sendbuffer[1]));
        }
Beispiel #7
0
        public void WriteEEPROM(OpenGD77CommsTransferData dataObj)
        {
            int old_progress = 0;

            byte[] sendbuffer = new byte[512];
            byte[] readbuffer = new byte[512];
            byte[] com_Buf    = new byte[256];

            int currentDataAddressInTheRadio    = dataObj.startDataAddressInTheRadio;
            int currentDataAddressInLocalBuffer = dataObj.localDataBufferStartPosition;

            int size = (dataObj.startDataAddressInTheRadio + dataObj.transferLength) - currentDataAddressInTheRadio;

            while (size > 0)
            {
                if (size > 32)
                {
                    size = 32;
                }

                if (dataObj.data_sector == -1)
                {
                    dataObj.data_sector = currentDataAddressInTheRadio / 128;
                }

                int len = 0;
                for (int i = 0; i < size; i++)
                {
                    sendbuffer[i + 8] = (byte)dataObj.dataBuff[currentDataAddressInLocalBuffer++];
                    len++;

                    if (dataObj.data_sector != ((currentDataAddressInTheRadio + len) / 128))
                    {
                        dataObj.data_sector = -1;
                        break;
                    }
                }

                sendbuffer[0] = (byte)'W';
                sendbuffer[1] = 4;
                sendbuffer[2] = (byte)((currentDataAddressInTheRadio >> 24) & 0xFF);
                sendbuffer[3] = (byte)((currentDataAddressInTheRadio >> 16) & 0xFF);
                sendbuffer[4] = (byte)((currentDataAddressInTheRadio >> 8) & 0xFF);
                sendbuffer[5] = (byte)((currentDataAddressInTheRadio >> 0) & 0xFF);
                sendbuffer[6] = (byte)((len >> 8) & 0xFF);
                sendbuffer[7] = (byte)((len >> 0) & 0xFF);
                _port.Write(sendbuffer, 0, len + 8);
                while (_port.BytesToRead == 0)
                {
                    Thread.Sleep(0);
                }
                _port.Read(readbuffer, 0, 64);

                if ((readbuffer[0] == sendbuffer[0]) && (readbuffer[1] == sendbuffer[1]))
                {
                    int progress = (currentDataAddressInTheRadio - dataObj.startDataAddressInTheRadio) * 100 / dataObj.transferLength;
                    if (old_progress != progress)
                    {
                        _progressCallback(progress);
                        old_progress = progress;
                    }

                    currentDataAddressInTheRadio = currentDataAddressInTheRadio + len;
                }
                else
                {
                    Console.WriteLine(String.Format("Error. Write stopped (write sector error at {0:X8})", currentDataAddressInTheRadio));
                    close_data_mode();
                }
                size = (dataObj.startDataAddressInTheRadio + dataObj.transferLength) - currentDataAddressInTheRadio;
            }
            close_data_mode();
        }
Beispiel #8
0
        public void WriteFlash(OpenGD77CommsTransferData dataObj)
        {
            int old_progress = 0;

            byte[] sendbuffer = new byte[512];
            byte[] readbuffer = new byte[512];
            byte[] com_Buf    = new byte[256];
            int    currentDataAddressInTheRadio = dataObj.startDataAddressInTheRadio;

            int currentDataAddressInLocalBuffer = dataObj.localDataBufferStartPosition;

            dataObj.data_sector = -1;            // Always needs to be initialised to -1 so the first flashWritePrepareSector is called

            int size = (dataObj.startDataAddressInTheRadio + dataObj.transferLength) - currentDataAddressInTheRadio;

            while (size > 0)
            {
                if (size > 32)
                {
                    size = 32;
                }

                if (dataObj.data_sector == -1)
                {
                    if (!flashWritePrepareSector(currentDataAddressInTheRadio, ref sendbuffer, ref readbuffer, dataObj))
                    {
                        close_data_mode();
                        break;
                    }
                    ;
                }

                if (dataObj.mode != 0)
                {
                    int len = 0;
                    for (int i = 0; i < size; i++)
                    {
                        sendbuffer[i + 8] = dataObj.dataBuff[currentDataAddressInLocalBuffer++];
                        len++;

                        if (dataObj.data_sector != ((currentDataAddressInTheRadio + len) / 4096))
                        {
                            break;
                        }
                    }
                    if (flashSendData(currentDataAddressInTheRadio, len, ref sendbuffer, ref readbuffer))
                    {
                        int progress = (currentDataAddressInTheRadio - dataObj.startDataAddressInTheRadio) * 100 / dataObj.transferLength;
                        if (old_progress != progress)
                        {
                            _progressCallback(progress);
                            old_progress = progress;
                        }

                        currentDataAddressInTheRadio = currentDataAddressInTheRadio + len;

                        if (dataObj.data_sector != (currentDataAddressInTheRadio / 4096))
                        {
                            if (!flashWriteSector(ref sendbuffer, ref readbuffer, dataObj))
                            {
                                close_data_mode();
                                break;
                            }
                            ;
                        }
                    }
                    else
                    {
                        close_data_mode();
                        break;
                    }
                }
                size = (dataObj.startDataAddressInTheRadio + dataObj.transferLength) - currentDataAddressInTheRadio;
            }

            if (dataObj.data_sector != -1)
            {
                if (!flashWriteSector(ref sendbuffer, ref readbuffer, dataObj))
                {
                    Console.WriteLine(String.Format("Error. Write stopped (write sector error at {0:X8})", currentDataAddressInTheRadio));
                }
                ;
            }

            close_data_mode();
        }
Beispiel #9
0
        private void writeToOpenGD77()
        {
            String gd77CommPort       = SetupDiWrap.ComPortNameFromFriendlyNamePrefix("OpenGD77");
            int    radioMemoryAddress = 0x30000;

            try
            {
                _port             = new SerialPort(gd77CommPort, 115200, Parity.None, 8, StopBits.One);
                _port.ReadTimeout = 1000;
                _port.Open();
            }
            catch (Exception)
            {
                _port = null;
                MessageBox.Show("Failed to open comm port", "Error");
                return;
            }


            RadioInfo radioInfo = readOpenGD77RadioInfo();



            // Commands to control the screen etc in the firmware
            sendCommand(0);
            sendCommand(1);
            sendCommand(2, 0, 0, 3, 1, 0, "CPS");
            sendCommand(2, 0, 16, 3, 1, 0, "Writing");
            sendCommand(2, 0, 32, 3, 1, 0, "DMRID");
            sendCommand(2, 0, 48, 3, 1, 0, "Database");
            sendCommand(3);
            sendCommand(6, 4);            // flash red LED

            OpenGD77CommsTransferData dataObj = new OpenGD77CommsTransferData(OpenGD77CommsTransferData.CommsAction.NONE);

            dataObj.mode = OpenGD77CommsTransferData.CommsDataMode.DataModeWriteFlash;

            SIG_PATTERN_BYTES[3] = (byte)(0x4a + _stringLength + 4);

            dataObj.dataBuff = GenerateUploadData(radioInfo.flashId);
            //File.WriteAllBytes("d:\\dmrid_db.bin", dataObj.dataBuff);// Write for debugging purposes


            int localBufferPosition = 0;

            dataObj.localDataBufferStartPosition = localBufferPosition;
            dataObj.startDataAddressInTheRadio   = radioMemoryAddress;

            int totalTransferSize = (dataObj.dataBuff.Length / 32) * 32;
            int recordLength      = _stringLength + 4;

            int splitPoint = HEADER_LENGTH + (recordLength * ((0x40000 - HEADER_LENGTH) / recordLength));

            if (totalTransferSize > splitPoint)
            {
                dataObj.transferLength = splitPoint;
            }
            else
            {
                dataObj.transferLength = totalTransferSize;
            }
            WriteFlash(dataObj);            // transfer the first data section

            totalTransferSize   -= dataObj.transferLength;
            localBufferPosition += dataObj.transferLength;

            if (totalTransferSize > 0)
            {
                dataObj.startDataAddressInTheRadio   = 0xB8000;
                dataObj.localDataBufferStartPosition = localBufferPosition;                // continue on from last transfer length
                dataObj.transferLength = totalTransferSize;
                WriteFlash(dataObj);
            }

            progressBar1.Value = 0;
            sendCommand(5);
            if (_port != null)
            {
                try
                {
                    _port.Close();
                }
                catch (Exception)
                {
                    MessageBox.Show("Failed to close OpenGD77 comm port", "Warning");
                }
            }
        }
Beispiel #10
0
        private void btnWrite_Click(object sender, EventArgs e)
        {
            //bool retVal;

            /*	if (DialogResult.Yes != MessageBox.Show("Writing the calibration data to Radioddity GD-77 or any other compatible radio, could potentially damage your radio. By clicking 'Yes' you acknowledge that you use this feature entirely at your own risk", "WARNING", MessageBoxButtons.YesNo, MessageBoxIcon.Hand, MessageBoxDefaultButton.Button2))
             *      {
             *              return;
             *      }
             */
            String gd77CommPort = SetupDiWrap.ComPortNameFromFriendlyNamePrefix("OpenGD77");

            if (gd77CommPort != null)
            {
                OpenGD77CommsTransferData dataObj = new OpenGD77CommsTransferData(OpenGD77CommsTransferData.CommsAction.NONE);
                dataObj.dataBuff = new Byte[CALIBRATION_DATA_SIZE];

                _port             = new SerialPort(gd77CommPort, 115200, Parity.None, 8, StopBits.One);
                _port.ReadTimeout = 1000;



                int calibrationDataSize = Marshal.SizeOf(typeof(CalibrationData));

                byte[] array = DataToByte(this.calibrationBandControlUHF.data);
                Array.Copy(array, 0, dataObj.dataBuff, 0, calibrationDataSize);

                array = DataToByte(this.calibrationBandControlVHF.data);
                Array.Copy(array, 0, dataObj.dataBuff, VHF_OFFSET, calibrationDataSize);



                _port.Open();
                sendCommand(0);
                sendCommand(1);
                sendCommand(2, 0, 0, 3, 1, 0, "CPS");
                sendCommand(2, 0, 16, 3, 1, 0, "Restoring");
                sendCommand(2, 0, 32, 3, 1, 0, "Calibration");
                sendCommand(3);
                sendCommand(6, 4);                // flash red LED

                dataObj.mode = OpenGD77CommsTransferData.CommsDataMode.DataModeWriteFlash;

                dataObj.localDataBufferStartPosition = 0;
                dataObj.startDataAddressInTheRadio   = MEMORY_LOCATION;
                dataObj.transferLength = CALIBRATION_DATA_SIZE;
                //displayMessage("Restoring Flash");
                if (WriteFlash(dataObj))
                {
                    //displayMessage("Restore complete");
                }
                else
                {
                    MessageBox.Show("Error while restoring");
                    //displayMessage("Error while restoring");
                    dataObj.responseCode = 1;
                }
                sendCommand(6, 2);                // Save settings and VFO's
                sendCommand(6, 1);                // Reboot
                _port.Close();
                lblMessage.Text = "Calibration update completed";
                //MessageBox.Show("Calibration update completed");
            }
            else
            {
                // Pre-read to see if the Calibration area appears to be writable
                CodeplugComms.CommunicationMode = CodeplugComms.CommunicationType.dataRead;
                CommPrgForm commPrgForm = new CommPrgForm(true);                // true =  close download form as soon as download is complete
                commPrgForm.StartPosition    = FormStartPosition.CenterParent;
                CodeplugComms.startAddress   = CALIBRATION_MEMORY_LOCATION_OFFICIAL_USB_PROTOCOL;
                CodeplugComms.transferLength = 0x20;
                DialogResult result = commPrgForm.ShowDialog();

                int calibrationDataSize = Marshal.SizeOf(typeof(CalibrationData));

                byte[] array = DataToByte(this.calibrationBandControlUHF.data);
                Array.Copy(array, 0, MainForm.CommsBuffer, CALIBRATION_MEMORY_LOCATION_OFFICIAL_USB_PROTOCOL, calibrationDataSize);

                array = DataToByte(this.calibrationBandControlVHF.data);
                Array.Copy(array, 0, MainForm.CommsBuffer, CALIBRATION_MEMORY_LOCATION_OFFICIAL_USB_PROTOCOL + VHF_OFFSET, calibrationDataSize);

                CodeplugComms.CommunicationMode = CodeplugComms.CommunicationType.calibrationWrite;

                commPrgForm = new CommPrgForm(true);                // true =  close download form as soon as download is complete
                commPrgForm.StartPosition = FormStartPosition.CenterParent;
                commPrgForm.ShowDialog();
                MessageBox.Show("Calibration update completed");
            }
        }
Beispiel #11
0
        public bool readDataFromRadio()
        {
            bool         retVal = true;
            DialogResult result = DialogResult.OK;

            lblMessage.Text = "";

            int calibrationDataSize = Marshal.SizeOf(typeof(CalibrationData));

            byte[] array = new byte[calibrationDataSize];

            String gd77CommPort = SetupDiWrap.ComPortNameFromFriendlyNamePrefix("OpenGD77");

            if (gd77CommPort != null)
            {
                _port             = new SerialPort(gd77CommPort, 115200, Parity.None, 8, StopBits.One);
                _port.ReadTimeout = 1000;

                OpenGD77CommsTransferData dataObj = new OpenGD77CommsTransferData(OpenGD77CommsTransferData.CommsAction.NONE);

                _port.Open();
                sendCommand(0);
                sendCommand(1);
                sendCommand(2, 0, 0, 3, 1, 0, "CPS");                // Write a line of text to CPS screen at position x=0,y=3 with font size 3, alignment centre
                sendCommand(2, 0, 16, 3, 1, 0, "Backup");
                sendCommand(2, 0, 32, 3, 1, 0, "Calibration");
                sendCommand(3);
                sendCommand(6, 3);                // flash green LED

                dataObj.mode     = OpenGD77CommsTransferData.CommsDataMode.DataModeReadFlash;
                dataObj.dataBuff = new Byte[CALIBRATION_DATA_SIZE];
                dataObj.localDataBufferStartPosition = 0;
                dataObj.startDataAddressInTheRadio   = MEMORY_LOCATION;
                dataObj.transferLength = CALIBRATION_DATA_SIZE;
                //displayMessage("Reading Calibration");
                if (!ReadFlashOrEEPROM(dataObj))
                {
                    //displayMessage("Error while reading calibration");
                    result = DialogResult.Abort;
                    retVal = false;
                    dataObj.responseCode = 1;
                }
                else
                {
                    //displayMessage("");
                }
                sendCommand(5);                // close CPS screen
                _port.Close();



                for (int p = 0; p < CALIBRATION_HEADER_SIZE; p++)
                {
                    if (dataObj.dataBuff[p] != CALIBRATION_HEADER[p])
                    {
                        MessageBox.Show("Calibration data could not be found. Please update your firmware");
                        return(false);
                    }
                }

                Array.Copy(dataObj.dataBuff, 0, array, 0, calibrationDataSize);
                this.calibrationBandControlUHF.data = (CalibrationData)ByteToData(array);

                array = new byte[calibrationDataSize];
                Array.Copy(dataObj.dataBuff, 0 + VHF_OFFSET, array, 0, calibrationDataSize);
                this.calibrationBandControlVHF.data = (CalibrationData)ByteToData(array);
            }
            else
            {
                CommPrgForm commPrgForm;
                MainForm.CommsBuffer = new byte[1024 * 1024];

                // Pre-read to see if the calibration area appears to be readable.
                CodeplugComms.CommunicationMode = CodeplugComms.CommunicationType.dataRead;
                commPrgForm = new CommPrgForm(true);                // true =  close download form as soon as download is complete
                commPrgForm.StartPosition    = FormStartPosition.CenterParent;
                CodeplugComms.startAddress   = CalibrationForm.CALIBRATION_MEMORY_LOCATION_OFFICIAL_USB_PROTOCOL;
                CodeplugComms.transferLength = 0x20;
                result = commPrgForm.ShowDialog();

                CodeplugComms.CommunicationMode = CodeplugComms.CommunicationType.calibrationRead;
                commPrgForm = new CommPrgForm(true);                // true =  close download form as soon as download is complete
                commPrgForm.StartPosition = FormStartPosition.CenterParent;
                result = commPrgForm.ShowDialog();

                if (DialogResult.OK == result)
                {
                    // Need to setup the VHF and UHF data storage class first, as its used when initialising the components

                    Array.Copy(MainForm.CommsBuffer, CALIBRATION_MEMORY_LOCATION_OFFICIAL_USB_PROTOCOL, array, 0, calibrationDataSize);
                    this.calibrationBandControlUHF.data = (CalibrationData)ByteToData(array);

                    array = new byte[calibrationDataSize];
                    Array.Copy(MainForm.CommsBuffer, CALIBRATION_MEMORY_LOCATION_OFFICIAL_USB_PROTOCOL + VHF_OFFSET, array, 0, calibrationDataSize);
                    this.calibrationBandControlVHF.data = (CalibrationData)ByteToData(array);
                }
                else
                {
                    lblMessage.Text = "Error";
                    retVal          = false;
                }
            }

            return(retVal);
        }