diff --git a/DMX-2.0/Conduite.cs b/DMX-2.0/Conduite.cs index 2313953..753d2f8 100644 --- a/DMX-2.0/Conduite.cs +++ b/DMX-2.0/Conduite.cs @@ -198,6 +198,26 @@ namespace DMX2 } } + Circuit circuitTelecomande=null; + int circuitTelecomandeVal=0; + + public Circuit CircuitTelecomande { + get { + return circuitTelecomande; + } + set { + circuitTelecomande = value; + } + } + + public int CircuitTelecomandeVal { + get { + return circuitTelecomandeVal; + } + set { + circuitTelecomandeVal = value; + } + } // On utilise un thread qui boucle au lieu d'un timer. // C'est un peu moins précis, mais ca consomme beaucoup moins de ressources @@ -268,9 +288,12 @@ namespace DMX2 } else { foreach (var c in circuits) { int val = 0; - foreach (var seq in sequenceurs) { - val = Math.Max (val, seq.ValeurCircuit (c)); - } + if(circuitTelecomande==c) + val = circuitTelecomandeVal; + //else + foreach (var seq in sequenceurs) { + val = Math.Max (val, seq.ValeurCircuit (c)); + } c.ValeurCourante = val; } } diff --git a/DMX-2.0/DMX-2.0.csproj b/DMX-2.0/DMX-2.0.csproj index 2a50ca9..a20ec27 100644 --- a/DMX-2.0/DMX-2.0.csproj +++ b/DMX-2.0/DMX-2.0.csproj @@ -108,9 +108,6 @@ css.theme.images.ui-bg_glass_65_ffffff_1x400.png - - cs - @@ -150,6 +147,7 @@ + diff --git a/DMX-2.0/EditionUnivers.cs b/DMX-2.0/EditionUnivers.cs index 5435f90..c0de8af 100644 --- a/DMX-2.0/EditionUnivers.cs +++ b/DMX-2.0/EditionUnivers.cs @@ -40,7 +40,7 @@ namespace DMX2 void HandleDestroyed (object sender, EventArgs e) { - universEdite.AllumageForce = 0; + universEdite.AllumageForce = -1; } void RenderUniversName (CellLayout cell_layout, CellRenderer cell, TreeModel tree_model, TreeIter iter) @@ -228,7 +228,7 @@ namespace DMX2 majencour = true; int id = (int)(spinDimmer.Value); - universEdite.AllumageForce = 0; + universEdite.AllumageForce = -1; btAllume.Active = false; currDimm = id - 1; @@ -400,7 +400,7 @@ namespace DMX2 { if (majencour) return; - universEdite.AllumageForce = btAllume.Active?currDimm:0; + universEdite.AllumageForce = btAllume.Active?currDimm:-1; universEdite.AllumageForceVal = 255; } protected void OnTxtParam1Changed (object sender, EventArgs e) diff --git a/DMX-2.0/SequenceurMaitre.cs b/DMX-2.0/SequenceurMaitre.cs index c009e15..1fd580a 100644 --- a/DMX-2.0/SequenceurMaitre.cs +++ b/DMX-2.0/SequenceurMaitre.cs @@ -118,6 +118,7 @@ namespace DMX2 public void EffetSuivant () { lock (this) { + Conduite.Courante.CircuitTelecomande = null; if(lignes.Count==0) return; if (aSuivre == null) { if (IndexLigneEnCours + 1 < lignes.Count) diff --git a/DMX-2.0/UniversDMX.cs b/DMX-2.0/UniversDMX.cs index ff8975d..7affc95 100644 --- a/DMX-2.0/UniversDMX.cs +++ b/DMX-2.0/UniversDMX.cs @@ -38,7 +38,7 @@ namespace DMX2 Dimmer[] _dimmers = new Dimmer[512]; - int allumageForce = 0; + int allumageForce = -1; public int AllumageForce { get { @@ -86,7 +86,7 @@ namespace DMX2 for(int i = 0 ; iPas de conduite"; + // Pas de conduite chargée, on renvoi un simple message + if (Conduite.Courante == null) return "Pas de conduite"; + + // Pour les resources, on les renvoie si elles existent if (req.Url.LocalPath.StartsWith ("/res/")) { string res = req.Url.LocalPath.Remove(0,5).Replace('/','.'); - Console.WriteLine( res); - if(res.EndsWith(".js")) - ctx.Response.ContentType= "application/javascript"; if(resources.Contains(res)) using (System.IO.Stream stream = System.Reflection.Assembly.GetExecutingAssembly().GetManifestResourceStream(res)) using (System.IO.TextReader reader = new System.IO.StreamReader(stream)) return reader.ReadToEnd(); else return ""; } + + int circuit, univ, dimmer, val; + + // En fonction du http://xxxxxx:yyyy/?id= switch (req.QueryString["id"]) { - default: + default: // Par défaut, on renvoie la page string univlist = ""; int i = 0; - foreach (UniversDMX univ in Conduite.Courante.Patches) - univlist = univlist + string.Format("",i++,univ.Nom); - - - + foreach (UniversDMX univers in Conduite.Courante.Patches) + univlist = univlist + string.Format("",i++,univers.Nom); string data = page.Replace("",univlist); return data; + case "2" : - int univ, dimmer, val; + // id=2 > controle d'un dimmer if(!int.TryParse(req.QueryString["univ"],out univ)) return "NOK"; if(!int.TryParse(req.QueryString["dimmer"],out dimmer)) return "NOK"; if(!int.TryParse(req.QueryString["val"],out val)) return "NOK"; if(univ<0 || univ>= Conduite.Courante.Patches.Count) return "NOK"; if(dimmer<=0 || dimmer > 512) return "NOK"; if(val <0 || val > 255) return "NOK"; - Conduite.Courante.Patches[univ].AllumageForce = dimmer; + Conduite.Courante.Patches[univ].AllumageForce = dimmer-1; Conduite.Courante.Patches[univ].AllumageForceVal = val; return "OK"; case "3": - int circuit, val; + + // id=3 > controle d'un circuit if(!int.TryParse(req.QueryString["circuit"],out circuit)) return "NOK"; if(!int.TryParse(req.QueryString["val"],out val)) return "NOK"; - if(circuit<0 || circuit>= Conduite.Courante.Circuits.Count) return "NOK"; + if(circuit<=0 || circuit> Conduite.Courante.Circuits.Count) return "NOK"; if(val <0 || val > 255) return "NOK"; - + Conduite.Courante.CircuitTelecomande = Conduite.Courante.Circuits[circuit-1]; + Conduite.Courante.CircuitTelecomandeVal = val; return "OK"; } }