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