Modif telecommande pour multi-circuit
This commit is contained in:
parent
fd61538831
commit
959acd4e3e
5 changed files with 70 additions and 33 deletions
|
|
@ -229,16 +229,16 @@ namespace DMX2
|
|||
}
|
||||
}
|
||||
|
||||
Circuit circuitTelecomande=null;
|
||||
List<Circuit> circuitTelecomande=new List<Circuit>();
|
||||
int circuitTelecomandeVal=0;
|
||||
|
||||
public Circuit CircuitTelecomande {
|
||||
public List<Circuit> CircuitTelecomande {
|
||||
get {
|
||||
return circuitTelecomande;
|
||||
}
|
||||
set {
|
||||
/*set {
|
||||
circuitTelecomande = value;
|
||||
}
|
||||
}*/
|
||||
}
|
||||
|
||||
public int CircuitTelecomandeVal {
|
||||
|
|
@ -311,8 +311,6 @@ namespace DMX2
|
|||
else if(master != 100){
|
||||
foreach (var c in circuits) {
|
||||
int val = 0;
|
||||
if(circuitTelecomande==c)
|
||||
val = circuitTelecomandeVal;
|
||||
foreach (var seq in sequenceurs) {
|
||||
val = Math.Max (val, seq.ValeurCircuit (c));
|
||||
}
|
||||
|
|
@ -321,9 +319,6 @@ namespace DMX2
|
|||
} else {
|
||||
foreach (var c in circuits) {
|
||||
int val = 0;
|
||||
if(circuitTelecomande==c)
|
||||
val = circuitTelecomandeVal;
|
||||
//else
|
||||
foreach (var seq in sequenceurs) {
|
||||
val = Math.Max (val, seq.ValeurCircuit (c));
|
||||
}
|
||||
|
|
@ -331,6 +326,12 @@ namespace DMX2
|
|||
}
|
||||
}
|
||||
|
||||
if (circuitTelecomande.Count > 0) {
|
||||
foreach (Circuit c in circuitTelecomande) {
|
||||
c.ValeurCourante = circuitTelecomandeVal * master / 100;
|
||||
}
|
||||
}
|
||||
|
||||
EventManager.ProcessEvents();
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -58,7 +58,7 @@ namespace DMX2
|
|||
|
||||
void HandleDestroyed (object sender, EventArgs e)
|
||||
{
|
||||
universEdite.AllumageForce = -1;
|
||||
universEdite.AllumageForce.Clear();
|
||||
}
|
||||
|
||||
void RenderUniversName (CellLayout cell_layout, CellRenderer cell, TreeModel tree_model, TreeIter iter)
|
||||
|
|
@ -246,7 +246,7 @@ namespace DMX2
|
|||
majencour = true;
|
||||
int id = (int)(spinDimmer.Value);
|
||||
|
||||
universEdite.AllumageForce = -1;
|
||||
universEdite.AllumageForce.Clear();
|
||||
btAllume.Active = false;
|
||||
|
||||
currDimm = id - 1;
|
||||
|
|
@ -418,7 +418,10 @@ namespace DMX2
|
|||
{
|
||||
if (majencour)
|
||||
return;
|
||||
universEdite.AllumageForce = btAllume.Active?currDimm:-1;
|
||||
if(btAllume.Active)
|
||||
universEdite.AllumageForce.Add(currDimm);
|
||||
else
|
||||
universEdite.AllumageForce.Clear();
|
||||
universEdite.AllumageForceVal = 255;
|
||||
}
|
||||
protected void OnTxtParam1Changed (object sender, EventArgs e)
|
||||
|
|
|
|||
|
|
@ -321,7 +321,9 @@ namespace DMX2
|
|||
Console.WriteLine(msg.Address);
|
||||
foreach(var arg in msg.Args)
|
||||
Console.WriteLine(arg.GetString());
|
||||
try{
|
||||
ProcessMessage(msg,remep);
|
||||
}catch{}
|
||||
}
|
||||
} catch (SocketException ex) {
|
||||
}
|
||||
|
|
@ -495,10 +497,17 @@ namespace DMX2
|
|||
int dimId;
|
||||
if(!int.TryParse(toks[3],out dimId))return;
|
||||
if( msg.Args[0].GetInt() !=0)
|
||||
univ.AllumageForce = dimId;
|
||||
if(!univ.AllumageForce.Contains(dimId))
|
||||
univ.AllumageForce.Add(dimId);
|
||||
break;
|
||||
case "off":
|
||||
univ.AllumageForce = -1;
|
||||
if(!int.TryParse(toks[3],out dimId))return;
|
||||
//if( msg.Args[0].GetInt() !=0)
|
||||
if(univ.AllumageForce.Contains(dimId))
|
||||
univ.AllumageForce.Remove(dimId);
|
||||
break;
|
||||
case "alloff":
|
||||
univ.AllumageForce.Clear();
|
||||
break;
|
||||
case "onval":
|
||||
int val = msg.Args[0].GetInt();
|
||||
|
|
@ -513,18 +522,35 @@ namespace DMX2
|
|||
{
|
||||
switch (toks [1]) {
|
||||
case "on":
|
||||
int cirId;
|
||||
if(!int.TryParse(toks[2],out cirId))return;
|
||||
if( msg.Args[0].GetInt() !=0){
|
||||
if(cirId>0 && cirId <= Conduite.Courante.Circuits.Count)
|
||||
{
|
||||
Conduite.Courante.CircuitTelecomande =
|
||||
Conduite.Courante.Circuits[cirId-1];
|
||||
int cirId;
|
||||
if (!int.TryParse (toks [2], out cirId))
|
||||
return;
|
||||
if (msg.Args [0].GetInt () != 0) {
|
||||
if (cirId > 0 && cirId <= Conduite.Courante.Circuits.Count) {
|
||||
Circuit c = Conduite.Courante.Circuits [cirId - 1];
|
||||
if (!Conduite.Courante.CircuitTelecomande.Contains (c))
|
||||
Conduite.Courante.CircuitTelecomande.Add (c);
|
||||
}
|
||||
}
|
||||
}
|
||||
break;
|
||||
case "off":
|
||||
Conduite.Courante.CircuitTelecomande= null;
|
||||
{
|
||||
int cirId;
|
||||
if (!int.TryParse (toks [2], out cirId))
|
||||
return;
|
||||
//if (msg.Args [0].GetInt () != 0) {
|
||||
if (cirId > 0 && cirId <= Conduite.Courante.Circuits.Count) {
|
||||
Circuit c = Conduite.Courante.Circuits [cirId - 1];
|
||||
if (Conduite.Courante.CircuitTelecomande.Contains (c))
|
||||
Conduite.Courante.CircuitTelecomande.Remove (c);
|
||||
}
|
||||
//}
|
||||
}
|
||||
break;
|
||||
case "alloff":
|
||||
Conduite.Courante.CircuitTelecomande.Clear();
|
||||
break;
|
||||
case "onval":
|
||||
int val = msg.Args[0].GetInt();
|
||||
|
|
|
|||
|
|
@ -136,7 +136,7 @@ namespace DMX2
|
|||
public void EffetSuivant ()
|
||||
{
|
||||
lock (this) {
|
||||
Conduite.Courante.CircuitTelecomande = null;
|
||||
Conduite.Courante.CircuitTelecomande.Clear();
|
||||
if(lignes.Count==0) return;
|
||||
if (aSuivre == null) {
|
||||
if (IndexLigneEnCours + 1 < lignes.Count)
|
||||
|
|
|
|||
|
|
@ -56,15 +56,17 @@ namespace DMX2
|
|||
|
||||
Dimmer[] _dimmers = new Dimmer[512];
|
||||
|
||||
int allumageForce = -1;
|
||||
// int allumageForce = -1;
|
||||
|
||||
public int AllumageForce {
|
||||
List<int> allumageForce = new List<int>();
|
||||
|
||||
public List<int> AllumageForce {
|
||||
get {
|
||||
return allumageForce;
|
||||
}
|
||||
set {
|
||||
/*set {
|
||||
allumageForce = value;
|
||||
}
|
||||
}*/
|
||||
}
|
||||
|
||||
int allumageForceVal= 255;
|
||||
|
|
@ -103,10 +105,10 @@ namespace DMX2
|
|||
Debug.Assert(valeurs.Length == _dimmers.Length);
|
||||
for(int i = 0 ; i<count; i++)
|
||||
{
|
||||
if(allumageForce==i) {
|
||||
/*if(allumageForce==i) {
|
||||
valeurs[i+offset] = (byte)allumageForceVal;
|
||||
continue;
|
||||
}
|
||||
}*/
|
||||
|
||||
g= _dimmers[i];
|
||||
if(g.circuitAssocié !=null) {
|
||||
|
|
@ -132,6 +134,11 @@ namespace DMX2
|
|||
else
|
||||
valeurs[i+offset] = 0;
|
||||
}
|
||||
if (allumageForce.Count > 0) {
|
||||
foreach (int af in allumageForce) {
|
||||
valeurs[af+offset] = (byte)allumageForceVal;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void Save (XmlElement parent)
|
||||
|
|
|
|||
Loading…
Reference in a new issue