From a1a5b23fa3ae710e5c3d741fe59e0b6cc3fbcd5b Mon Sep 17 00:00:00 2001 From: Shlomo Hecht Date: Thu, 10 Dec 2020 19:38:53 +0200 Subject: version 1.5.3.4 --- Software/Stubs Collection/Procedures/Set_Head_Type_With_DB.pproj | 1 + Software/Stubs Collection/stubs/embeddedparametersbuild_w_cleaning.cs | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) create mode 100644 Software/Stubs Collection/Procedures/Set_Head_Type_With_DB.pproj (limited to 'Software/Stubs Collection') diff --git a/Software/Stubs Collection/Procedures/Set_Head_Type_With_DB.pproj b/Software/Stubs Collection/Procedures/Set_Head_Type_With_DB.pproj new file mode 100644 index 000000000..2a8d146ca --- /dev/null +++ b/Software/Stubs Collection/Procedures/Set_Head_Type_With_DB.pproj @@ -0,0 +1 @@ +{"$id":"1","Name":"Set_Head_Type","Visibility":"Public","Description":null,"Scripts":{"$id":"2","$values":[{"$id":"3","Code":"using System;\r\nusing System.Collections.Generic;\r\nusing System.Collections.ObjectModel;\r\nusing System.ComponentModel;\r\nusing System.Linq;\r\nusing System.Text;\r\nusing System.Threading;\r\nusing System.Threading.Tasks;\r\nusing System.Drawing;\r\nusing Google.Protobuf;\r\nusing Tango.BL.Entities;\r\nusing Tango.BL.Enumerations;\r\nusing Tango.PMR.Stubs;\r\nusing Tango.PMR.Diagnostics;\r\nusing Tango.FSE.Common.Connection;\r\nusing Tango.FSE.Common.Diagnostics;\r\nusing Tango.FSE.Procedures;\r\nusing System.IO;\r\nusing Tango.FSE.Common.SQL;\r\nusing Tango.PPC.Shared.SQL;\r\nusing Tango.FSE.Common.RemoteActions;\r\n\r\n\r\npublic class Program\r\n{\r\n private IProcedureContext context;\r\n private const Int32 I2C_ID = 3; //MCU_I2C3 \r\n private const Int32 TCA9548A_address = 0xE2;\r\n private const Int32 I2C_Slave_Add = 0xA0; //eeprom address - 32kByte \r\n private int Head_Mux_Channel_ID = 4; //Head MUX channel\r\n private const Int32 SerialNum = 0x01;\r\n\r\n public void OnExecute(IProcedureContext context)\r\n {\r\n this.context = context;\r\n\r\n int headType = context.GetInput(\"headType\"); //0 flate ; 1 Arc\r\n Byte HeadTtpe = (byte)(headType == 0 ? 3 : 4); //3 flate ; 4 Arc\r\n context.WriteLine(HeadTtpe);\r\n\r\n\t\t//Firmware -------------------------------------------------------------------------------------------------------------\r\n context.UpdateProgress(\"Updating machine EEPROM entry...\");\r\n\r\n //enable_all_channel();\r\n enable_channel(Head_Mux_Channel_ID); // Chanel 0-7 => Disp0enser 0-7 \r\n\r\n\r\n adc_write(I2C_Slave_Add, 0x00, HeadTtpe);\r\n context.Sleep(10); //Sleep for 5 milli. - must! otherwise read 0xff (See data sheet )\r\n\r\n context.Write(\"\\nPage 0x00 #\");\r\n context.Write(0);\r\n context.Write(\"\\t- The Buffer is: \");\r\n adc_set_for_read_ch(I2C_Slave_Add, 0x00);\r\n //Thread.Sleep(1); //Sleep for 10 milli.\r\n adc_read_ch(I2C_Slave_Add);\r\n\r\n context.Sleep(1000);\r\n\r\n\r\n\t\t//Software -------------------------------------------------------------------------------------------------------------\r\n context.UpdateProgress(\"Updating machine global and local database entries...\");\r\n\r\n //Create the SQL command and direct it to affect both the local machine's database and the global Twine's database.\r\n IRemoteSqlProvider sql = context.GetService();\r\n RemoteSqlCommand command = new RemoteSqlCommand();\r\n command.Mode = RemoteSqlCommandMode.Both;\r\n command.SQL = \"UPDATE MACHINES SET HEAD_TYPE = \" + headType + \" WHERE SERIAL_NUMBER = '\" + context.ConnectedMachine.SerialNumber + \"'\";\r\n RemoteSqlCommandResult result = sql.ExecuteSqlCommand(command);\r\n\r\n if (result.HasGlobalError || result.HasLocalError)\r\n {\r\n context.Fail(\"Could not update the machine's global or local entry.\\n\" + result.GlobalError + \"\\n\" + result.LocalError);\r\n }\r\n\r\n context.ShowInfo(\"The machine head type was updated successfully. Changes will take effect after system restart.\");\r\n }\r\n\r\n private int enable_channel(int Channel_ID)\r\n {\r\n uint Const_temp = 0x01;\r\n\r\n StubI2CWriteBytesRequest stubI2CWriteBytesRequest = new StubI2CWriteBytesRequest();\r\n stubI2CWriteBytesRequest.I2CId = I2C_ID;\r\n stubI2CWriteBytesRequest.SlaveAddress = TCA9548A_address;\r\n\r\n Const_temp = Const_temp << Channel_ID;\r\n stubI2CWriteBytesRequest.BytesTWrite.Add(Const_temp);\r\n\r\n var response = context.Send(stubI2CWriteBytesRequest);\r\n\r\n return 1;\r\n }\r\n\r\n\r\n private int adc_write(uint I2C_Slave_Add, uint Page, Byte HeadTtpe)\r\n {\r\n StubI2CWriteBytesRequest stubI2CWriteBytesRequest = new StubI2CWriteBytesRequest();\r\n stubI2CWriteBytesRequest.I2CId = I2C_ID;\r\n stubI2CWriteBytesRequest.SlaveAddress = I2C_Slave_Add;\r\n\r\n UInt32 uInt32 = new UInt32();\r\n stubI2CWriteBytesRequest.BytesTWrite.Add(0);//Byte 0 to write\r\n stubI2CWriteBytesRequest.BytesTWrite.Add(Page);//Byte 0 to write\r\n //--------------------------------------------------------------\r\n\r\n stubI2CWriteBytesRequest.BytesTWrite.Add(SerialNum);//S/N\r\n //stubI2CWriteBytesRequest.BytesTWrite.Add(0x03);//HEAD_TYPE_FLAT\r\n stubI2CWriteBytesRequest.BytesTWrite.Add(HeadTtpe);//HEAD_TYPE_ARC\r\n\r\n var response = context.Send(stubI2CWriteBytesRequest);\r\n\r\n return 1;\r\n }\r\n\r\n private int adc_set_for_read_ch(uint I2C_Slave_Add, uint Page)\r\n {\r\n StubI2CWriteBytesRequest stubI2CWriteBytesRequest = new StubI2CWriteBytesRequest();\r\n stubI2CWriteBytesRequest.I2CId = I2C_ID;\r\n stubI2CWriteBytesRequest.SlaveAddress = I2C_Slave_Add;\r\n\r\n\r\n UInt32 uInt32 = new UInt32();\r\n stubI2CWriteBytesRequest.BytesTWrite.Add(0);//Byte 0 to write\r\n stubI2CWriteBytesRequest.BytesTWrite.Add(Page);//Byte 0 to write\r\n\r\n var response = context.Send(stubI2CWriteBytesRequest);\r\n\r\n return 1;\r\n }\r\n\r\n private int adc_read_ch(uint I2C_Slave_Add)\r\n {\r\n StubI2CReadBytesRequest stubI2CReadBytesRequest = new StubI2CReadBytesRequest();\r\n stubI2CReadBytesRequest.I2CId = I2C_ID;\r\n stubI2CReadBytesRequest.SlaveAddress = I2C_Slave_Add + 1;\r\n stubI2CReadBytesRequest.NumberOfBytesToRead = 10; // Number of bytes to read\r\n\r\n var response1 = context.Send(stubI2CReadBytesRequest);\r\n uint temph = 0;\r\n\r\n for (int i = 0; i < stubI2CReadBytesRequest.NumberOfBytesToRead; i++)\r\n {\r\n temph = response1.ReadBytes[i];\r\n context.WriteHex(temph, 2);\r\n }\r\n\r\n return 1;\r\n }\r\n\r\n}\r\n","Name":"Program.csx","IsEntryPoint":true},{"$id":"4","Code":"using System;\r\nusing System.Collections.Generic;\r\nusing System.Collections.ObjectModel;\r\nusing System.ComponentModel;\r\nusing System.Linq;\r\nusing System.Text;\r\nusing System.Threading;\r\nusing System.Threading.Tasks;\r\nusing System.Drawing;\r\nusing Google.Protobuf;\r\nusing Tango.BL.Entities;\r\nusing Tango.BL.Enumerations;\r\nusing Tango.PMR.Stubs;\r\nusing Tango.PMR.Diagnostics;\r\nusing Tango.FSE.Common.Connection;\r\nusing Tango.FSE.Common.Diagnostics;\r\nusing Tango.FSE.Procedures;\r\n\r\npublic class Service\r\n{\r\n public double Calc(double a, double b)\r\n {\r\n return a + b;\r\n }\r\n}","Name":"Service.csx","IsEntryPoint":false}]},"Inputs":{"$id":"5","$values":[{"$id":"6","Type":"Selection","SelectionInputs":{"$id":"7","$values":[{"$id":"8","Name":"Flat","Value":"0"},{"$id":"9","Name":"Arc","Value":"1"}]},"DisplayName":"Head Type","Description":"Select the new machine head type","Key":"headType","Value":"0"}]},"Variables":{"$id":"10","$values":[]},"ReferenceAssemblies":{"$id":"11","$values":[{"$id":"12","File":"Tango.BL.dll","HintType":null},{"$id":"13","File":"Tango.FSE.Common.dll","HintType":null},{"$id":"14","File":"Tango.FSE.Procedures.dll","HintType":null},{"$id":"15","File":"Tango.Integration.dll","HintType":null},{"$id":"16","File":"Tango.PMR.dll","HintType":null},{"$id":"17","File":"Tango.Transport.dll","HintType":null},{"$id":"18","File":"mscorlib.dll","HintType":null},{"$id":"19","File":"System.Core.dll","HintType":null},{"$id":"20","File":"System.Drawing.dll","HintType":null},{"$id":"21","File":"System.Windows.Forms.dll","HintType":null},{"$id":"22","File":"Tango.PPC.Shared.dll","HintType":null}]},"Resources":{"$id":"23","$values":[]},"Dialogs":{"$id":"24","$values":[]},"ID":"85cac11e-4694-43f9-adfb-b010967ff32b","ApartmentState":"STA"} \ No newline at end of file diff --git a/Software/Stubs Collection/stubs/embeddedparametersbuild_w_cleaning.cs b/Software/Stubs Collection/stubs/embeddedparametersbuild_w_cleaning.cs index 403967569..57501cc0f 100644 --- a/Software/Stubs Collection/stubs/embeddedparametersbuild_w_cleaning.cs +++ b/Software/Stubs Collection/stubs/embeddedparametersbuild_w_cleaning.cs @@ -21,7 +21,7 @@ public void OnExecute(StubManager stubManager) string description = ""; ConfigurationParameters configurationParameters = new ConfigurationParameters(); -description += "Version 1.5.3.3"; +description += "Version 1.5.3.4"; configurationParameters.BreakSensorLimit = 10; //how many samples to collect in diagnostics before sending -- cgit v1.3.1