diff options
| author | Shlomo Hecht <shlomo@twine-s.com> | 2020-11-25 18:06:33 +0200 |
|---|---|---|
| committer | Shlomo Hecht <shlomo@twine-s.com> | 2020-11-25 18:06:33 +0200 |
| commit | 876550feb257f9f2524041baa4f7532255b1ad20 (patch) | |
| tree | c9a74d866ba1cd67651642c20690ecd3297aa3fb /Software/Stubs Collection/stubs | |
| parent | 68a9959554b2d7f03200af46afa336cf77882d01 (diff) | |
| download | Tango-876550feb257f9f2524041baa4f7532255b1ad20.tar.gz Tango-876550feb257f9f2524041baa4f7532255b1ad20.zip | |
main card EEProm backup procedures and stubs
Diffstat (limited to 'Software/Stubs Collection/stubs')
| -rw-r--r-- | Software/Stubs Collection/stubs/reload main card EEPROM.cs | 80 |
1 files changed, 41 insertions, 39 deletions
diff --git a/Software/Stubs Collection/stubs/reload main card EEPROM.cs b/Software/Stubs Collection/stubs/reload main card EEPROM.cs index e84dac5e6..3ddaf6c40 100644 --- a/Software/Stubs Collection/stubs/reload main card EEPROM.cs +++ b/Software/Stubs Collection/stubs/reload main card EEPROM.cs @@ -14,37 +14,6 @@ using System.IO; using Tango.PMR.IO; using Google.Protobuf; -int[] Main_Card_Data = -{3289, -8337, -13392, -16205, -30, --1, --1, --1, --1, --1, --1, --1, --1, --1, --1, --1, --1, --1, --1, --1, --1, --1, -772146177, -1, -1057, -1189, --1, -4400, -4050}; - string[] Main_Card_EEpromAddress = { "DATA_SIZE", "DANCER_0", @@ -86,14 +55,47 @@ string[] Main_Card_EEpromAddress = { public void OnExecute(StubManager stubManager) { - for (int i = 1; i < 30; i++) - { - StubMainCardEEpromWriteRequest stubMainCardEEpromWriteRequest = new StubMainCardEEpromWriteRequest(); - stubMainCardEEpromWriteRequest.Address = i; - stubMainCardEEpromWriteRequest.Data = Main_Card_Data[i]; + string filename = "c:\\temp\\mainEEProm10104.csv";//stubManager.ShowResponseWindow("Please Enter FileName"); + string line; + string[] Table1 = new string [4] ; + int i; + + // Read the file and display it line by line. - var response = stubManager.Run<StubMainCardEEpromWriteResponse>(stubMainCardEEpromWriteRequest); - stubManager.Write("\r\nMain_Card_Data write \t"+ (i+1) + " address \t "+ Main_Card_EEpromAddress[i]+" data: \t" + Main_Card_Data[i]); + stubManager.Write("\r\nfile name " + filename); + System.IO.StreamReader file = new System.IO.StreamReader(filename); - } + line = file.ReadLine(); + stubManager.Write("\r\n line " + line); + line = file.ReadLine(); + stubManager.Write("\r\n line " + line); + int j=0; + while(line != null) + { + j++; + //stubManager.Write("\r\n line " + line + " null? " + (line==null)); + string[] words = line.Split(','); + i=0; + foreach (var word in words) + { + Table1[i]=word; + i=i+1; + } + //stubManager.Write("\r\nfile read\t"+ (i) + " " + Table1[1] + " "+ Table1[2] + " "+ Table1[3] + " "); + int Address = Convert.ToInt32(Table1[0]); + int Data = Convert.ToInt32(Table1[2]); + string name = Table1[1]; + //stubManager.Write("\r\nfile read\t"+ (i) + " " + j + " "+ Table1[2] + " "+ Data + " "); + if (Address>0) + { + StubMainCardEEpromWriteRequest stubMainCardEEpromWriteRequest = new StubMainCardEEpromWriteRequest(); + stubMainCardEEpromWriteRequest.Address = j; + stubMainCardEEpromWriteRequest.Data = Data; + + var response = stubManager.Run<StubMainCardEEpromWriteResponse>(stubMainCardEEpromWriteRequest); + stubManager.Write("\r\nMain_Card_Data write \t"+ j + " " +Table1[1] + " address \t "+ j+" data: \t" + Data); + } + line = file.ReadLine(); + } + stubManager.Write("\r\n last line " + line + "null? " + (line==null)); }
\ No newline at end of file |
