// ================================================================================================ // Run command(s) on first release of reset // ================================================================================================ bool ResetNow = exec.GetLED(ResetLED); string Line; if (FirstRun999 && !ResetNow) { while (!exec.GetLED(ResetLED)) Thread.Sleep(10); ResetNow = exec.GetLED(ResetLED); } FirstRun999 = false; // ================================================================================================ /* Spindellarm = port 1 pin 3 */ //-----------------------------------------------Homa, enabla och kontrollera vid reset-------------------------------- int counterLube = 0; int LubeOn = 72000; //10 = 1sek int counterLubeDuration = 0; int LubeDuration = 1000; //int counterLubeMax = 2147483647; int counterSaveLube = 0; counterLube = Convert.ToInt32(exec.Readkey("Makro999", "counterLube", "0")); if (FirstRun999 && !exec.GetLED(25)) { while (!exec.GetLED(25)) Thread.Sleep(10); FirstRun999 = false; } while(RunMacroPump & !FirstRun999) { Thread.Sleep(100); if(!setMpg) { exec.Callbutton(228); //mpg set to multi setMpg = true; } //Kolla om probekontaktorer är påverkade if(AS3.GetLED(7)) //om kontaktor (port1 in7) påverkad, varna med LED 900 { AS3.SetLED(false, 900); } else { AS3.SetLED(true, 900); } //Centralsmörjning------------- counterSaveLube++; //Console.Write(counterSaveLube); if (counterSaveLube > 600) { exec.Writekey("Makro999", "counterLube", "" + counterLube); Console.Write("Counter lube saved to profile " + counterLube); counterSaveLube = 0; } if(counterLube>LubeOn) { exec.Setoutpin(2, 17); //centralsmörning on counterLubeDuration++; if (counterLubeDuration>LubeDuration || exec.GetLED(98)) //Räknare uppnådd eller ingång för tryckvakt aktiv (port 3 pin 13) { exec.Clroutpin(2, 17); //Centralsmörning off counterLube = 0; counterLubeDuration = 0; } } if(AS3.GetLED(19)){counterLube++;} //Räkna bara upp om maskin rör sig. //--------------Centralsmörning } #Events static bool RunMacroPump = true; static bool FirstRun999 = true; const int ResetLED = 25;