public static void Init()
        {
            USBHID.GetSerialNum(out serial_number);             // get serial number

            USBHID.GetTRXSN(out trx_serial);
            USBHID.GetTRXRev(out trx_rev);

            USBHID.GetPASN(out pa_serial);
            USBHID.GetPARev(out pa_rev);


            byte[] data;             // get last cal date/time
            USBHID.ReadEEPROM(0x1820, 8, out data);
            if (data != null)
            {
                last_cal_date_time = BitConverter.ToInt64(data, 0);
            }

            /* USBHID.ReadTRXEEPROMByte(0x1BE, out temp);
             *          rx1_image_ver = temp;*/

            USBHID.GetRegion(out region); // check TURF in EEPROM
            if (region >= FRSRegion.LAST)
            {
                region = FRSRegion.US;                           // use US REGION if value is messed up
            }
        } // Init()
        } // Init()

        public static bool NeedDump()
        {
            if (File.Exists(Application.StartupPath + "\\nobackup"))
            {
                return(false);                                                               // for production
            }
            uint data;

            StringBuilder s = new StringBuilder("F1.5K_");

            USBHID.GetSerialNum(out data);
            s.Append(SerialToString(data));
            if (File.Exists(app_data_path + "Backup\\" + s + " backup.csv"))
            {
                return(false);
            }
            return(true);
        }
Example #3
0
        public static void Init()
        {
            USBHID.GetSerialNum(out serial_number);             // get serial number

            USBHID.GetTRXSN(out trx_serial);
            USBHID.GetTRXRev(out trx_rev);

            USBHID.GetPASN(out pa_serial);
            USBHID.GetPARev(out pa_rev);

            byte[] data = new byte[8];             // get last cal date/time
            USBHID.ReadEEPROM(0x1820, 8, out data);
            last_cal_date_time = BitConverter.ToInt64(data, 0);

            /* USBHID.ReadTRXEEPROMByte(0x1BE, out temp);
             *          rx1_image_ver = temp;*/

            USBHID.GetRegion(out region);
        }
        private static void Dump()
        {
            if (File.Exists(Application.StartupPath + "\\nobackup"))
            {
                return;                                                                // for production
            }
            uint data;

            StringBuilder s = new StringBuilder("F1.5K_");

            USBHID.GetSerialNum(out data);
            s.Append(SerialToString(data));
            if (!Directory.Exists(app_data_path + "\\Backup\\"))
            {
                Directory.CreateDirectory(app_data_path + "\\Backup\\");
            }
            if (File.Exists(app_data_path + "\\Backup\\" + s + " backup.csv"))
            {
                return;
            }
            StreamWriter writer = new StreamWriter(app_data_path + "\\Backup\\" + s + " backup.csv");

            s = new StringBuilder(",");
            for (int i = 0; i < 16; i++)
            {
                s.Append(i.ToString("X") + ",");
            }
            writer.WriteLine(s);

            byte[] buf = new byte[32];

            USBHID.ReadEEPROM(0x1800, 32, out buf);
            s = new StringBuilder("1800,");

            for (int j = 0; j < 16; j++)
            {
                s.Append(buf[j].ToString("X") + ",");
            }

            writer.WriteLine(s);
            Application.DoEvents();

            s = new StringBuilder("1810,");

            for (int j = 0; j < 16; j++)
            {
                s.Append(buf[j + 16].ToString("X") + ",");
            }

            writer.WriteLine(s);

            USBHID.ReadEEPROM(0x1820, 16, out buf);
            s = new StringBuilder("1820,");

            for (int j = 0; j < 16; j++)
            {
                s.Append(buf[j].ToString("X") + ",");
            }

            writer.WriteLine(s);
            Application.DoEvents();

            for (int i = 0; i < 9; i++) // 32*9 = 288
            {
                USBHID.ReadEEPROM((ushort)(0x3000 + i * 32), 32, out buf);

                s = new StringBuilder((0x300 + i * 2).ToString("X") + "0,");

                for (int j = 0; j < 16; j++)
                {
                    s.Append(buf[j].ToString("X") + ",");
                }

                writer.WriteLine(s);
                Application.DoEvents();

                s = new StringBuilder((0x300 + i * 2 + 1).ToString("X") + "0,");

                for (int j = 0; j < 16; j++)
                {
                    s.Append(buf[j + 16].ToString("X") + ",");
                }

                writer.WriteLine(s);
            }

            writer.Close();
        }