ajustes no config de sentidos do mov
This commit is contained in:
parent
7b511861d7
commit
20378a9fd1
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
|
|
@ -299,8 +299,8 @@ namespace AgroBase.Models.Modules
|
|||
TipoMovimentoDirecional.RodasDianteiras,
|
||||
new ConfiguracaoSentidoMotor()
|
||||
{
|
||||
Frente = Mod_ID.Contains("E") ? Sentido.Horario : Sentido.Antihorario,
|
||||
Tras = Mod_ID.Contains("E") ? Sentido.Antihorario : Sentido.Horario,
|
||||
Frente = Sentido.Horario,
|
||||
Tras = Sentido.Antihorario,
|
||||
Direita = Sentido.Parado,
|
||||
Esquerda = Sentido.Parado,
|
||||
Parado = Sentido.Parado,
|
||||
|
|
@ -309,39 +309,6 @@ namespace AgroBase.Models.Modules
|
|||
{
|
||||
TipoMovimentoDirecional.RodasTraseiras,
|
||||
new ConfiguracaoSentidoMotor()
|
||||
{
|
||||
Frente = Mod_ID.Contains("E") ? Sentido.Horario : Sentido.Antihorario,
|
||||
Tras = Mod_ID.Contains("E") ? Sentido.Antihorario : Sentido.Horario,
|
||||
Direita = Sentido.Parado,
|
||||
Esquerda = Sentido.Parado,
|
||||
Parado = Sentido.Parado,
|
||||
}
|
||||
},
|
||||
{
|
||||
TipoMovimentoDirecional.MovimentoDiagonal,
|
||||
new ConfiguracaoSentidoMotor()
|
||||
{
|
||||
Frente = Mod_ID.Contains("E") ? Sentido.Horario : Sentido.Antihorario,
|
||||
Tras = Mod_ID.Contains("E") ? Sentido.Antihorario : Sentido.Horario,
|
||||
Direita = Sentido.Parado,
|
||||
Esquerda = Sentido.Parado,
|
||||
Parado = Sentido.Parado,
|
||||
}
|
||||
},
|
||||
{
|
||||
TipoMovimentoDirecional.MovimentoArco,
|
||||
new ConfiguracaoSentidoMotor()
|
||||
{
|
||||
Frente = Mod_ID.Contains("E") ? Sentido.Horario : Sentido.Antihorario,
|
||||
Tras = Mod_ID.Contains("E") ? Sentido.Antihorario : Sentido.Horario,
|
||||
Direita = Sentido.Parado,
|
||||
Esquerda = Sentido.Parado,
|
||||
Parado = Sentido.Parado,
|
||||
}
|
||||
},
|
||||
{
|
||||
TipoMovimentoDirecional.RotacionarNoEixo,
|
||||
new ConfiguracaoSentidoMotor()
|
||||
{
|
||||
Frente = Sentido.Horario,
|
||||
Tras = Sentido.Antihorario,
|
||||
|
|
@ -350,12 +317,45 @@ namespace AgroBase.Models.Modules
|
|||
Parado = Sentido.Parado,
|
||||
}
|
||||
},
|
||||
{
|
||||
TipoMovimentoDirecional.MovimentoDiagonal,
|
||||
new ConfiguracaoSentidoMotor()
|
||||
{
|
||||
Frente = Sentido.Horario,
|
||||
Tras = Sentido.Antihorario,
|
||||
Direita = Sentido.Parado,
|
||||
Esquerda = Sentido.Parado,
|
||||
Parado = Sentido.Parado,
|
||||
}
|
||||
},
|
||||
{
|
||||
TipoMovimentoDirecional.MovimentoArco,
|
||||
new ConfiguracaoSentidoMotor()
|
||||
{
|
||||
Frente = Sentido.Horario,
|
||||
Tras = Sentido.Antihorario,
|
||||
Direita = Sentido.Parado,
|
||||
Esquerda = Sentido.Parado,
|
||||
Parado = Sentido.Parado,
|
||||
}
|
||||
},
|
||||
{
|
||||
TipoMovimentoDirecional.RotacionarNoEixo,
|
||||
new ConfiguracaoSentidoMotor()
|
||||
{
|
||||
Frente = Mod_ID.Contains("E") ? Sentido.Horario : Sentido.Antihorario,
|
||||
Tras = Mod_ID.Contains("E") ? Sentido.Antihorario : Sentido.Horario,
|
||||
Direita = Sentido.Parado,
|
||||
Esquerda = Sentido.Parado,
|
||||
Parado = Sentido.Parado,
|
||||
}
|
||||
},
|
||||
{
|
||||
TipoMovimentoDirecional.MovimentoLateral,
|
||||
new ConfiguracaoSentidoMotor()
|
||||
{
|
||||
Frente = Mod_ID.Contains("T") ? Sentido.Horario : Sentido.Antihorario,
|
||||
Tras = Mod_ID.Contains("T") ? Sentido.Antihorario : Sentido.Horario,
|
||||
Frente = Sentido.Horario,
|
||||
Tras = Sentido.Antihorario,
|
||||
Direita = Sentido.Parado,
|
||||
Esquerda = Sentido.Parado,
|
||||
Parado = Sentido.Parado,
|
||||
|
|
@ -365,8 +365,8 @@ namespace AgroBase.Models.Modules
|
|||
TipoMovimentoDirecional.Diagnostico,
|
||||
new ConfiguracaoSentidoMotor()
|
||||
{
|
||||
Frente = Mod_ID.Contains("E") ? Sentido.Horario : Sentido.Antihorario,
|
||||
Tras = Mod_ID.Contains("E") ? Sentido.Antihorario : Sentido.Horario,
|
||||
Frente = Sentido.Horario,
|
||||
Tras = Sentido.Antihorario,
|
||||
Direita = Sentido.Parado,
|
||||
Esquerda = Sentido.Parado,
|
||||
Parado = Sentido.Parado,
|
||||
|
|
|
|||
|
|
@ -19,6 +19,7 @@ namespace AgroBase.Services
|
|||
private int _bitRate;
|
||||
private object _lock = new object();
|
||||
public bool IsConnected { get; private set; }
|
||||
private volatile bool _precisaReabrir;
|
||||
public bool Iniciado
|
||||
{
|
||||
get
|
||||
|
|
@ -89,18 +90,18 @@ namespace AgroBase.Services
|
|||
RtsEnable = true
|
||||
};
|
||||
_PortaCAN.Open();
|
||||
_PortaCAN.ErrorReceived += (s, e) => {
|
||||
IsConnected = false;
|
||||
ReabrirPortaSegura();
|
||||
_PortaCAN.ErrorReceived += (s, e) =>
|
||||
{
|
||||
IsConnected = false;
|
||||
_precisaReabrir = true;
|
||||
};
|
||||
_PortaCAN.PinChanged += (s, e) => {
|
||||
_PortaCAN.PinChanged += (s, e) =>
|
||||
{
|
||||
// Se perder DSR/CD ou receber BREAK, considere desconexão
|
||||
if (e.EventType == SerialPinChange.Break ||
|
||||
e.EventType == SerialPinChange.CDChanged ||
|
||||
e.EventType == SerialPinChange.DsrChanged)
|
||||
if (e.EventType == SerialPinChange.Break || e.EventType == SerialPinChange.CDChanged || e.EventType == SerialPinChange.DsrChanged)
|
||||
{
|
||||
IsConnected = false;
|
||||
ReabrirPortaSegura();
|
||||
_precisaReabrir = true;
|
||||
}
|
||||
};
|
||||
|
||||
|
|
@ -503,8 +504,9 @@ namespace AgroBase.Services
|
|||
return;
|
||||
}
|
||||
|
||||
if (IsConnected && ((Agora - UltimoTx).TotalSeconds > 2 || (Agora - UltimoRx).TotalSeconds > 2))
|
||||
if (IsConnected && (((Agora - UltimoTx).TotalSeconds > 2 && (Agora - UltimoRx).TotalSeconds > 2) || _precisaReabrir))
|
||||
{
|
||||
_precisaReabrir = false;
|
||||
UltimoRx = Agora;
|
||||
UltimoTx = Agora;
|
||||
MostrarLog("Muito tempo sem receber novos dados, reiniciando conexao CAN...", 0);
|
||||
|
|
|
|||
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
Binary file not shown.
Loading…
Reference in New Issue