2025-05-30 20:11:31 +00:00
|
|
|
|
using AgroBase.Services;
|
2023-11-30 00:41:22 +00:00
|
|
|
|
using System;
|
|
|
|
|
|
using System.Collections.Generic;
|
|
|
|
|
|
using System.Linq;
|
|
|
|
|
|
using System.Threading.Tasks;
|
2024-07-26 19:54:25 +00:00
|
|
|
|
using static AgroBase.Models.Enums;
|
2025-04-09 21:11:40 +00:00
|
|
|
|
using System.Globalization;
|
2025-04-16 16:44:06 +00:00
|
|
|
|
using System.Data;
|
2025-05-09 20:17:28 +00:00
|
|
|
|
using static AgroBase.Services.LoRaEspService;
|
2025-07-11 16:38:08 +00:00
|
|
|
|
using AgroBase.Services.Operadores;
|
2025-09-15 10:23:07 +00:00
|
|
|
|
using System.Diagnostics;
|
2023-11-30 00:41:22 +00:00
|
|
|
|
|
|
|
|
|
|
namespace AgroBase.Models.Modules
|
|
|
|
|
|
{
|
2024-03-07 19:08:37 +00:00
|
|
|
|
public class SensoriamentoModel : DispositivoBaseModel
|
2023-11-30 00:41:22 +00:00
|
|
|
|
{
|
2025-04-09 21:11:40 +00:00
|
|
|
|
public T_Code Dispositivo { get; set; } = T_Code.Sen;
|
2024-06-08 01:20:23 +00:00
|
|
|
|
public string Modulo_ID { get; set; } = T_Code.Sen.ToString();
|
2025-05-01 18:27:01 +00:00
|
|
|
|
public byte _EnderecoCAN_Tx { get; set; } = 0x11;
|
|
|
|
|
|
public byte _EnderecoCAN_Rx { get; set; } = 0x12;
|
2025-04-09 21:11:40 +00:00
|
|
|
|
public int _TaxaAmostragem { get; set; } = 1000;
|
2025-07-17 11:19:42 +00:00
|
|
|
|
public double FrequenciaBase
|
|
|
|
|
|
{
|
|
|
|
|
|
get
|
|
|
|
|
|
{
|
|
|
|
|
|
return 1.0 / (_TaxaAmostragem / 1000.0);
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
2025-04-09 21:11:40 +00:00
|
|
|
|
public bool RequisitarDados { get; set; } = true;
|
2025-12-09 12:19:36 +00:00
|
|
|
|
public static int TempoLimiteConexao { get; set; } = 8000;
|
2025-06-20 20:10:08 +00:00
|
|
|
|
public bool Conectado
|
|
|
|
|
|
{
|
|
|
|
|
|
get
|
|
|
|
|
|
{
|
2025-12-10 16:37:47 +00:00
|
|
|
|
DateTime Agora = DateTime.Now;
|
|
|
|
|
|
bool modConectado = DadosLeitura.UltimoComandoRespondido.AddMilliseconds(TempoLimiteConexao) > Agora;
|
|
|
|
|
|
return modConectado;
|
2025-06-20 20:10:08 +00:00
|
|
|
|
}
|
|
|
|
|
|
}
|
2025-05-30 20:11:31 +00:00
|
|
|
|
public bool ConexaoAtiva
|
2025-02-03 19:54:39 +00:00
|
|
|
|
{
|
|
|
|
|
|
get
|
|
|
|
|
|
{
|
2025-07-11 16:38:08 +00:00
|
|
|
|
return HealthWorkerService.ModulosSaude.Any(x => x.modulo == Dispositivo && x.status == StatusModulo.Operante);
|
2025-02-03 19:54:39 +00:00
|
|
|
|
}
|
|
|
|
|
|
}
|
2025-05-30 20:11:31 +00:00
|
|
|
|
public SensoriamentoMensagemJsonModel DadosLeitura { get; set; } = new SensoriamentoMensagemJsonModel();
|
2024-04-15 10:57:37 +00:00
|
|
|
|
public static PinoutDataModel Pinout { get; set; }
|
2024-04-01 11:03:25 +00:00
|
|
|
|
public static List<FuncoesPinout> Funcoes { get; set; } = new List<FuncoesPinout>()
|
|
|
|
|
|
{
|
|
|
|
|
|
FuncoesPinout.SDA,
|
|
|
|
|
|
FuncoesPinout.SCL,
|
|
|
|
|
|
};
|
2023-11-30 00:41:22 +00:00
|
|
|
|
public List<SensorModel> Sensores { get; set; }
|
2024-07-12 19:44:56 +00:00
|
|
|
|
public List<SensorSinaleiroModel> Sinaleiros { get; set; }
|
2024-07-18 18:00:14 +00:00
|
|
|
|
public List<SensorReleModel> Reles { get; set; }
|
2024-07-24 20:04:55 +00:00
|
|
|
|
public List<SensorServoModel> Servos { get; set; }
|
2025-06-06 20:46:08 +00:00
|
|
|
|
public OAKCameraModel CameraCaminho { get; set; } = new OAKCameraModel();
|
|
|
|
|
|
public List<OAKCameraModel> CamerasSolo { get; set; } = new List<OAKCameraModel>();
|
2024-10-29 19:53:27 +00:00
|
|
|
|
public UltrasonicA05Configuracoes ConfiguracaoSensorUltrassom { get; set; }
|
2025-04-09 21:11:40 +00:00
|
|
|
|
private SenHandler _SenHandler = new SenHandler();
|
2025-04-30 21:49:17 +00:00
|
|
|
|
public LoRaEspService loRaService { get; set; } = new LoRaEspService();
|
2024-07-15 19:02:36 +00:00
|
|
|
|
public LoRaParametrosModel LoRaParametrosBase { get; set; } = new LoRaParametrosModel()
|
|
|
|
|
|
{
|
|
|
|
|
|
address = 0x01,
|
|
|
|
|
|
channel = 0x17,
|
2025-07-18 20:03:37 +00:00
|
|
|
|
tranMode = LoRaBaseService.CodigosTipoTransmissao["Fixed"],
|
|
|
|
|
|
baudRate = LoRaBaseService.CodigosBaudRates[9600],
|
|
|
|
|
|
airRate = LoRaBaseService.CodigosAirRates[2.4],
|
|
|
|
|
|
packetSize = LoRaBaseService.CodigosPacketSizes[200],
|
|
|
|
|
|
worCycle = LoRaBaseService.CodigosWorCycles[4000],
|
|
|
|
|
|
power = LoRaBaseService.CodigosPowers[22],
|
2024-07-15 19:02:36 +00:00
|
|
|
|
};
|
2025-04-24 21:11:33 +00:00
|
|
|
|
public CoulombCounterService ContadorCarga = new CoulombCounterService(VariaveisEquipamento.CorrenteMaximaBateria);
|
2025-12-11 12:29:08 +00:00
|
|
|
|
public CoolerControlService CoolerControl = new CoolerControlService();
|
2024-11-27 17:38:56 +00:00
|
|
|
|
public AsyncTaskTimerModel tmrRegistrador;
|
2024-12-05 12:52:28 +00:00
|
|
|
|
private int _TempoReconexaoComponentes = 5;
|
2024-11-29 20:28:25 +00:00
|
|
|
|
private int _VezesLeituraReconexao = 0;
|
2023-11-30 00:41:22 +00:00
|
|
|
|
|
|
|
|
|
|
public static SensoriamentoModel CarregarParametrosIniciais()
|
|
|
|
|
|
{
|
2025-02-14 19:33:06 +00:00
|
|
|
|
var obj = new SensoriamentoModel()
|
2023-11-30 00:41:22 +00:00
|
|
|
|
{
|
2025-05-01 18:27:01 +00:00
|
|
|
|
_EnderecoCAN_Tx = 0x11,
|
2025-05-30 20:11:31 +00:00
|
|
|
|
_EnderecoCAN_Rx = 0x11,
|
2025-04-09 21:11:40 +00:00
|
|
|
|
_TaxaAmostragem = 1000,
|
|
|
|
|
|
RequisitarDados = true,
|
2025-06-06 20:46:08 +00:00
|
|
|
|
CameraCaminho = new OAKCameraModel(),
|
|
|
|
|
|
CamerasSolo = new List<OAKCameraModel>(),
|
2025-12-11 12:29:08 +00:00
|
|
|
|
// 21 ~ 23
|
2024-04-02 18:33:15 +00:00
|
|
|
|
Sinaleiros = new List<SensorSinaleiroModel>()
|
|
|
|
|
|
{
|
|
|
|
|
|
new SensorSinaleiroModel()
|
|
|
|
|
|
{
|
|
|
|
|
|
ID = "LEDMN",
|
2025-04-09 21:11:40 +00:00
|
|
|
|
ID_Num = 21,
|
2024-04-02 18:33:15 +00:00
|
|
|
|
Descricao = "Sinaleiro indicação de modo Manual ativo",
|
|
|
|
|
|
Componente = S_Code.sLED,
|
2025-12-18 18:11:30 +00:00
|
|
|
|
Controlar = true,
|
|
|
|
|
|
Mandatorio = true,
|
2024-04-02 18:33:15 +00:00
|
|
|
|
Funcoes = new List<FuncoesPinout>()
|
|
|
|
|
|
{
|
|
|
|
|
|
FuncoesPinout.Sinaleiro,
|
2025-02-14 19:33:06 +00:00
|
|
|
|
},
|
2025-12-18 18:11:30 +00:00
|
|
|
|
Comportamento = VariaveisEquipamento.ComportamentoLedPorStatus(StatusLED.Apagado),
|
2025-05-30 20:11:31 +00:00
|
|
|
|
ValoresLeituras = new List<SensorValoresLeituraModel>()
|
|
|
|
|
|
{
|
|
|
|
|
|
new SensorValoresLeituraModel()
|
|
|
|
|
|
{
|
|
|
|
|
|
funcao = FuncoesPinout.Iniciado,
|
|
|
|
|
|
posicao = CanMessagePosicaoDados.Status,
|
|
|
|
|
|
indice = 0,
|
|
|
|
|
|
},
|
|
|
|
|
|
new SensorValoresLeituraModel()
|
|
|
|
|
|
{
|
2025-12-18 18:11:30 +00:00
|
|
|
|
funcao = FuncoesPinout.StatusLedID,
|
|
|
|
|
|
posicao = CanMessagePosicaoDados.Dados1,
|
2025-05-30 20:11:31 +00:00
|
|
|
|
indice = 0,
|
|
|
|
|
|
},
|
|
|
|
|
|
new SensorValoresLeituraModel()
|
|
|
|
|
|
{
|
2025-12-18 18:11:30 +00:00
|
|
|
|
funcao = FuncoesPinout.StatusLedLeitura,
|
|
|
|
|
|
posicao = CanMessagePosicaoDados.Dados1,
|
2025-05-30 20:11:31 +00:00
|
|
|
|
indice = 1,
|
|
|
|
|
|
},
|
|
|
|
|
|
}
|
2024-04-02 18:33:15 +00:00
|
|
|
|
},
|
|
|
|
|
|
new SensorSinaleiroModel()
|
|
|
|
|
|
{
|
|
|
|
|
|
ID = "LEDAT",
|
2025-04-09 21:11:40 +00:00
|
|
|
|
ID_Num = 22,
|
2024-04-02 18:33:15 +00:00
|
|
|
|
Descricao = "Sinaleiro indicação de modo Automático ativo",
|
|
|
|
|
|
Componente = S_Code.sLED,
|
2025-12-18 18:11:30 +00:00
|
|
|
|
Controlar = true,
|
|
|
|
|
|
Mandatorio = true,
|
2024-04-02 18:33:15 +00:00
|
|
|
|
Funcoes = new List<FuncoesPinout>()
|
|
|
|
|
|
{
|
|
|
|
|
|
FuncoesPinout.Sinaleiro,
|
2024-04-26 19:34:58 +00:00
|
|
|
|
},
|
2025-12-18 18:11:30 +00:00
|
|
|
|
Comportamento = VariaveisEquipamento.ComportamentoLedPorStatus(StatusLED.Apagado),
|
2025-05-30 20:11:31 +00:00
|
|
|
|
ValoresLeituras = new List<SensorValoresLeituraModel>()
|
|
|
|
|
|
{
|
|
|
|
|
|
new SensorValoresLeituraModel()
|
|
|
|
|
|
{
|
|
|
|
|
|
funcao = FuncoesPinout.Iniciado,
|
|
|
|
|
|
posicao = CanMessagePosicaoDados.Status,
|
|
|
|
|
|
indice = 0,
|
|
|
|
|
|
},
|
|
|
|
|
|
new SensorValoresLeituraModel()
|
|
|
|
|
|
{
|
2025-12-18 18:11:30 +00:00
|
|
|
|
funcao = FuncoesPinout.StatusLedID,
|
2025-05-30 20:11:31 +00:00
|
|
|
|
posicao = CanMessagePosicaoDados.Dados1,
|
|
|
|
|
|
indice = 0,
|
|
|
|
|
|
},
|
|
|
|
|
|
new SensorValoresLeituraModel()
|
|
|
|
|
|
{
|
2025-12-18 18:11:30 +00:00
|
|
|
|
funcao = FuncoesPinout.StatusLedLeitura,
|
2025-05-30 20:11:31 +00:00
|
|
|
|
posicao = CanMessagePosicaoDados.Dados1,
|
|
|
|
|
|
indice = 1,
|
|
|
|
|
|
},
|
|
|
|
|
|
}
|
2024-04-02 18:33:15 +00:00
|
|
|
|
},
|
|
|
|
|
|
new SensorSinaleiroModel()
|
|
|
|
|
|
{
|
|
|
|
|
|
ID = "LEDOP",
|
2025-04-09 21:11:40 +00:00
|
|
|
|
ID_Num = 23,
|
2024-04-02 18:33:15 +00:00
|
|
|
|
Descricao = "Sinaleiro indicação do status da operação ativa",
|
|
|
|
|
|
Componente = S_Code.sLED,
|
2025-12-18 18:11:30 +00:00
|
|
|
|
Controlar = true,
|
|
|
|
|
|
Mandatorio = true,
|
2024-04-02 18:33:15 +00:00
|
|
|
|
Funcoes = new List<FuncoesPinout>()
|
|
|
|
|
|
{
|
|
|
|
|
|
FuncoesPinout.Sinaleiro,
|
2024-04-26 19:34:58 +00:00
|
|
|
|
},
|
2025-12-18 18:11:30 +00:00
|
|
|
|
Comportamento = VariaveisEquipamento.ComportamentoLedPorStatus(StatusLED.Apagado),
|
2025-05-30 20:11:31 +00:00
|
|
|
|
ValoresLeituras = new List<SensorValoresLeituraModel>()
|
|
|
|
|
|
{
|
|
|
|
|
|
new SensorValoresLeituraModel()
|
|
|
|
|
|
{
|
|
|
|
|
|
funcao = FuncoesPinout.Iniciado,
|
|
|
|
|
|
posicao = CanMessagePosicaoDados.Status,
|
|
|
|
|
|
indice = 0,
|
|
|
|
|
|
},
|
|
|
|
|
|
new SensorValoresLeituraModel()
|
|
|
|
|
|
{
|
2025-12-18 18:11:30 +00:00
|
|
|
|
funcao = FuncoesPinout.StatusLedID,
|
2025-05-30 20:11:31 +00:00
|
|
|
|
posicao = CanMessagePosicaoDados.Dados1,
|
|
|
|
|
|
indice = 0,
|
|
|
|
|
|
},
|
|
|
|
|
|
new SensorValoresLeituraModel()
|
|
|
|
|
|
{
|
2025-12-18 18:11:30 +00:00
|
|
|
|
funcao = FuncoesPinout.StatusLedLeitura,
|
2025-05-30 20:11:31 +00:00
|
|
|
|
posicao = CanMessagePosicaoDados.Dados1,
|
|
|
|
|
|
indice = 1,
|
|
|
|
|
|
},
|
|
|
|
|
|
}
|
2024-04-02 18:33:15 +00:00
|
|
|
|
},
|
|
|
|
|
|
},
|
2023-11-30 00:41:22 +00:00
|
|
|
|
Sensores = new List<SensorModel>()
|
|
|
|
|
|
{
|
2025-12-11 12:29:08 +00:00
|
|
|
|
// sTMP 1 ~ 5
|
2023-11-30 00:41:22 +00:00
|
|
|
|
new SensorModel()
|
|
|
|
|
|
{
|
2024-01-18 19:22:28 +00:00
|
|
|
|
ID = "TMVET",
|
|
|
|
|
|
Descricao = "Temperatura Motor Esquerdo Trás",
|
2025-04-09 21:11:40 +00:00
|
|
|
|
ID_Num = 1,
|
2025-05-15 20:20:46 +00:00
|
|
|
|
Componente = S_Code.sNTC,
|
2025-02-14 19:33:06 +00:00
|
|
|
|
Aferir = true,
|
2025-05-07 16:54:45 +00:00
|
|
|
|
Mandatorio = false,
|
2024-01-18 19:22:28 +00:00
|
|
|
|
Funcoes = new List<FuncoesPinout>()
|
|
|
|
|
|
{
|
|
|
|
|
|
FuncoesPinout.TMP,
|
|
|
|
|
|
},
|
2025-04-09 21:11:40 +00:00
|
|
|
|
Parametros = new List<SensorParametroModel>()
|
2024-01-30 12:09:36 +00:00
|
|
|
|
{
|
2025-05-15 20:20:46 +00:00
|
|
|
|
new SensorParametroModel()
|
|
|
|
|
|
{
|
|
|
|
|
|
Descricao = "Canal MUX",
|
|
|
|
|
|
Valor = "-1",
|
|
|
|
|
|
QtdBytes = 1,
|
|
|
|
|
|
Escalar = false,
|
|
|
|
|
|
Enviar = true
|
|
|
|
|
|
},
|
2025-05-30 20:11:31 +00:00
|
|
|
|
},
|
|
|
|
|
|
ValoresLeituras = new List<SensorValoresLeituraModel>()
|
|
|
|
|
|
{
|
|
|
|
|
|
new SensorValoresLeituraModel()
|
|
|
|
|
|
{
|
|
|
|
|
|
funcao = FuncoesPinout.Iniciado,
|
|
|
|
|
|
posicao = CanMessagePosicaoDados.Status,
|
|
|
|
|
|
indice = 0,
|
|
|
|
|
|
},
|
|
|
|
|
|
new SensorValoresLeituraModel()
|
2025-12-18 10:34:50 +00:00
|
|
|
|
{
|
|
|
|
|
|
funcao = FuncoesPinout.LeituraBruta,
|
|
|
|
|
|
posicao = CanMessagePosicaoDados.Dados1,
|
|
|
|
|
|
indice = 0,
|
|
|
|
|
|
},
|
|
|
|
|
|
new SensorValoresLeituraModel()
|
2025-05-30 20:11:31 +00:00
|
|
|
|
{
|
|
|
|
|
|
funcao = FuncoesPinout.Temperatura,
|
|
|
|
|
|
posicao = CanMessagePosicaoDados.Dados1,
|
2025-12-18 10:34:50 +00:00
|
|
|
|
indice = 1,
|
2025-05-30 20:11:31 +00:00
|
|
|
|
analise_health = true,
|
|
|
|
|
|
maximo = 80,
|
|
|
|
|
|
minimo = 5,
|
|
|
|
|
|
nominal = 25,
|
|
|
|
|
|
unidade_medida = "ºC"
|
|
|
|
|
|
}
|
2025-04-09 21:11:40 +00:00
|
|
|
|
}
|
2024-01-18 19:22:28 +00:00
|
|
|
|
},
|
|
|
|
|
|
new SensorModel()
|
|
|
|
|
|
{
|
|
|
|
|
|
ID = "TMVEF",
|
|
|
|
|
|
Descricao = "Temperatura Motor Esquerdo Frente",
|
2025-04-09 21:11:40 +00:00
|
|
|
|
ID_Num = 2,
|
2025-05-15 20:20:46 +00:00
|
|
|
|
Componente = S_Code.sNTC,
|
2024-01-18 19:22:28 +00:00
|
|
|
|
Aferir = true,
|
2025-05-07 16:54:45 +00:00
|
|
|
|
Mandatorio = false,
|
2024-01-18 19:22:28 +00:00
|
|
|
|
Funcoes = new List<FuncoesPinout>()
|
|
|
|
|
|
{
|
|
|
|
|
|
FuncoesPinout.TMP,
|
|
|
|
|
|
},
|
2025-04-09 21:11:40 +00:00
|
|
|
|
Parametros = new List<SensorParametroModel>()
|
2024-01-30 12:09:36 +00:00
|
|
|
|
{
|
2025-05-15 20:20:46 +00:00
|
|
|
|
new SensorParametroModel()
|
|
|
|
|
|
{
|
|
|
|
|
|
Descricao = "Canal MUX",
|
|
|
|
|
|
Valor = "-1",
|
|
|
|
|
|
QtdBytes = 1,
|
|
|
|
|
|
Escalar = false,
|
|
|
|
|
|
Enviar = true
|
|
|
|
|
|
},
|
2025-05-30 20:11:31 +00:00
|
|
|
|
},
|
|
|
|
|
|
ValoresLeituras = new List<SensorValoresLeituraModel>()
|
|
|
|
|
|
{
|
|
|
|
|
|
new SensorValoresLeituraModel()
|
|
|
|
|
|
{
|
|
|
|
|
|
funcao = FuncoesPinout.Iniciado,
|
|
|
|
|
|
posicao = CanMessagePosicaoDados.Status,
|
|
|
|
|
|
indice = 0,
|
|
|
|
|
|
},
|
|
|
|
|
|
new SensorValoresLeituraModel()
|
2025-12-18 10:34:50 +00:00
|
|
|
|
{
|
|
|
|
|
|
funcao = FuncoesPinout.LeituraBruta,
|
|
|
|
|
|
posicao = CanMessagePosicaoDados.Dados1,
|
|
|
|
|
|
indice = 0,
|
|
|
|
|
|
},
|
|
|
|
|
|
new SensorValoresLeituraModel()
|
2025-05-30 20:11:31 +00:00
|
|
|
|
{
|
|
|
|
|
|
funcao = FuncoesPinout.Temperatura,
|
|
|
|
|
|
posicao = CanMessagePosicaoDados.Dados1,
|
2025-12-18 10:34:50 +00:00
|
|
|
|
indice = 1,
|
2025-05-30 20:11:31 +00:00
|
|
|
|
analise_health = true,
|
|
|
|
|
|
maximo = 80,
|
|
|
|
|
|
minimo = 5,
|
|
|
|
|
|
nominal = 25,
|
|
|
|
|
|
unidade_medida = "ºC"
|
|
|
|
|
|
}
|
2025-04-09 21:11:40 +00:00
|
|
|
|
}
|
2024-01-18 19:22:28 +00:00
|
|
|
|
},
|
|
|
|
|
|
new SensorModel()
|
|
|
|
|
|
{
|
|
|
|
|
|
ID = "TMVDT",
|
|
|
|
|
|
Descricao = "Temperatura Motor Direito Trás",
|
2025-04-09 21:11:40 +00:00
|
|
|
|
ID_Num = 3,
|
2025-05-15 20:20:46 +00:00
|
|
|
|
Componente = S_Code.sNTC,
|
2024-01-18 19:22:28 +00:00
|
|
|
|
Aferir = true,
|
2025-05-07 16:54:45 +00:00
|
|
|
|
Mandatorio = false,
|
2024-01-18 19:22:28 +00:00
|
|
|
|
Funcoes = new List<FuncoesPinout>()
|
|
|
|
|
|
{
|
|
|
|
|
|
FuncoesPinout.TMP,
|
|
|
|
|
|
},
|
2025-04-09 21:11:40 +00:00
|
|
|
|
Parametros = new List<SensorParametroModel>()
|
2024-01-30 12:09:36 +00:00
|
|
|
|
{
|
2025-05-15 20:20:46 +00:00
|
|
|
|
new SensorParametroModel()
|
|
|
|
|
|
{
|
|
|
|
|
|
Descricao = "Canal MUX",
|
|
|
|
|
|
Valor = "-1",
|
|
|
|
|
|
QtdBytes = 1,
|
|
|
|
|
|
Escalar = false,
|
|
|
|
|
|
Enviar = true
|
|
|
|
|
|
},
|
2025-05-30 20:11:31 +00:00
|
|
|
|
},
|
|
|
|
|
|
ValoresLeituras = new List<SensorValoresLeituraModel>()
|
|
|
|
|
|
{
|
|
|
|
|
|
new SensorValoresLeituraModel()
|
|
|
|
|
|
{
|
|
|
|
|
|
funcao = FuncoesPinout.Iniciado,
|
|
|
|
|
|
posicao = CanMessagePosicaoDados.Status,
|
|
|
|
|
|
indice = 0,
|
|
|
|
|
|
},
|
|
|
|
|
|
new SensorValoresLeituraModel()
|
2025-12-18 10:34:50 +00:00
|
|
|
|
{
|
|
|
|
|
|
funcao = FuncoesPinout.LeituraBruta,
|
|
|
|
|
|
posicao = CanMessagePosicaoDados.Dados1,
|
|
|
|
|
|
indice = 0,
|
|
|
|
|
|
},
|
|
|
|
|
|
new SensorValoresLeituraModel()
|
2025-05-30 20:11:31 +00:00
|
|
|
|
{
|
|
|
|
|
|
funcao = FuncoesPinout.Temperatura,
|
|
|
|
|
|
posicao = CanMessagePosicaoDados.Dados1,
|
2025-12-18 10:34:50 +00:00
|
|
|
|
indice = 1,
|
2025-05-30 20:11:31 +00:00
|
|
|
|
analise_health = true,
|
|
|
|
|
|
maximo = 80,
|
|
|
|
|
|
minimo = 5,
|
|
|
|
|
|
nominal = 25,
|
|
|
|
|
|
unidade_medida = "ºC"
|
|
|
|
|
|
}
|
2025-04-09 21:11:40 +00:00
|
|
|
|
}
|
2024-01-18 19:22:28 +00:00
|
|
|
|
},
|
|
|
|
|
|
new SensorModel()
|
|
|
|
|
|
{
|
|
|
|
|
|
ID = "TMVDF",
|
|
|
|
|
|
Descricao = "Temperatura Motor Direito Frente",
|
2025-04-09 21:11:40 +00:00
|
|
|
|
ID_Num = 4,
|
2025-05-15 20:20:46 +00:00
|
|
|
|
Componente = S_Code.sNTC,
|
2024-01-18 19:22:28 +00:00
|
|
|
|
Aferir = true,
|
2025-05-07 16:54:45 +00:00
|
|
|
|
Mandatorio = false,
|
2024-01-18 19:22:28 +00:00
|
|
|
|
Funcoes = new List<FuncoesPinout>()
|
|
|
|
|
|
{
|
|
|
|
|
|
FuncoesPinout.TMP,
|
|
|
|
|
|
},
|
2025-04-09 21:11:40 +00:00
|
|
|
|
Parametros = new List<SensorParametroModel>()
|
|
|
|
|
|
{
|
2025-05-15 20:20:46 +00:00
|
|
|
|
new SensorParametroModel()
|
|
|
|
|
|
{
|
|
|
|
|
|
Descricao = "Canal MUX",
|
|
|
|
|
|
Valor = "-1",
|
|
|
|
|
|
QtdBytes = 1,
|
|
|
|
|
|
Escalar = false,
|
|
|
|
|
|
Enviar = true
|
|
|
|
|
|
},
|
2025-05-30 20:11:31 +00:00
|
|
|
|
},
|
|
|
|
|
|
ValoresLeituras = new List<SensorValoresLeituraModel>()
|
|
|
|
|
|
{
|
|
|
|
|
|
new SensorValoresLeituraModel()
|
|
|
|
|
|
{
|
|
|
|
|
|
funcao = FuncoesPinout.Iniciado,
|
|
|
|
|
|
posicao = CanMessagePosicaoDados.Status,
|
|
|
|
|
|
indice = 0,
|
|
|
|
|
|
},
|
|
|
|
|
|
new SensorValoresLeituraModel()
|
2025-12-18 10:34:50 +00:00
|
|
|
|
{
|
|
|
|
|
|
funcao = FuncoesPinout.LeituraBruta,
|
|
|
|
|
|
posicao = CanMessagePosicaoDados.Dados1,
|
|
|
|
|
|
indice = 0,
|
|
|
|
|
|
},
|
|
|
|
|
|
new SensorValoresLeituraModel()
|
2025-05-30 20:11:31 +00:00
|
|
|
|
{
|
|
|
|
|
|
funcao = FuncoesPinout.Temperatura,
|
|
|
|
|
|
posicao = CanMessagePosicaoDados.Dados1,
|
2025-12-18 10:34:50 +00:00
|
|
|
|
indice = 1,
|
2025-05-30 20:11:31 +00:00
|
|
|
|
analise_health = true,
|
|
|
|
|
|
maximo = 80,
|
|
|
|
|
|
minimo = 5,
|
|
|
|
|
|
nominal = 25,
|
|
|
|
|
|
unidade_medida = "ºC"
|
|
|
|
|
|
}
|
2025-04-09 21:11:40 +00:00
|
|
|
|
}
|
|
|
|
|
|
},
|
|
|
|
|
|
new SensorModel()
|
|
|
|
|
|
{
|
|
|
|
|
|
ID = "TBAT",
|
|
|
|
|
|
Descricao = "Temperatura da bateria",
|
|
|
|
|
|
ID_Num = 5,
|
2025-05-15 20:20:46 +00:00
|
|
|
|
Componente = S_Code.sNTC,
|
2025-04-09 21:11:40 +00:00
|
|
|
|
Aferir = false,
|
2025-05-07 16:54:45 +00:00
|
|
|
|
Mandatorio = false,
|
2025-04-09 21:11:40 +00:00
|
|
|
|
Funcoes = new List<FuncoesPinout>()
|
2024-01-30 12:09:36 +00:00
|
|
|
|
{
|
2025-04-09 21:11:40 +00:00
|
|
|
|
FuncoesPinout.TMP,
|
2024-01-30 12:09:36 +00:00
|
|
|
|
},
|
2025-04-09 21:11:40 +00:00
|
|
|
|
Parametros = new List<SensorParametroModel>()
|
|
|
|
|
|
{
|
2025-05-15 20:20:46 +00:00
|
|
|
|
new SensorParametroModel()
|
|
|
|
|
|
{
|
|
|
|
|
|
Descricao = "Canal MUX",
|
|
|
|
|
|
Valor = "-1",
|
|
|
|
|
|
QtdBytes = 1,
|
|
|
|
|
|
Escalar = false,
|
|
|
|
|
|
Enviar = true
|
|
|
|
|
|
},
|
2025-05-30 20:11:31 +00:00
|
|
|
|
},
|
|
|
|
|
|
ValoresLeituras = new List<SensorValoresLeituraModel>()
|
|
|
|
|
|
{
|
|
|
|
|
|
new SensorValoresLeituraModel()
|
|
|
|
|
|
{
|
|
|
|
|
|
funcao = FuncoesPinout.Iniciado,
|
|
|
|
|
|
posicao = CanMessagePosicaoDados.Status,
|
|
|
|
|
|
indice = 0,
|
|
|
|
|
|
},
|
|
|
|
|
|
new SensorValoresLeituraModel()
|
2025-12-18 10:34:50 +00:00
|
|
|
|
{
|
|
|
|
|
|
funcao = FuncoesPinout.LeituraBruta,
|
|
|
|
|
|
posicao = CanMessagePosicaoDados.Dados1,
|
|
|
|
|
|
indice = 0,
|
|
|
|
|
|
},
|
|
|
|
|
|
new SensorValoresLeituraModel()
|
2025-05-30 20:11:31 +00:00
|
|
|
|
{
|
|
|
|
|
|
funcao = FuncoesPinout.Temperatura,
|
|
|
|
|
|
posicao = CanMessagePosicaoDados.Dados1,
|
2025-12-18 10:34:50 +00:00
|
|
|
|
indice = 1,
|
2025-05-30 20:11:31 +00:00
|
|
|
|
analise_health = true,
|
|
|
|
|
|
maximo = 50,
|
|
|
|
|
|
minimo = 5,
|
|
|
|
|
|
nominal = 25,
|
|
|
|
|
|
unidade_medida = "ºC"
|
|
|
|
|
|
}
|
2025-04-09 21:11:40 +00:00
|
|
|
|
}
|
2024-01-18 19:22:28 +00:00
|
|
|
|
},
|
2025-12-11 12:29:08 +00:00
|
|
|
|
// sCOR 11 ~ 17
|
2025-04-09 21:11:40 +00:00
|
|
|
|
new SensorModel()
|
2024-01-18 19:22:28 +00:00
|
|
|
|
{
|
2024-04-15 10:57:37 +00:00
|
|
|
|
ID = "AB3V",
|
|
|
|
|
|
Descricao = "Corrente no Barramento 3V",
|
2025-04-09 21:11:40 +00:00
|
|
|
|
ID_Num = 11,
|
2023-11-30 00:41:22 +00:00
|
|
|
|
Componente = S_Code.sCOR,
|
2025-05-15 20:20:46 +00:00
|
|
|
|
Aferir = true,
|
2025-05-07 16:54:45 +00:00
|
|
|
|
Mandatorio = false,
|
2023-11-30 00:41:22 +00:00
|
|
|
|
Funcoes = new List<FuncoesPinout>()
|
|
|
|
|
|
{
|
2024-02-21 19:40:38 +00:00
|
|
|
|
FuncoesPinout.I2C,
|
2024-01-23 17:10:34 +00:00
|
|
|
|
},
|
2025-04-09 21:11:40 +00:00
|
|
|
|
Parametros = new List<SensorParametroModel>()
|
2024-01-23 17:10:34 +00:00
|
|
|
|
{
|
2025-04-09 21:11:40 +00:00
|
|
|
|
new SensorParametroModel()
|
|
|
|
|
|
{
|
|
|
|
|
|
Descricao = "Endereço I2C",
|
2025-04-24 21:11:33 +00:00
|
|
|
|
Valor = "0x40",
|
2025-04-09 21:11:40 +00:00
|
|
|
|
QtdBytes = 1,
|
|
|
|
|
|
Escalar = false,
|
|
|
|
|
|
Enviar = true
|
|
|
|
|
|
},
|
|
|
|
|
|
new SensorParametroModel()
|
|
|
|
|
|
{
|
2025-04-24 21:11:33 +00:00
|
|
|
|
Descricao = "Shunt",
|
|
|
|
|
|
Valor = ((int)TiposShuntCorrente.INA219_3A2).ToString(),
|
|
|
|
|
|
QtdBytes = 1,
|
|
|
|
|
|
Escalar = false,
|
|
|
|
|
|
Enviar = true
|
|
|
|
|
|
},
|
|
|
|
|
|
new SensorParametroModel()
|
|
|
|
|
|
{
|
|
|
|
|
|
Descricao = "Canal MUX",
|
2025-06-20 20:10:08 +00:00
|
|
|
|
Valor = "5",
|
2025-04-24 21:11:33 +00:00
|
|
|
|
QtdBytes = 1,
|
|
|
|
|
|
Escalar = false,
|
2025-04-09 21:11:40 +00:00
|
|
|
|
Enviar = true
|
|
|
|
|
|
},
|
2025-05-30 20:11:31 +00:00
|
|
|
|
},
|
|
|
|
|
|
ValoresLeituras = new List<SensorValoresLeituraModel>()
|
|
|
|
|
|
{
|
|
|
|
|
|
new SensorValoresLeituraModel()
|
|
|
|
|
|
{
|
|
|
|
|
|
funcao = FuncoesPinout.Iniciado,
|
|
|
|
|
|
posicao = CanMessagePosicaoDados.Status,
|
|
|
|
|
|
indice = 0,
|
|
|
|
|
|
},
|
|
|
|
|
|
new SensorValoresLeituraModel()
|
|
|
|
|
|
{
|
|
|
|
|
|
funcao = FuncoesPinout.Tensao,
|
|
|
|
|
|
posicao = CanMessagePosicaoDados.Dados1,
|
|
|
|
|
|
indice = 0,
|
|
|
|
|
|
analise_health = true,
|
2025-06-20 20:10:08 +00:00
|
|
|
|
maximo = 3.4,
|
|
|
|
|
|
minimo = 3.0,
|
|
|
|
|
|
nominal = 3.3,
|
2025-05-30 20:11:31 +00:00
|
|
|
|
unidade_medida = "V"
|
|
|
|
|
|
},
|
|
|
|
|
|
new SensorValoresLeituraModel()
|
|
|
|
|
|
{
|
|
|
|
|
|
funcao = FuncoesPinout.Corrente,
|
|
|
|
|
|
posicao = CanMessagePosicaoDados.Dados1,
|
|
|
|
|
|
indice = 1,
|
|
|
|
|
|
analise_health = true,
|
2025-06-20 20:10:08 +00:00
|
|
|
|
maximo = 500,
|
|
|
|
|
|
minimo = 50,
|
|
|
|
|
|
nominal = 100,
|
2025-05-30 20:11:31 +00:00
|
|
|
|
unidade_medida = "mA"
|
|
|
|
|
|
},
|
|
|
|
|
|
new SensorValoresLeituraModel()
|
|
|
|
|
|
{
|
|
|
|
|
|
funcao = FuncoesPinout.Potencia,
|
|
|
|
|
|
posicao = CanMessagePosicaoDados.Dados1,
|
|
|
|
|
|
indice = 2,
|
|
|
|
|
|
unidade_medida = "mW"
|
|
|
|
|
|
},
|
|
|
|
|
|
new SensorValoresLeituraModel()
|
|
|
|
|
|
{
|
|
|
|
|
|
funcao = FuncoesPinout.Energia,
|
|
|
|
|
|
posicao = CanMessagePosicaoDados.Dados2,
|
|
|
|
|
|
indice = 0,
|
|
|
|
|
|
unidade_medida = "mW/h"
|
|
|
|
|
|
},
|
|
|
|
|
|
new SensorValoresLeituraModel()
|
|
|
|
|
|
{
|
|
|
|
|
|
funcao = FuncoesPinout.Temperatura,
|
|
|
|
|
|
posicao = CanMessagePosicaoDados.Dados2,
|
|
|
|
|
|
indice = 1,
|
|
|
|
|
|
maximo = 60,
|
|
|
|
|
|
minimo = 0,
|
|
|
|
|
|
nominal = 25,
|
|
|
|
|
|
unidade_medida = "ºC"
|
2025-06-20 20:10:08 +00:00
|
|
|
|
},
|
|
|
|
|
|
new SensorValoresLeituraModel()
|
|
|
|
|
|
{
|
|
|
|
|
|
funcao = FuncoesPinout.CodAlarme,
|
|
|
|
|
|
posicao = CanMessagePosicaoDados.Dados2,
|
|
|
|
|
|
indice = 2,
|
2025-05-30 20:11:31 +00:00
|
|
|
|
}
|
2025-04-09 21:11:40 +00:00
|
|
|
|
}
|
|
|
|
|
|
},
|
2024-02-21 19:40:38 +00:00
|
|
|
|
new SensorModel()
|
|
|
|
|
|
{
|
2024-04-15 10:57:37 +00:00
|
|
|
|
ID = "AB5V",
|
|
|
|
|
|
Descricao = "Corrente no Barramento 5V",
|
2025-04-09 21:11:40 +00:00
|
|
|
|
ID_Num = 12,
|
2024-02-21 19:40:38 +00:00
|
|
|
|
Componente = S_Code.sCOR,
|
|
|
|
|
|
Aferir = true,
|
2025-05-07 16:54:45 +00:00
|
|
|
|
Mandatorio = false,
|
2024-02-21 19:40:38 +00:00
|
|
|
|
Funcoes = new List<FuncoesPinout>()
|
|
|
|
|
|
{
|
|
|
|
|
|
FuncoesPinout.I2C,
|
|
|
|
|
|
},
|
2025-04-09 21:11:40 +00:00
|
|
|
|
Parametros = new List<SensorParametroModel>()
|
2024-02-21 19:40:38 +00:00
|
|
|
|
{
|
2025-04-09 21:11:40 +00:00
|
|
|
|
new SensorParametroModel()
|
|
|
|
|
|
{
|
|
|
|
|
|
Descricao = "Endereço I2C",
|
2025-04-24 21:11:33 +00:00
|
|
|
|
Valor = "0x40",
|
2025-04-09 21:11:40 +00:00
|
|
|
|
QtdBytes = 1,
|
|
|
|
|
|
Escalar = false,
|
|
|
|
|
|
Enviar = true
|
|
|
|
|
|
},
|
|
|
|
|
|
new SensorParametroModel()
|
|
|
|
|
|
{
|
2025-04-24 21:11:33 +00:00
|
|
|
|
Descricao = "Shunt",
|
|
|
|
|
|
Valor = ((int)TiposShuntCorrente.INA219_3A2).ToString(),
|
|
|
|
|
|
QtdBytes = 1,
|
|
|
|
|
|
Escalar = false,
|
|
|
|
|
|
Enviar = true
|
|
|
|
|
|
},
|
|
|
|
|
|
new SensorParametroModel()
|
|
|
|
|
|
{
|
|
|
|
|
|
Descricao = "Canal MUX",
|
2025-06-20 20:10:08 +00:00
|
|
|
|
Valor = "4",
|
2025-04-24 21:11:33 +00:00
|
|
|
|
QtdBytes = 1,
|
|
|
|
|
|
Escalar = false,
|
2025-04-09 21:11:40 +00:00
|
|
|
|
Enviar = true
|
|
|
|
|
|
},
|
2025-05-30 20:11:31 +00:00
|
|
|
|
},
|
|
|
|
|
|
ValoresLeituras = new List<SensorValoresLeituraModel>()
|
|
|
|
|
|
{
|
|
|
|
|
|
new SensorValoresLeituraModel()
|
|
|
|
|
|
{
|
|
|
|
|
|
funcao = FuncoesPinout.Iniciado,
|
|
|
|
|
|
posicao = CanMessagePosicaoDados.Status,
|
|
|
|
|
|
indice = 0,
|
|
|
|
|
|
},
|
|
|
|
|
|
new SensorValoresLeituraModel()
|
|
|
|
|
|
{
|
|
|
|
|
|
funcao = FuncoesPinout.Tensao,
|
|
|
|
|
|
posicao = CanMessagePosicaoDados.Dados1,
|
|
|
|
|
|
indice = 0,
|
|
|
|
|
|
analise_health = true,
|
|
|
|
|
|
maximo = 5.2,
|
|
|
|
|
|
minimo = 4.9,
|
|
|
|
|
|
nominal = 5.0,
|
|
|
|
|
|
unidade_medida = "V"
|
|
|
|
|
|
},
|
|
|
|
|
|
new SensorValoresLeituraModel()
|
|
|
|
|
|
{
|
|
|
|
|
|
funcao = FuncoesPinout.Corrente,
|
|
|
|
|
|
posicao = CanMessagePosicaoDados.Dados1,
|
|
|
|
|
|
indice = 1,
|
|
|
|
|
|
analise_health = true,
|
|
|
|
|
|
maximo = 1000,
|
|
|
|
|
|
minimo = 50,
|
|
|
|
|
|
nominal = 300,
|
|
|
|
|
|
unidade_medida = "mA"
|
|
|
|
|
|
},
|
|
|
|
|
|
new SensorValoresLeituraModel()
|
|
|
|
|
|
{
|
|
|
|
|
|
funcao = FuncoesPinout.Potencia,
|
|
|
|
|
|
posicao = CanMessagePosicaoDados.Dados1,
|
|
|
|
|
|
indice = 2,
|
|
|
|
|
|
unidade_medida = "mW"
|
|
|
|
|
|
},
|
|
|
|
|
|
new SensorValoresLeituraModel()
|
|
|
|
|
|
{
|
|
|
|
|
|
funcao = FuncoesPinout.Energia,
|
|
|
|
|
|
posicao = CanMessagePosicaoDados.Dados2,
|
|
|
|
|
|
indice = 0,
|
|
|
|
|
|
unidade_medida = "mW/h"
|
|
|
|
|
|
},
|
|
|
|
|
|
new SensorValoresLeituraModel()
|
|
|
|
|
|
{
|
|
|
|
|
|
funcao = FuncoesPinout.Temperatura,
|
|
|
|
|
|
posicao = CanMessagePosicaoDados.Dados2,
|
|
|
|
|
|
indice = 1,
|
|
|
|
|
|
maximo = 60,
|
|
|
|
|
|
minimo = 0,
|
|
|
|
|
|
nominal = 25,
|
|
|
|
|
|
unidade_medida = "ºC"
|
2025-06-20 20:10:08 +00:00
|
|
|
|
},
|
|
|
|
|
|
new SensorValoresLeituraModel()
|
|
|
|
|
|
{
|
|
|
|
|
|
funcao = FuncoesPinout.CodAlarme,
|
|
|
|
|
|
posicao = CanMessagePosicaoDados.Dados2,
|
|
|
|
|
|
indice = 2,
|
2025-05-30 20:11:31 +00:00
|
|
|
|
}
|
2025-04-09 21:11:40 +00:00
|
|
|
|
}
|
2024-02-21 19:40:38 +00:00
|
|
|
|
},
|
2025-02-03 19:54:39 +00:00
|
|
|
|
new SensorModel()
|
2024-02-21 19:40:38 +00:00
|
|
|
|
{
|
2024-04-15 10:57:37 +00:00
|
|
|
|
ID = "AB7V2",
|
|
|
|
|
|
Descricao = "Corrente no Barramento 7,2V",
|
2025-04-09 21:11:40 +00:00
|
|
|
|
ID_Num = 13,
|
2024-02-21 19:40:38 +00:00
|
|
|
|
Componente = S_Code.sCOR,
|
|
|
|
|
|
Aferir = true,
|
2025-05-07 16:54:45 +00:00
|
|
|
|
Mandatorio = false,
|
2024-02-21 19:40:38 +00:00
|
|
|
|
Funcoes = new List<FuncoesPinout>()
|
|
|
|
|
|
{
|
|
|
|
|
|
FuncoesPinout.I2C,
|
|
|
|
|
|
},
|
2025-04-09 21:11:40 +00:00
|
|
|
|
Parametros = new List<SensorParametroModel>()
|
2024-02-21 19:40:38 +00:00
|
|
|
|
{
|
2025-04-09 21:11:40 +00:00
|
|
|
|
new SensorParametroModel()
|
|
|
|
|
|
{
|
|
|
|
|
|
Descricao = "Endereço I2C",
|
2025-04-24 21:11:33 +00:00
|
|
|
|
Valor = "0x40",
|
2025-04-09 21:11:40 +00:00
|
|
|
|
QtdBytes = 1,
|
|
|
|
|
|
Escalar = false,
|
|
|
|
|
|
Enviar = true
|
|
|
|
|
|
},
|
|
|
|
|
|
new SensorParametroModel()
|
|
|
|
|
|
{
|
2025-04-24 21:11:33 +00:00
|
|
|
|
Descricao = "Shunt",
|
|
|
|
|
|
Valor = ((int)TiposShuntCorrente.INA219_3A2).ToString(),
|
|
|
|
|
|
QtdBytes = 1,
|
|
|
|
|
|
Escalar = false,
|
|
|
|
|
|
Enviar = true
|
|
|
|
|
|
},
|
|
|
|
|
|
new SensorParametroModel()
|
|
|
|
|
|
{
|
|
|
|
|
|
Descricao = "Canal MUX",
|
|
|
|
|
|
Valor = "2",
|
|
|
|
|
|
QtdBytes = 1,
|
|
|
|
|
|
Escalar = false,
|
2025-04-09 21:11:40 +00:00
|
|
|
|
Enviar = true
|
|
|
|
|
|
},
|
2025-05-30 20:11:31 +00:00
|
|
|
|
},
|
|
|
|
|
|
ValoresLeituras = new List<SensorValoresLeituraModel>()
|
|
|
|
|
|
{
|
|
|
|
|
|
new SensorValoresLeituraModel()
|
|
|
|
|
|
{
|
|
|
|
|
|
funcao = FuncoesPinout.Iniciado,
|
|
|
|
|
|
posicao = CanMessagePosicaoDados.Status,
|
|
|
|
|
|
indice = 0,
|
|
|
|
|
|
},
|
|
|
|
|
|
new SensorValoresLeituraModel()
|
|
|
|
|
|
{
|
|
|
|
|
|
funcao = FuncoesPinout.Tensao,
|
|
|
|
|
|
posicao = CanMessagePosicaoDados.Dados1,
|
|
|
|
|
|
indice = 0,
|
|
|
|
|
|
analise_health = true,
|
|
|
|
|
|
maximo = 7.4,
|
|
|
|
|
|
minimo = 7.0,
|
|
|
|
|
|
nominal = 7.2,
|
|
|
|
|
|
unidade_medida = "V"
|
|
|
|
|
|
},
|
|
|
|
|
|
new SensorValoresLeituraModel()
|
|
|
|
|
|
{
|
|
|
|
|
|
funcao = FuncoesPinout.Corrente,
|
|
|
|
|
|
posicao = CanMessagePosicaoDados.Dados1,
|
|
|
|
|
|
indice = 1,
|
|
|
|
|
|
analise_health = true,
|
|
|
|
|
|
maximo = 3000,
|
|
|
|
|
|
minimo = 0,
|
|
|
|
|
|
nominal = 10,
|
|
|
|
|
|
unidade_medida = "mA"
|
|
|
|
|
|
},
|
|
|
|
|
|
new SensorValoresLeituraModel()
|
|
|
|
|
|
{
|
|
|
|
|
|
funcao = FuncoesPinout.Potencia,
|
|
|
|
|
|
posicao = CanMessagePosicaoDados.Dados1,
|
|
|
|
|
|
indice = 2,
|
|
|
|
|
|
unidade_medida = "mW"
|
|
|
|
|
|
},
|
|
|
|
|
|
new SensorValoresLeituraModel()
|
|
|
|
|
|
{
|
|
|
|
|
|
funcao = FuncoesPinout.Energia,
|
|
|
|
|
|
posicao = CanMessagePosicaoDados.Dados2,
|
|
|
|
|
|
indice = 0,
|
|
|
|
|
|
unidade_medida = "mW/h"
|
|
|
|
|
|
},
|
|
|
|
|
|
new SensorValoresLeituraModel()
|
|
|
|
|
|
{
|
|
|
|
|
|
funcao = FuncoesPinout.Temperatura,
|
|
|
|
|
|
posicao = CanMessagePosicaoDados.Dados2,
|
|
|
|
|
|
indice = 1,
|
|
|
|
|
|
maximo = 60,
|
|
|
|
|
|
minimo = 0,
|
|
|
|
|
|
nominal = 25,
|
|
|
|
|
|
unidade_medida = "ºC"
|
2025-06-20 20:10:08 +00:00
|
|
|
|
},
|
|
|
|
|
|
new SensorValoresLeituraModel()
|
|
|
|
|
|
{
|
|
|
|
|
|
funcao = FuncoesPinout.CodAlarme,
|
|
|
|
|
|
posicao = CanMessagePosicaoDados.Dados2,
|
|
|
|
|
|
indice = 2,
|
2025-05-30 20:11:31 +00:00
|
|
|
|
}
|
2025-04-09 21:11:40 +00:00
|
|
|
|
}
|
2025-02-03 19:54:39 +00:00
|
|
|
|
},
|
2024-02-21 19:40:38 +00:00
|
|
|
|
new SensorModel()
|
|
|
|
|
|
{
|
2024-04-15 10:57:37 +00:00
|
|
|
|
ID = "AB12V",
|
|
|
|
|
|
Descricao = "Corrente no Barramento 12V",
|
2025-04-09 21:11:40 +00:00
|
|
|
|
ID_Num = 14,
|
2024-02-21 19:40:38 +00:00
|
|
|
|
Componente = S_Code.sCOR,
|
|
|
|
|
|
Aferir = true,
|
2025-05-07 16:54:45 +00:00
|
|
|
|
Mandatorio = false,
|
2024-02-21 19:40:38 +00:00
|
|
|
|
Funcoes = new List<FuncoesPinout>()
|
|
|
|
|
|
{
|
|
|
|
|
|
FuncoesPinout.I2C,
|
|
|
|
|
|
},
|
2025-04-09 21:11:40 +00:00
|
|
|
|
Parametros = new List<SensorParametroModel>()
|
2024-01-30 12:09:36 +00:00
|
|
|
|
{
|
2025-04-09 21:11:40 +00:00
|
|
|
|
new SensorParametroModel()
|
|
|
|
|
|
{
|
|
|
|
|
|
Descricao = "Endereço I2C",
|
|
|
|
|
|
Valor = "0x40",
|
|
|
|
|
|
QtdBytes = 1,
|
|
|
|
|
|
Escalar = false,
|
|
|
|
|
|
Enviar = true
|
|
|
|
|
|
},
|
|
|
|
|
|
new SensorParametroModel()
|
|
|
|
|
|
{
|
2025-04-24 21:11:33 +00:00
|
|
|
|
Descricao = "Shunt",
|
|
|
|
|
|
Valor = ((int)TiposShuntCorrente.INA228_50A).ToString(),
|
|
|
|
|
|
QtdBytes = 1,
|
|
|
|
|
|
Escalar = false,
|
|
|
|
|
|
Enviar = true
|
|
|
|
|
|
},
|
|
|
|
|
|
new SensorParametroModel()
|
|
|
|
|
|
{
|
|
|
|
|
|
Descricao = "Canal MUX",
|
|
|
|
|
|
Valor = "3",
|
|
|
|
|
|
QtdBytes = 1,
|
|
|
|
|
|
Escalar = false,
|
|
|
|
|
|
Enviar = true
|
|
|
|
|
|
},
|
2025-05-30 20:11:31 +00:00
|
|
|
|
},
|
|
|
|
|
|
ValoresLeituras = new List<SensorValoresLeituraModel>()
|
|
|
|
|
|
{
|
|
|
|
|
|
new SensorValoresLeituraModel()
|
|
|
|
|
|
{
|
|
|
|
|
|
funcao = FuncoesPinout.Iniciado,
|
|
|
|
|
|
posicao = CanMessagePosicaoDados.Status,
|
|
|
|
|
|
indice = 0,
|
|
|
|
|
|
},
|
|
|
|
|
|
new SensorValoresLeituraModel()
|
|
|
|
|
|
{
|
|
|
|
|
|
funcao = FuncoesPinout.Tensao,
|
|
|
|
|
|
posicao = CanMessagePosicaoDados.Dados1,
|
|
|
|
|
|
indice = 0,
|
|
|
|
|
|
analise_health = true,
|
|
|
|
|
|
maximo = 12.5,
|
|
|
|
|
|
minimo = 11.5,
|
|
|
|
|
|
nominal = 12.0,
|
|
|
|
|
|
unidade_medida = "V"
|
|
|
|
|
|
},
|
|
|
|
|
|
new SensorValoresLeituraModel()
|
|
|
|
|
|
{
|
|
|
|
|
|
funcao = FuncoesPinout.Corrente,
|
|
|
|
|
|
posicao = CanMessagePosicaoDados.Dados1,
|
|
|
|
|
|
indice = 1,
|
|
|
|
|
|
analise_health = true,
|
|
|
|
|
|
maximo = 10000,
|
|
|
|
|
|
minimo = 50,
|
|
|
|
|
|
nominal = 500,
|
|
|
|
|
|
unidade_medida = "mA"
|
|
|
|
|
|
},
|
|
|
|
|
|
new SensorValoresLeituraModel()
|
|
|
|
|
|
{
|
|
|
|
|
|
funcao = FuncoesPinout.Potencia,
|
|
|
|
|
|
posicao = CanMessagePosicaoDados.Dados1,
|
|
|
|
|
|
indice = 2,
|
|
|
|
|
|
unidade_medida = "mW"
|
|
|
|
|
|
},
|
|
|
|
|
|
new SensorValoresLeituraModel()
|
|
|
|
|
|
{
|
|
|
|
|
|
funcao = FuncoesPinout.Energia,
|
|
|
|
|
|
posicao = CanMessagePosicaoDados.Dados2,
|
|
|
|
|
|
indice = 0,
|
|
|
|
|
|
unidade_medida = "mW/h"
|
|
|
|
|
|
},
|
|
|
|
|
|
new SensorValoresLeituraModel()
|
|
|
|
|
|
{
|
|
|
|
|
|
funcao = FuncoesPinout.Temperatura,
|
|
|
|
|
|
posicao = CanMessagePosicaoDados.Dados2,
|
|
|
|
|
|
indice = 1,
|
|
|
|
|
|
analise_health = true,
|
|
|
|
|
|
maximo = 60,
|
|
|
|
|
|
minimo = 0,
|
|
|
|
|
|
nominal = 25,
|
|
|
|
|
|
unidade_medida = "ºC"
|
2025-06-20 20:10:08 +00:00
|
|
|
|
},
|
|
|
|
|
|
new SensorValoresLeituraModel()
|
|
|
|
|
|
{
|
|
|
|
|
|
funcao = FuncoesPinout.CodAlarme,
|
|
|
|
|
|
posicao = CanMessagePosicaoDados.Dados2,
|
|
|
|
|
|
indice = 2,
|
2025-05-30 20:11:31 +00:00
|
|
|
|
}
|
2025-04-24 21:11:33 +00:00
|
|
|
|
}
|
|
|
|
|
|
},
|
|
|
|
|
|
new SensorModel()
|
|
|
|
|
|
{
|
|
|
|
|
|
ID = "AB19V",
|
|
|
|
|
|
Descricao = "Corrente no Barramento 19V",
|
|
|
|
|
|
ID_Num = 15,
|
|
|
|
|
|
Componente = S_Code.sCOR,
|
|
|
|
|
|
Aferir = true,
|
2025-05-07 16:54:45 +00:00
|
|
|
|
Mandatorio = false,
|
2025-04-24 21:11:33 +00:00
|
|
|
|
Funcoes = new List<FuncoesPinout>()
|
|
|
|
|
|
{
|
|
|
|
|
|
FuncoesPinout.I2C,
|
|
|
|
|
|
},
|
|
|
|
|
|
Parametros = new List<SensorParametroModel>()
|
|
|
|
|
|
{
|
|
|
|
|
|
new SensorParametroModel()
|
|
|
|
|
|
{
|
|
|
|
|
|
Descricao = "Endereço I2C",
|
|
|
|
|
|
Valor = "0x40",
|
|
|
|
|
|
QtdBytes = 1,
|
|
|
|
|
|
Escalar = false,
|
|
|
|
|
|
Enviar = true
|
|
|
|
|
|
},
|
|
|
|
|
|
new SensorParametroModel()
|
|
|
|
|
|
{
|
|
|
|
|
|
Descricao = "Shunt",
|
|
|
|
|
|
Valor = ((int)TiposShuntCorrente.INA228_10A).ToString(),
|
|
|
|
|
|
QtdBytes = 1,
|
|
|
|
|
|
Escalar = false,
|
|
|
|
|
|
Enviar = true
|
|
|
|
|
|
},
|
|
|
|
|
|
new SensorParametroModel()
|
|
|
|
|
|
{
|
|
|
|
|
|
Descricao = "Canal MUX",
|
2025-06-20 20:10:08 +00:00
|
|
|
|
Valor = "1",
|
2025-04-24 21:11:33 +00:00
|
|
|
|
QtdBytes = 1,
|
|
|
|
|
|
Escalar = false,
|
|
|
|
|
|
Enviar = true
|
|
|
|
|
|
},
|
2025-05-30 20:11:31 +00:00
|
|
|
|
},
|
|
|
|
|
|
ValoresLeituras = new List<SensorValoresLeituraModel>()
|
|
|
|
|
|
{
|
|
|
|
|
|
new SensorValoresLeituraModel()
|
|
|
|
|
|
{
|
|
|
|
|
|
funcao = FuncoesPinout.Iniciado,
|
|
|
|
|
|
posicao = CanMessagePosicaoDados.Status,
|
|
|
|
|
|
indice = 0,
|
|
|
|
|
|
},
|
|
|
|
|
|
new SensorValoresLeituraModel()
|
|
|
|
|
|
{
|
|
|
|
|
|
funcao = FuncoesPinout.Tensao,
|
|
|
|
|
|
posicao = CanMessagePosicaoDados.Dados1,
|
|
|
|
|
|
indice = 0,
|
|
|
|
|
|
analise_health = true,
|
|
|
|
|
|
maximo = 19.2,
|
|
|
|
|
|
minimo = 18.8,
|
|
|
|
|
|
nominal = 19.0,
|
|
|
|
|
|
unidade_medida = "V"
|
|
|
|
|
|
},
|
|
|
|
|
|
new SensorValoresLeituraModel()
|
|
|
|
|
|
{
|
|
|
|
|
|
funcao = FuncoesPinout.Corrente,
|
|
|
|
|
|
posicao = CanMessagePosicaoDados.Dados1,
|
|
|
|
|
|
indice = 1,
|
|
|
|
|
|
analise_health = true,
|
|
|
|
|
|
maximo = 4000,
|
|
|
|
|
|
minimo = 500,
|
|
|
|
|
|
nominal = 1500,
|
|
|
|
|
|
unidade_medida = "mA"
|
|
|
|
|
|
},
|
|
|
|
|
|
new SensorValoresLeituraModel()
|
|
|
|
|
|
{
|
|
|
|
|
|
funcao = FuncoesPinout.Potencia,
|
|
|
|
|
|
posicao = CanMessagePosicaoDados.Dados1,
|
|
|
|
|
|
indice = 2,
|
|
|
|
|
|
unidade_medida = "mW"
|
|
|
|
|
|
},
|
|
|
|
|
|
new SensorValoresLeituraModel()
|
|
|
|
|
|
{
|
|
|
|
|
|
funcao = FuncoesPinout.Energia,
|
|
|
|
|
|
posicao = CanMessagePosicaoDados.Dados2,
|
|
|
|
|
|
indice = 0,
|
|
|
|
|
|
unidade_medida = "mW/h"
|
|
|
|
|
|
},
|
|
|
|
|
|
new SensorValoresLeituraModel()
|
|
|
|
|
|
{
|
|
|
|
|
|
funcao = FuncoesPinout.Temperatura,
|
|
|
|
|
|
posicao = CanMessagePosicaoDados.Dados2,
|
|
|
|
|
|
indice = 1,
|
|
|
|
|
|
analise_health = true,
|
|
|
|
|
|
maximo = 60,
|
|
|
|
|
|
minimo = 0,
|
|
|
|
|
|
nominal = 25,
|
|
|
|
|
|
unidade_medida = "ºC"
|
2025-06-20 20:10:08 +00:00
|
|
|
|
},
|
|
|
|
|
|
new SensorValoresLeituraModel()
|
|
|
|
|
|
{
|
|
|
|
|
|
funcao = FuncoesPinout.CodAlarme,
|
|
|
|
|
|
posicao = CanMessagePosicaoDados.Dados2,
|
|
|
|
|
|
indice = 2,
|
2025-05-30 20:11:31 +00:00
|
|
|
|
}
|
2025-04-24 21:11:33 +00:00
|
|
|
|
}
|
|
|
|
|
|
},
|
|
|
|
|
|
new SensorModel()
|
|
|
|
|
|
{
|
|
|
|
|
|
ID = "AB24V",
|
|
|
|
|
|
Descricao = "Corrente no Barramento 24V",
|
|
|
|
|
|
ID_Num = 16,
|
|
|
|
|
|
Componente = S_Code.sCOR,
|
|
|
|
|
|
Aferir = true,
|
2025-05-07 16:54:45 +00:00
|
|
|
|
Mandatorio = false,
|
2025-04-24 21:11:33 +00:00
|
|
|
|
Funcoes = new List<FuncoesPinout>()
|
|
|
|
|
|
{
|
|
|
|
|
|
FuncoesPinout.I2C,
|
|
|
|
|
|
},
|
|
|
|
|
|
Parametros = new List<SensorParametroModel>()
|
|
|
|
|
|
{
|
|
|
|
|
|
new SensorParametroModel()
|
|
|
|
|
|
{
|
|
|
|
|
|
Descricao = "Endereço I2C",
|
|
|
|
|
|
Valor = "0x40",
|
|
|
|
|
|
QtdBytes = 1,
|
|
|
|
|
|
Escalar = false,
|
|
|
|
|
|
Enviar = true
|
|
|
|
|
|
},
|
|
|
|
|
|
new SensorParametroModel()
|
|
|
|
|
|
{
|
|
|
|
|
|
Descricao = "Shunt",
|
|
|
|
|
|
Valor = ((int)TiposShuntCorrente.INA228_50A).ToString(),
|
|
|
|
|
|
QtdBytes = 1,
|
|
|
|
|
|
Escalar = false,
|
|
|
|
|
|
Enviar = true
|
|
|
|
|
|
},
|
|
|
|
|
|
new SensorParametroModel()
|
|
|
|
|
|
{
|
|
|
|
|
|
Descricao = "Canal MUX",
|
2025-06-20 20:10:08 +00:00
|
|
|
|
Valor = "6",
|
2025-04-24 21:11:33 +00:00
|
|
|
|
QtdBytes = 1,
|
|
|
|
|
|
Escalar = false,
|
2025-04-09 21:11:40 +00:00
|
|
|
|
Enviar = true
|
|
|
|
|
|
},
|
2025-05-30 20:11:31 +00:00
|
|
|
|
},
|
|
|
|
|
|
ValoresLeituras = new List<SensorValoresLeituraModel>()
|
|
|
|
|
|
{
|
|
|
|
|
|
new SensorValoresLeituraModel()
|
|
|
|
|
|
{
|
|
|
|
|
|
funcao = FuncoesPinout.Iniciado,
|
|
|
|
|
|
posicao = CanMessagePosicaoDados.Status,
|
|
|
|
|
|
indice = 0,
|
|
|
|
|
|
},
|
|
|
|
|
|
new SensorValoresLeituraModel()
|
|
|
|
|
|
{
|
|
|
|
|
|
funcao = FuncoesPinout.Tensao,
|
|
|
|
|
|
posicao = CanMessagePosicaoDados.Dados1,
|
|
|
|
|
|
indice = 0,
|
|
|
|
|
|
analise_health = true,
|
|
|
|
|
|
maximo = 24.3,
|
|
|
|
|
|
minimo = 23.8,
|
|
|
|
|
|
nominal = 24.0,
|
|
|
|
|
|
unidade_medida = "V"
|
|
|
|
|
|
},
|
|
|
|
|
|
new SensorValoresLeituraModel()
|
|
|
|
|
|
{
|
|
|
|
|
|
funcao = FuncoesPinout.Corrente,
|
|
|
|
|
|
posicao = CanMessagePosicaoDados.Dados1,
|
|
|
|
|
|
indice = 1,
|
|
|
|
|
|
analise_health = true,
|
|
|
|
|
|
maximo = 20000,
|
2025-06-20 20:10:08 +00:00
|
|
|
|
minimo = 100,
|
2025-05-30 20:11:31 +00:00
|
|
|
|
nominal = 700,
|
|
|
|
|
|
unidade_medida = "mA"
|
|
|
|
|
|
},
|
|
|
|
|
|
new SensorValoresLeituraModel()
|
|
|
|
|
|
{
|
|
|
|
|
|
funcao = FuncoesPinout.Potencia,
|
|
|
|
|
|
posicao = CanMessagePosicaoDados.Dados1,
|
|
|
|
|
|
indice = 2,
|
|
|
|
|
|
unidade_medida = "mW"
|
|
|
|
|
|
},
|
|
|
|
|
|
new SensorValoresLeituraModel()
|
|
|
|
|
|
{
|
|
|
|
|
|
funcao = FuncoesPinout.Energia,
|
|
|
|
|
|
posicao = CanMessagePosicaoDados.Dados2,
|
|
|
|
|
|
indice = 0,
|
|
|
|
|
|
unidade_medida = "mW/h"
|
|
|
|
|
|
},
|
|
|
|
|
|
new SensorValoresLeituraModel()
|
|
|
|
|
|
{
|
|
|
|
|
|
funcao = FuncoesPinout.Temperatura,
|
|
|
|
|
|
posicao = CanMessagePosicaoDados.Dados2,
|
|
|
|
|
|
indice = 1,
|
|
|
|
|
|
analise_health = true,
|
|
|
|
|
|
maximo = 60,
|
|
|
|
|
|
minimo = 0,
|
|
|
|
|
|
nominal = 25,
|
|
|
|
|
|
unidade_medida = "ºC"
|
2025-06-20 20:10:08 +00:00
|
|
|
|
},
|
|
|
|
|
|
new SensorValoresLeituraModel()
|
|
|
|
|
|
{
|
|
|
|
|
|
funcao = FuncoesPinout.CodAlarme,
|
|
|
|
|
|
posicao = CanMessagePosicaoDados.Dados2,
|
|
|
|
|
|
indice = 2,
|
2025-05-30 20:11:31 +00:00
|
|
|
|
}
|
2025-04-09 21:11:40 +00:00
|
|
|
|
}
|
2024-01-24 12:53:39 +00:00
|
|
|
|
},
|
2025-04-14 16:37:53 +00:00
|
|
|
|
new SensorModel()
|
2025-04-24 11:49:04 +00:00
|
|
|
|
{
|
|
|
|
|
|
ID = "AB36V",
|
|
|
|
|
|
Descricao = "Corrente no Barramento 36V",
|
2025-04-24 21:11:33 +00:00
|
|
|
|
ID_Num = 17,
|
2025-04-24 11:49:04 +00:00
|
|
|
|
Componente = S_Code.sCOR,
|
|
|
|
|
|
Aferir = true,
|
2025-05-07 16:54:45 +00:00
|
|
|
|
Mandatorio = true,
|
2025-04-24 11:49:04 +00:00
|
|
|
|
Funcoes = new List<FuncoesPinout>()
|
|
|
|
|
|
{
|
|
|
|
|
|
FuncoesPinout.I2C,
|
|
|
|
|
|
},
|
|
|
|
|
|
Parametros = new List<SensorParametroModel>()
|
|
|
|
|
|
{
|
|
|
|
|
|
new SensorParametroModel()
|
|
|
|
|
|
{
|
|
|
|
|
|
Descricao = "Endereço I2C",
|
|
|
|
|
|
Valor = "0x40",
|
|
|
|
|
|
QtdBytes = 1,
|
|
|
|
|
|
Escalar = false,
|
|
|
|
|
|
Enviar = true
|
|
|
|
|
|
},
|
|
|
|
|
|
new SensorParametroModel()
|
|
|
|
|
|
{
|
2025-04-24 21:11:33 +00:00
|
|
|
|
Descricao = "Shunt",
|
|
|
|
|
|
Valor = ((int)TiposShuntCorrente.INA228_100A).ToString(),
|
|
|
|
|
|
QtdBytes = 1,
|
|
|
|
|
|
Escalar = false,
|
|
|
|
|
|
Enviar = true
|
|
|
|
|
|
},
|
|
|
|
|
|
new SensorParametroModel()
|
|
|
|
|
|
{
|
|
|
|
|
|
Descricao = "Canal MUX",
|
2025-06-20 20:10:08 +00:00
|
|
|
|
Valor = "7",
|
2025-04-24 21:11:33 +00:00
|
|
|
|
QtdBytes = 1,
|
|
|
|
|
|
Escalar = false,
|
2025-04-24 11:49:04 +00:00
|
|
|
|
Enviar = true
|
|
|
|
|
|
},
|
2025-04-14 16:37:53 +00:00
|
|
|
|
},
|
2025-05-30 20:11:31 +00:00
|
|
|
|
ValoresLeituras = new List<SensorValoresLeituraModel>()
|
2025-04-14 16:37:53 +00:00
|
|
|
|
{
|
2025-05-30 20:11:31 +00:00
|
|
|
|
new SensorValoresLeituraModel()
|
2025-04-14 16:37:53 +00:00
|
|
|
|
{
|
2025-05-30 20:11:31 +00:00
|
|
|
|
funcao = FuncoesPinout.Iniciado,
|
|
|
|
|
|
posicao = CanMessagePosicaoDados.Status,
|
|
|
|
|
|
indice = 0,
|
2025-04-14 16:37:53 +00:00
|
|
|
|
},
|
2025-05-30 20:11:31 +00:00
|
|
|
|
new SensorValoresLeituraModel()
|
|
|
|
|
|
{
|
|
|
|
|
|
funcao = FuncoesPinout.Tensao,
|
|
|
|
|
|
posicao = CanMessagePosicaoDados.Dados1,
|
|
|
|
|
|
indice = 0,
|
|
|
|
|
|
analise_health = true,
|
|
|
|
|
|
maximo = 42.5,
|
|
|
|
|
|
minimo = 31.0,
|
|
|
|
|
|
nominal = 37.5,
|
|
|
|
|
|
unidade_medida = "V"
|
|
|
|
|
|
},
|
|
|
|
|
|
new SensorValoresLeituraModel()
|
|
|
|
|
|
{
|
|
|
|
|
|
funcao = FuncoesPinout.Corrente,
|
|
|
|
|
|
posicao = CanMessagePosicaoDados.Dados1,
|
|
|
|
|
|
indice = 1,
|
|
|
|
|
|
analise_health = true,
|
|
|
|
|
|
maximo = 75000,
|
|
|
|
|
|
minimo = 200,
|
|
|
|
|
|
nominal = 2500,
|
|
|
|
|
|
unidade_medida = "mA"
|
|
|
|
|
|
},
|
|
|
|
|
|
new SensorValoresLeituraModel()
|
2025-04-14 16:37:53 +00:00
|
|
|
|
{
|
2025-05-30 20:11:31 +00:00
|
|
|
|
funcao = FuncoesPinout.Potencia,
|
|
|
|
|
|
posicao = CanMessagePosicaoDados.Dados1,
|
|
|
|
|
|
indice = 2,
|
|
|
|
|
|
unidade_medida = "mW"
|
|
|
|
|
|
},
|
|
|
|
|
|
new SensorValoresLeituraModel()
|
|
|
|
|
|
{
|
|
|
|
|
|
funcao = FuncoesPinout.Energia,
|
|
|
|
|
|
posicao = CanMessagePosicaoDados.Dados2,
|
|
|
|
|
|
indice = 0,
|
|
|
|
|
|
unidade_medida = "mW/h"
|
2025-04-14 16:37:53 +00:00
|
|
|
|
},
|
2025-05-30 20:11:31 +00:00
|
|
|
|
new SensorValoresLeituraModel()
|
|
|
|
|
|
{
|
|
|
|
|
|
funcao = FuncoesPinout.Temperatura,
|
|
|
|
|
|
posicao = CanMessagePosicaoDados.Dados2,
|
|
|
|
|
|
indice = 1,
|
|
|
|
|
|
analise_health = true,
|
|
|
|
|
|
maximo = 60,
|
|
|
|
|
|
minimo = 0,
|
|
|
|
|
|
nominal = 35,
|
|
|
|
|
|
unidade_medida = "ºC"
|
2025-06-20 20:10:08 +00:00
|
|
|
|
},
|
|
|
|
|
|
new SensorValoresLeituraModel()
|
|
|
|
|
|
{
|
|
|
|
|
|
funcao = FuncoesPinout.CodAlarme,
|
|
|
|
|
|
posicao = CanMessagePosicaoDados.Dados2,
|
|
|
|
|
|
indice = 2,
|
2025-05-30 20:11:31 +00:00
|
|
|
|
}
|
2025-04-14 16:37:53 +00:00
|
|
|
|
}
|
|
|
|
|
|
},
|
2025-12-11 12:29:08 +00:00
|
|
|
|
// Torre 31 ~ 37
|
2025-05-15 20:20:46 +00:00
|
|
|
|
new SensorModel()
|
|
|
|
|
|
{
|
|
|
|
|
|
ID = "LUZABT",
|
|
|
|
|
|
Descricao = "Luminosidade Ambiente",
|
|
|
|
|
|
ID_Num = 31,
|
|
|
|
|
|
Componente = S_Code.sLUZ,
|
|
|
|
|
|
Aferir = true,
|
|
|
|
|
|
Mandatorio = false,
|
|
|
|
|
|
Funcoes = new List<FuncoesPinout>()
|
|
|
|
|
|
{
|
|
|
|
|
|
FuncoesPinout.I2C,
|
|
|
|
|
|
},
|
|
|
|
|
|
Parametros = new List<SensorParametroModel>()
|
|
|
|
|
|
{
|
|
|
|
|
|
new SensorParametroModel()
|
|
|
|
|
|
{
|
|
|
|
|
|
Descricao = "Endereço I2C",
|
|
|
|
|
|
Valor = "0x29",
|
|
|
|
|
|
QtdBytes = 1,
|
|
|
|
|
|
Escalar = false,
|
|
|
|
|
|
Enviar = true
|
|
|
|
|
|
},
|
|
|
|
|
|
new SensorParametroModel()
|
|
|
|
|
|
{
|
|
|
|
|
|
Descricao = "Canal MUX",
|
|
|
|
|
|
Valor = "-1",
|
|
|
|
|
|
QtdBytes = 1,
|
|
|
|
|
|
Escalar = false,
|
|
|
|
|
|
Enviar = true
|
|
|
|
|
|
},
|
2025-05-30 20:11:31 +00:00
|
|
|
|
},
|
|
|
|
|
|
ValoresLeituras = new List<SensorValoresLeituraModel>()
|
|
|
|
|
|
{
|
|
|
|
|
|
new SensorValoresLeituraModel()
|
|
|
|
|
|
{
|
|
|
|
|
|
funcao = FuncoesPinout.Iniciado,
|
|
|
|
|
|
posicao = CanMessagePosicaoDados.Status,
|
|
|
|
|
|
indice = 0,
|
|
|
|
|
|
},
|
|
|
|
|
|
new SensorValoresLeituraModel()
|
|
|
|
|
|
{
|
|
|
|
|
|
funcao = FuncoesPinout.LuzAmbiente,
|
|
|
|
|
|
posicao = CanMessagePosicaoDados.Dados1,
|
|
|
|
|
|
indice = 0,
|
|
|
|
|
|
analise_health = true,
|
|
|
|
|
|
maximo = 80000,
|
|
|
|
|
|
minimo = 50,
|
|
|
|
|
|
nominal = 10000,
|
|
|
|
|
|
unidade_medida = "Lux"
|
|
|
|
|
|
}
|
2025-05-15 20:20:46 +00:00
|
|
|
|
}
|
|
|
|
|
|
},
|
|
|
|
|
|
new SensorModel()
|
|
|
|
|
|
{
|
|
|
|
|
|
ID = "IUVABT",
|
|
|
|
|
|
Descricao = "Indice de radiacao UV Ambiente",
|
|
|
|
|
|
ID_Num = 32,
|
|
|
|
|
|
Componente = S_Code.sIUV,
|
|
|
|
|
|
Aferir = true,
|
|
|
|
|
|
Mandatorio = false,
|
|
|
|
|
|
Funcoes = new List<FuncoesPinout>()
|
|
|
|
|
|
{
|
|
|
|
|
|
FuncoesPinout.LuzUV,
|
|
|
|
|
|
},
|
|
|
|
|
|
Parametros = new List<SensorParametroModel>()
|
|
|
|
|
|
{
|
|
|
|
|
|
new SensorParametroModel()
|
|
|
|
|
|
{
|
|
|
|
|
|
Descricao = "Canal MUX",
|
|
|
|
|
|
Valor = "-1",
|
|
|
|
|
|
QtdBytes = 1,
|
|
|
|
|
|
Escalar = false,
|
|
|
|
|
|
Enviar = true
|
|
|
|
|
|
},
|
2025-05-30 20:11:31 +00:00
|
|
|
|
},
|
|
|
|
|
|
ValoresLeituras = new List<SensorValoresLeituraModel>()
|
|
|
|
|
|
{
|
|
|
|
|
|
new SensorValoresLeituraModel()
|
|
|
|
|
|
{
|
|
|
|
|
|
funcao = FuncoesPinout.Iniciado,
|
|
|
|
|
|
posicao = CanMessagePosicaoDados.Status,
|
|
|
|
|
|
indice = 0,
|
|
|
|
|
|
},
|
|
|
|
|
|
new SensorValoresLeituraModel()
|
2025-12-16 17:17:26 +00:00
|
|
|
|
{
|
|
|
|
|
|
funcao = FuncoesPinout.LeituraBruta,
|
|
|
|
|
|
posicao = CanMessagePosicaoDados.Dados1,
|
|
|
|
|
|
indice = 0,
|
|
|
|
|
|
},
|
|
|
|
|
|
new SensorValoresLeituraModel()
|
2025-05-30 20:11:31 +00:00
|
|
|
|
{
|
|
|
|
|
|
funcao = FuncoesPinout.LuzUV,
|
|
|
|
|
|
posicao = CanMessagePosicaoDados.Dados1,
|
2025-12-16 17:17:26 +00:00
|
|
|
|
indice = 1,
|
2025-05-30 20:11:31 +00:00
|
|
|
|
analise_health = true,
|
|
|
|
|
|
maximo = 11.0,
|
|
|
|
|
|
minimo = 0.0,
|
|
|
|
|
|
nominal = 5.0,
|
|
|
|
|
|
unidade_medida = "IUV"
|
|
|
|
|
|
}
|
2025-05-15 20:20:46 +00:00
|
|
|
|
}
|
|
|
|
|
|
},
|
|
|
|
|
|
new SensorModel()
|
|
|
|
|
|
{
|
|
|
|
|
|
ID = "MQ2",
|
|
|
|
|
|
Descricao = "Gas e Fumaca",
|
|
|
|
|
|
ID_Num = 33,
|
|
|
|
|
|
Componente = S_Code.sGAS,
|
|
|
|
|
|
Aferir = true,
|
|
|
|
|
|
Mandatorio = false,
|
|
|
|
|
|
Funcoes = new List<FuncoesPinout>()
|
|
|
|
|
|
{
|
|
|
|
|
|
FuncoesPinout.Gas,
|
|
|
|
|
|
},
|
|
|
|
|
|
Parametros = new List<SensorParametroModel>()
|
|
|
|
|
|
{
|
|
|
|
|
|
new SensorParametroModel()
|
|
|
|
|
|
{
|
|
|
|
|
|
Descricao = "Tipo",
|
|
|
|
|
|
Valor = ((int)TipoSensorGas.MQ2).ToString(),
|
|
|
|
|
|
QtdBytes = 1,
|
|
|
|
|
|
Escalar = false,
|
|
|
|
|
|
Enviar = true,
|
|
|
|
|
|
},
|
|
|
|
|
|
new SensorParametroModel()
|
|
|
|
|
|
{
|
|
|
|
|
|
Descricao = "Canal MUX",
|
|
|
|
|
|
Valor = "-1",
|
|
|
|
|
|
QtdBytes = 1,
|
|
|
|
|
|
Escalar = false,
|
|
|
|
|
|
Enviar = true
|
|
|
|
|
|
},
|
2025-05-30 20:11:31 +00:00
|
|
|
|
},
|
|
|
|
|
|
ValoresLeituras = new List<SensorValoresLeituraModel>()
|
|
|
|
|
|
{
|
|
|
|
|
|
new SensorValoresLeituraModel()
|
|
|
|
|
|
{
|
|
|
|
|
|
funcao = FuncoesPinout.Iniciado,
|
|
|
|
|
|
posicao = CanMessagePosicaoDados.Status,
|
|
|
|
|
|
indice = 0,
|
|
|
|
|
|
},
|
|
|
|
|
|
new SensorValoresLeituraModel()
|
2025-12-16 17:17:26 +00:00
|
|
|
|
{
|
|
|
|
|
|
funcao = FuncoesPinout.LeituraBruta,
|
|
|
|
|
|
posicao = CanMessagePosicaoDados.Dados1,
|
|
|
|
|
|
indice = 0,
|
|
|
|
|
|
},
|
|
|
|
|
|
new SensorValoresLeituraModel()
|
2025-05-30 20:11:31 +00:00
|
|
|
|
{
|
|
|
|
|
|
funcao = FuncoesPinout.Gas,
|
|
|
|
|
|
posicao = CanMessagePosicaoDados.Dados1,
|
2025-12-16 17:17:26 +00:00
|
|
|
|
indice = 1,
|
2025-05-30 20:11:31 +00:00
|
|
|
|
analise_health = true,
|
|
|
|
|
|
maximo = 600.0,
|
|
|
|
|
|
minimo = 0.0,
|
|
|
|
|
|
nominal = 50.0,
|
|
|
|
|
|
unidade_medida = "PPM"
|
|
|
|
|
|
}
|
2025-05-15 20:20:46 +00:00
|
|
|
|
}
|
|
|
|
|
|
},
|
|
|
|
|
|
new SensorModel()
|
|
|
|
|
|
{
|
|
|
|
|
|
ID = "MQ7",
|
|
|
|
|
|
Descricao = "Monoxido de carbono",
|
|
|
|
|
|
ID_Num = 34,
|
|
|
|
|
|
Componente = S_Code.sGAS,
|
|
|
|
|
|
Aferir = true,
|
|
|
|
|
|
Mandatorio = false,
|
|
|
|
|
|
Funcoes = new List<FuncoesPinout>()
|
|
|
|
|
|
{
|
|
|
|
|
|
FuncoesPinout.Gas,
|
|
|
|
|
|
},
|
|
|
|
|
|
Parametros = new List<SensorParametroModel>()
|
|
|
|
|
|
{
|
|
|
|
|
|
new SensorParametroModel()
|
|
|
|
|
|
{
|
|
|
|
|
|
Descricao = "Tipo",
|
|
|
|
|
|
Valor = ((int)TipoSensorGas.MQ7).ToString(),
|
|
|
|
|
|
QtdBytes = 1,
|
|
|
|
|
|
Escalar = false,
|
|
|
|
|
|
Enviar = true,
|
|
|
|
|
|
},
|
|
|
|
|
|
new SensorParametroModel()
|
|
|
|
|
|
{
|
|
|
|
|
|
Descricao = "Canal MUX",
|
|
|
|
|
|
Valor = "-1",
|
|
|
|
|
|
QtdBytes = 1,
|
|
|
|
|
|
Escalar = false,
|
|
|
|
|
|
Enviar = true
|
|
|
|
|
|
},
|
2025-05-30 20:11:31 +00:00
|
|
|
|
},
|
|
|
|
|
|
ValoresLeituras = new List<SensorValoresLeituraModel>()
|
|
|
|
|
|
{
|
|
|
|
|
|
new SensorValoresLeituraModel()
|
|
|
|
|
|
{
|
|
|
|
|
|
funcao = FuncoesPinout.Iniciado,
|
|
|
|
|
|
posicao = CanMessagePosicaoDados.Status,
|
|
|
|
|
|
indice = 0,
|
|
|
|
|
|
},
|
|
|
|
|
|
new SensorValoresLeituraModel()
|
2025-12-16 17:17:26 +00:00
|
|
|
|
{
|
|
|
|
|
|
funcao = FuncoesPinout.LeituraBruta,
|
|
|
|
|
|
posicao = CanMessagePosicaoDados.Dados1,
|
|
|
|
|
|
indice = 0,
|
|
|
|
|
|
},
|
|
|
|
|
|
new SensorValoresLeituraModel()
|
2025-05-30 20:11:31 +00:00
|
|
|
|
{
|
|
|
|
|
|
funcao = FuncoesPinout.Gas,
|
|
|
|
|
|
posicao = CanMessagePosicaoDados.Dados1,
|
2025-12-16 17:17:26 +00:00
|
|
|
|
indice = 1,
|
2025-05-30 20:11:31 +00:00
|
|
|
|
analise_health = true,
|
|
|
|
|
|
maximo = 400.0,
|
|
|
|
|
|
minimo = 0.0,
|
|
|
|
|
|
nominal = 25.0,
|
|
|
|
|
|
unidade_medida = "PPM"
|
|
|
|
|
|
}
|
2025-05-15 20:20:46 +00:00
|
|
|
|
}
|
|
|
|
|
|
},
|
|
|
|
|
|
new SensorModel()
|
|
|
|
|
|
{
|
|
|
|
|
|
ID = "QLDABT",
|
|
|
|
|
|
Descricao = "Qualidade do ar",
|
|
|
|
|
|
ID_Num = 35,
|
|
|
|
|
|
Componente = S_Code.sQAR,
|
|
|
|
|
|
Aferir = true,
|
|
|
|
|
|
Mandatorio = false,
|
|
|
|
|
|
Funcoes = new List<FuncoesPinout>()
|
|
|
|
|
|
{
|
|
|
|
|
|
FuncoesPinout.I2C,
|
|
|
|
|
|
},
|
|
|
|
|
|
Parametros = new List<SensorParametroModel>()
|
|
|
|
|
|
{
|
|
|
|
|
|
new SensorParametroModel()
|
|
|
|
|
|
{
|
|
|
|
|
|
Descricao = "Canal MUX",
|
|
|
|
|
|
Valor = "-1",
|
|
|
|
|
|
QtdBytes = 1,
|
|
|
|
|
|
Escalar = false,
|
|
|
|
|
|
Enviar = true
|
|
|
|
|
|
},
|
2025-05-30 20:11:31 +00:00
|
|
|
|
},
|
|
|
|
|
|
ValoresLeituras = new List<SensorValoresLeituraModel>()
|
|
|
|
|
|
{
|
|
|
|
|
|
new SensorValoresLeituraModel()
|
|
|
|
|
|
{
|
|
|
|
|
|
funcao = FuncoesPinout.Iniciado,
|
|
|
|
|
|
posicao = CanMessagePosicaoDados.Status,
|
|
|
|
|
|
indice = 0,
|
|
|
|
|
|
},
|
|
|
|
|
|
new SensorValoresLeituraModel()
|
|
|
|
|
|
{
|
|
|
|
|
|
funcao = FuncoesPinout.TVOC,
|
|
|
|
|
|
posicao = CanMessagePosicaoDados.Dados1,
|
|
|
|
|
|
indice = 0,
|
|
|
|
|
|
analise_health = true,
|
|
|
|
|
|
maximo = 1000.0,
|
|
|
|
|
|
minimo = 0.0,
|
|
|
|
|
|
nominal = 150.0,
|
|
|
|
|
|
unidade_medida = "PPB"
|
|
|
|
|
|
},
|
|
|
|
|
|
new SensorValoresLeituraModel()
|
|
|
|
|
|
{
|
|
|
|
|
|
funcao = FuncoesPinout.ECO2,
|
|
|
|
|
|
posicao = CanMessagePosicaoDados.Dados1,
|
|
|
|
|
|
indice = 1,
|
|
|
|
|
|
analise_health = true,
|
|
|
|
|
|
maximo = 2000.0,
|
|
|
|
|
|
minimo = 400.0,
|
|
|
|
|
|
nominal = 600.0,
|
|
|
|
|
|
unidade_medida = "PPM"
|
|
|
|
|
|
},
|
|
|
|
|
|
new SensorValoresLeituraModel()
|
|
|
|
|
|
{
|
|
|
|
|
|
funcao = FuncoesPinout.AQI,
|
|
|
|
|
|
posicao = CanMessagePosicaoDados.Dados1,
|
|
|
|
|
|
indice = 2,
|
|
|
|
|
|
analise_health = true,
|
|
|
|
|
|
maximo = 3.0,
|
|
|
|
|
|
minimo = 1.0,
|
|
|
|
|
|
nominal = 1.5,
|
|
|
|
|
|
unidade_medida = "AQI"
|
|
|
|
|
|
},
|
|
|
|
|
|
new SensorValoresLeituraModel()
|
|
|
|
|
|
{
|
|
|
|
|
|
funcao = FuncoesPinout.Temperatura,
|
|
|
|
|
|
posicao = CanMessagePosicaoDados.Dados2,
|
|
|
|
|
|
indice = 0,
|
|
|
|
|
|
analise_health = true,
|
|
|
|
|
|
maximo = 50.0,
|
|
|
|
|
|
minimo = 0.0,
|
|
|
|
|
|
nominal = 25.0,
|
|
|
|
|
|
unidade_medida = "ºC"
|
|
|
|
|
|
},
|
|
|
|
|
|
new SensorValoresLeituraModel()
|
|
|
|
|
|
{
|
|
|
|
|
|
funcao = FuncoesPinout.Umidade,
|
|
|
|
|
|
posicao = CanMessagePosicaoDados.Dados2,
|
|
|
|
|
|
indice = 1,
|
|
|
|
|
|
analise_health = true,
|
|
|
|
|
|
maximo = 90.0,
|
|
|
|
|
|
minimo = 20.0,
|
|
|
|
|
|
nominal = 60.0,
|
|
|
|
|
|
unidade_medida = "%"
|
|
|
|
|
|
},
|
2025-05-15 20:20:46 +00:00
|
|
|
|
}
|
|
|
|
|
|
},
|
|
|
|
|
|
new SensorModel()
|
|
|
|
|
|
{
|
|
|
|
|
|
ID = "SHTABT",
|
|
|
|
|
|
Descricao = "Temperatura e Umidade Ambiente",
|
|
|
|
|
|
ID_Num = 36,
|
|
|
|
|
|
Componente = S_Code.sSHT,
|
|
|
|
|
|
Aferir = true,
|
|
|
|
|
|
Mandatorio = false,
|
|
|
|
|
|
Funcoes = new List<FuncoesPinout>()
|
|
|
|
|
|
{
|
|
|
|
|
|
FuncoesPinout.I2C,
|
|
|
|
|
|
},
|
|
|
|
|
|
Parametros = new List<SensorParametroModel>()
|
|
|
|
|
|
{
|
|
|
|
|
|
new SensorParametroModel()
|
|
|
|
|
|
{
|
|
|
|
|
|
Descricao = "Endereço I2C",
|
|
|
|
|
|
Valor = "0x44",
|
|
|
|
|
|
QtdBytes = 1,
|
|
|
|
|
|
Escalar = false,
|
|
|
|
|
|
Enviar = false
|
|
|
|
|
|
},
|
|
|
|
|
|
new SensorParametroModel()
|
|
|
|
|
|
{
|
|
|
|
|
|
Descricao = "Canal MUX",
|
|
|
|
|
|
Valor = "-1",
|
|
|
|
|
|
QtdBytes = 1,
|
|
|
|
|
|
Escalar = false,
|
|
|
|
|
|
Enviar = true
|
|
|
|
|
|
},
|
2025-05-30 20:11:31 +00:00
|
|
|
|
},
|
|
|
|
|
|
ValoresLeituras = new List<SensorValoresLeituraModel>()
|
|
|
|
|
|
{
|
|
|
|
|
|
new SensorValoresLeituraModel()
|
|
|
|
|
|
{
|
|
|
|
|
|
funcao = FuncoesPinout.Iniciado,
|
|
|
|
|
|
posicao = CanMessagePosicaoDados.Status,
|
|
|
|
|
|
indice = 0,
|
|
|
|
|
|
},
|
|
|
|
|
|
new SensorValoresLeituraModel()
|
|
|
|
|
|
{
|
|
|
|
|
|
funcao = FuncoesPinout.Temperatura,
|
|
|
|
|
|
posicao = CanMessagePosicaoDados.Dados1,
|
|
|
|
|
|
indice = 0,
|
|
|
|
|
|
analise_health = true,
|
|
|
|
|
|
maximo = 50.0,
|
|
|
|
|
|
minimo = 0.0,
|
|
|
|
|
|
nominal = 25.0,
|
|
|
|
|
|
unidade_medida = "ºC"
|
|
|
|
|
|
},
|
|
|
|
|
|
new SensorValoresLeituraModel()
|
|
|
|
|
|
{
|
|
|
|
|
|
funcao = FuncoesPinout.Umidade,
|
|
|
|
|
|
posicao = CanMessagePosicaoDados.Dados1,
|
|
|
|
|
|
indice = 1,
|
|
|
|
|
|
analise_health = true,
|
|
|
|
|
|
maximo = 90.0,
|
|
|
|
|
|
minimo = 20.0,
|
|
|
|
|
|
nominal = 60.0,
|
|
|
|
|
|
unidade_medida = "%"
|
|
|
|
|
|
},
|
2025-05-15 20:20:46 +00:00
|
|
|
|
}
|
|
|
|
|
|
},
|
|
|
|
|
|
new SensorModel()
|
|
|
|
|
|
{
|
|
|
|
|
|
ID = "CHVABT",
|
|
|
|
|
|
Descricao = "Chuva",
|
|
|
|
|
|
ID_Num = 37,
|
|
|
|
|
|
Componente = S_Code.sCHV,
|
|
|
|
|
|
Aferir = true,
|
|
|
|
|
|
Mandatorio = false,
|
|
|
|
|
|
Funcoes = new List<FuncoesPinout>()
|
|
|
|
|
|
{
|
|
|
|
|
|
FuncoesPinout.Chuva,
|
|
|
|
|
|
},
|
|
|
|
|
|
Parametros = new List<SensorParametroModel>()
|
|
|
|
|
|
{
|
|
|
|
|
|
new SensorParametroModel()
|
|
|
|
|
|
{
|
|
|
|
|
|
Descricao = "Canal MUX",
|
|
|
|
|
|
Valor = "-1",
|
|
|
|
|
|
QtdBytes = 1,
|
|
|
|
|
|
Escalar = false,
|
|
|
|
|
|
Enviar = true
|
|
|
|
|
|
},
|
2025-05-30 20:11:31 +00:00
|
|
|
|
},
|
|
|
|
|
|
ValoresLeituras = new List<SensorValoresLeituraModel>()
|
|
|
|
|
|
{
|
|
|
|
|
|
new SensorValoresLeituraModel()
|
|
|
|
|
|
{
|
|
|
|
|
|
funcao = FuncoesPinout.Iniciado,
|
|
|
|
|
|
posicao = CanMessagePosicaoDados.Status,
|
|
|
|
|
|
indice = 0,
|
|
|
|
|
|
},
|
|
|
|
|
|
new SensorValoresLeituraModel()
|
2025-12-16 17:17:26 +00:00
|
|
|
|
{
|
|
|
|
|
|
funcao = FuncoesPinout.LeituraBruta,
|
|
|
|
|
|
posicao = CanMessagePosicaoDados.Dados1,
|
|
|
|
|
|
indice = 0,
|
|
|
|
|
|
},
|
|
|
|
|
|
new SensorValoresLeituraModel()
|
2025-05-30 20:11:31 +00:00
|
|
|
|
{
|
|
|
|
|
|
funcao = FuncoesPinout.Chuva,
|
|
|
|
|
|
posicao = CanMessagePosicaoDados.Dados1,
|
2025-12-16 17:17:26 +00:00
|
|
|
|
indice = 1,
|
2025-05-30 20:11:31 +00:00
|
|
|
|
analise_health = true,
|
|
|
|
|
|
maximo = 100.0,
|
|
|
|
|
|
minimo = 0.0,
|
|
|
|
|
|
nominal = 10.0,
|
|
|
|
|
|
unidade_medida = "%"
|
|
|
|
|
|
}
|
2025-05-15 20:20:46 +00:00
|
|
|
|
}
|
|
|
|
|
|
},
|
2025-12-11 12:29:08 +00:00
|
|
|
|
// sMAG 91 ~ 94
|
2025-12-04 13:51:11 +00:00
|
|
|
|
new SensorModel()
|
|
|
|
|
|
{
|
|
|
|
|
|
ID = "MAGET",
|
|
|
|
|
|
Descricao = "Angulo Direcional ET",
|
|
|
|
|
|
ID_Num = 91,
|
|
|
|
|
|
Componente = S_Code.sMAG,
|
|
|
|
|
|
Aferir = true,
|
|
|
|
|
|
Mandatorio = true,
|
|
|
|
|
|
Funcoes = new List<FuncoesPinout>()
|
|
|
|
|
|
{
|
|
|
|
|
|
FuncoesPinout.I2C,
|
|
|
|
|
|
},
|
|
|
|
|
|
Parametros = new List<SensorParametroModel>()
|
|
|
|
|
|
{
|
|
|
|
|
|
new SensorParametroModel()
|
|
|
|
|
|
{
|
|
|
|
|
|
Descricao = "Endereço I2C",
|
|
|
|
|
|
Valor = "0x36",
|
|
|
|
|
|
QtdBytes = 1,
|
|
|
|
|
|
Escalar = false,
|
|
|
|
|
|
Enviar = true
|
|
|
|
|
|
},
|
|
|
|
|
|
new SensorParametroModel()
|
|
|
|
|
|
{
|
|
|
|
|
|
Descricao = "Canal MUX",
|
|
|
|
|
|
Valor = "1",
|
|
|
|
|
|
QtdBytes = 1,
|
|
|
|
|
|
Escalar = false,
|
|
|
|
|
|
Enviar = true
|
|
|
|
|
|
},
|
|
|
|
|
|
},
|
|
|
|
|
|
ValoresLeituras = new List<SensorValoresLeituraModel>()
|
|
|
|
|
|
{
|
|
|
|
|
|
new SensorValoresLeituraModel()
|
|
|
|
|
|
{
|
|
|
|
|
|
funcao = FuncoesPinout.Iniciado,
|
|
|
|
|
|
posicao = CanMessagePosicaoDados.Status,
|
|
|
|
|
|
indice = 0,
|
|
|
|
|
|
},
|
|
|
|
|
|
new SensorValoresLeituraModel()
|
|
|
|
|
|
{
|
|
|
|
|
|
funcao = FuncoesPinout.LeituraBruta,
|
|
|
|
|
|
posicao = CanMessagePosicaoDados.Dados1,
|
|
|
|
|
|
indice = 0,
|
|
|
|
|
|
unidade_medida = ""
|
|
|
|
|
|
},
|
|
|
|
|
|
new SensorValoresLeituraModel()
|
|
|
|
|
|
{
|
|
|
|
|
|
funcao = FuncoesPinout.LeituraAngulo,
|
|
|
|
|
|
posicao = CanMessagePosicaoDados.Dados1,
|
|
|
|
|
|
indice = 1,
|
|
|
|
|
|
unidade_medida = "°"
|
|
|
|
|
|
},
|
|
|
|
|
|
}
|
|
|
|
|
|
},
|
|
|
|
|
|
new SensorModel()
|
|
|
|
|
|
{
|
|
|
|
|
|
ID = "MAGDT",
|
|
|
|
|
|
Descricao = "Angulo Direcional DT",
|
|
|
|
|
|
ID_Num = 92,
|
|
|
|
|
|
Componente = S_Code.sMAG,
|
|
|
|
|
|
Aferir = true,
|
|
|
|
|
|
Mandatorio = true,
|
|
|
|
|
|
Funcoes = new List<FuncoesPinout>()
|
|
|
|
|
|
{
|
|
|
|
|
|
FuncoesPinout.I2C,
|
|
|
|
|
|
},
|
|
|
|
|
|
Parametros = new List<SensorParametroModel>()
|
|
|
|
|
|
{
|
|
|
|
|
|
new SensorParametroModel()
|
|
|
|
|
|
{
|
|
|
|
|
|
Descricao = "Endereço I2C",
|
|
|
|
|
|
Valor = "0x36",
|
|
|
|
|
|
QtdBytes = 1,
|
|
|
|
|
|
Escalar = false,
|
|
|
|
|
|
Enviar = true
|
|
|
|
|
|
},
|
|
|
|
|
|
new SensorParametroModel()
|
|
|
|
|
|
{
|
|
|
|
|
|
Descricao = "Canal MUX",
|
|
|
|
|
|
Valor = "2",
|
|
|
|
|
|
QtdBytes = 1,
|
|
|
|
|
|
Escalar = false,
|
|
|
|
|
|
Enviar = true
|
|
|
|
|
|
},
|
|
|
|
|
|
},
|
|
|
|
|
|
ValoresLeituras = new List<SensorValoresLeituraModel>()
|
|
|
|
|
|
{
|
|
|
|
|
|
new SensorValoresLeituraModel()
|
|
|
|
|
|
{
|
|
|
|
|
|
funcao = FuncoesPinout.Iniciado,
|
|
|
|
|
|
posicao = CanMessagePosicaoDados.Status,
|
|
|
|
|
|
indice = 0,
|
|
|
|
|
|
},
|
|
|
|
|
|
new SensorValoresLeituraModel()
|
|
|
|
|
|
{
|
|
|
|
|
|
funcao = FuncoesPinout.LeituraBruta,
|
|
|
|
|
|
posicao = CanMessagePosicaoDados.Dados1,
|
|
|
|
|
|
indice = 0,
|
|
|
|
|
|
unidade_medida = ""
|
|
|
|
|
|
},
|
|
|
|
|
|
new SensorValoresLeituraModel()
|
|
|
|
|
|
{
|
|
|
|
|
|
funcao = FuncoesPinout.LeituraAngulo,
|
|
|
|
|
|
posicao = CanMessagePosicaoDados.Dados1,
|
|
|
|
|
|
indice = 1,
|
|
|
|
|
|
unidade_medida = "°"
|
|
|
|
|
|
},
|
|
|
|
|
|
}
|
|
|
|
|
|
},
|
|
|
|
|
|
new SensorModel()
|
|
|
|
|
|
{
|
|
|
|
|
|
ID = "MAGEF",
|
|
|
|
|
|
Descricao = "Angulo Direcional EF",
|
|
|
|
|
|
ID_Num = 93,
|
|
|
|
|
|
Componente = S_Code.sMAG,
|
|
|
|
|
|
Aferir = true,
|
|
|
|
|
|
Mandatorio = true,
|
|
|
|
|
|
Funcoes = new List<FuncoesPinout>()
|
|
|
|
|
|
{
|
|
|
|
|
|
FuncoesPinout.I2C,
|
|
|
|
|
|
},
|
|
|
|
|
|
Parametros = new List<SensorParametroModel>()
|
|
|
|
|
|
{
|
|
|
|
|
|
new SensorParametroModel()
|
|
|
|
|
|
{
|
|
|
|
|
|
Descricao = "Endereço I2C",
|
|
|
|
|
|
Valor = "0x36",
|
|
|
|
|
|
QtdBytes = 1,
|
|
|
|
|
|
Escalar = false,
|
|
|
|
|
|
Enviar = true
|
|
|
|
|
|
},
|
|
|
|
|
|
new SensorParametroModel()
|
|
|
|
|
|
{
|
|
|
|
|
|
Descricao = "Canal MUX",
|
|
|
|
|
|
Valor = "3",
|
|
|
|
|
|
QtdBytes = 1,
|
|
|
|
|
|
Escalar = false,
|
|
|
|
|
|
Enviar = true
|
|
|
|
|
|
},
|
|
|
|
|
|
},
|
|
|
|
|
|
ValoresLeituras = new List<SensorValoresLeituraModel>()
|
|
|
|
|
|
{
|
|
|
|
|
|
new SensorValoresLeituraModel()
|
|
|
|
|
|
{
|
|
|
|
|
|
funcao = FuncoesPinout.Iniciado,
|
|
|
|
|
|
posicao = CanMessagePosicaoDados.Status,
|
|
|
|
|
|
indice = 0,
|
|
|
|
|
|
},
|
|
|
|
|
|
new SensorValoresLeituraModel()
|
|
|
|
|
|
{
|
|
|
|
|
|
funcao = FuncoesPinout.LeituraBruta,
|
|
|
|
|
|
posicao = CanMessagePosicaoDados.Dados1,
|
|
|
|
|
|
indice = 0,
|
|
|
|
|
|
unidade_medida = ""
|
|
|
|
|
|
},
|
|
|
|
|
|
new SensorValoresLeituraModel()
|
|
|
|
|
|
{
|
|
|
|
|
|
funcao = FuncoesPinout.LeituraAngulo,
|
|
|
|
|
|
posicao = CanMessagePosicaoDados.Dados1,
|
|
|
|
|
|
indice = 1,
|
|
|
|
|
|
unidade_medida = "°"
|
|
|
|
|
|
},
|
|
|
|
|
|
}
|
|
|
|
|
|
},
|
|
|
|
|
|
new SensorModel()
|
|
|
|
|
|
{
|
|
|
|
|
|
ID = "MAGDF",
|
|
|
|
|
|
Descricao = "Angulo Direcional DF",
|
|
|
|
|
|
ID_Num = 94,
|
|
|
|
|
|
Componente = S_Code.sMAG,
|
|
|
|
|
|
Aferir = true,
|
|
|
|
|
|
Mandatorio = true,
|
|
|
|
|
|
Funcoes = new List<FuncoesPinout>()
|
|
|
|
|
|
{
|
|
|
|
|
|
FuncoesPinout.I2C,
|
|
|
|
|
|
},
|
|
|
|
|
|
Parametros = new List<SensorParametroModel>()
|
|
|
|
|
|
{
|
|
|
|
|
|
new SensorParametroModel()
|
|
|
|
|
|
{
|
|
|
|
|
|
Descricao = "Endereço I2C",
|
|
|
|
|
|
Valor = "0x36",
|
|
|
|
|
|
QtdBytes = 1,
|
|
|
|
|
|
Escalar = false,
|
|
|
|
|
|
Enviar = true
|
|
|
|
|
|
},
|
|
|
|
|
|
new SensorParametroModel()
|
|
|
|
|
|
{
|
|
|
|
|
|
Descricao = "Canal MUX",
|
|
|
|
|
|
Valor = "4",
|
|
|
|
|
|
QtdBytes = 1,
|
|
|
|
|
|
Escalar = false,
|
|
|
|
|
|
Enviar = true
|
|
|
|
|
|
},
|
|
|
|
|
|
},
|
|
|
|
|
|
ValoresLeituras = new List<SensorValoresLeituraModel>()
|
|
|
|
|
|
{
|
|
|
|
|
|
new SensorValoresLeituraModel()
|
|
|
|
|
|
{
|
|
|
|
|
|
funcao = FuncoesPinout.Iniciado,
|
|
|
|
|
|
posicao = CanMessagePosicaoDados.Status,
|
|
|
|
|
|
indice = 0,
|
|
|
|
|
|
},
|
|
|
|
|
|
new SensorValoresLeituraModel()
|
|
|
|
|
|
{
|
|
|
|
|
|
funcao = FuncoesPinout.LeituraBruta,
|
|
|
|
|
|
posicao = CanMessagePosicaoDados.Dados1,
|
|
|
|
|
|
indice = 0,
|
|
|
|
|
|
unidade_medida = ""
|
|
|
|
|
|
},
|
|
|
|
|
|
new SensorValoresLeituraModel()
|
|
|
|
|
|
{
|
|
|
|
|
|
funcao = FuncoesPinout.LeituraAngulo,
|
|
|
|
|
|
posicao = CanMessagePosicaoDados.Dados1,
|
|
|
|
|
|
indice = 1,
|
|
|
|
|
|
unidade_medida = "°"
|
|
|
|
|
|
},
|
|
|
|
|
|
}
|
|
|
|
|
|
},
|
|
|
|
|
|
|
2024-07-24 20:04:55 +00:00
|
|
|
|
},
|
2025-12-11 12:29:08 +00:00
|
|
|
|
// 41 ~ 44
|
2024-07-24 20:04:55 +00:00
|
|
|
|
Servos = new List<SensorServoModel>()
|
|
|
|
|
|
{
|
|
|
|
|
|
new SensorServoModel()
|
|
|
|
|
|
{
|
2025-11-24 19:58:20 +00:00
|
|
|
|
ID = "FROET",
|
2025-04-09 21:11:40 +00:00
|
|
|
|
ID_Num = 41,
|
2025-02-14 19:33:06 +00:00
|
|
|
|
Descricao = "Freio Motor ET",
|
2025-12-16 17:17:26 +00:00
|
|
|
|
Componente = S_Code.sSRV,
|
2025-02-14 19:33:06 +00:00
|
|
|
|
Controlar = true,
|
2025-05-07 16:54:45 +00:00
|
|
|
|
Mandatorio = false,
|
2024-07-24 20:04:55 +00:00
|
|
|
|
Funcoes = new List<FuncoesPinout>()
|
|
|
|
|
|
{
|
2025-12-16 17:17:26 +00:00
|
|
|
|
FuncoesPinout.Servo,
|
2024-07-24 20:04:55 +00:00
|
|
|
|
},
|
|
|
|
|
|
_AnguloControle = 0,
|
2025-05-06 18:47:59 +00:00
|
|
|
|
Incremental = true,
|
2025-05-30 20:11:31 +00:00
|
|
|
|
ValoresLeituras = new List<SensorValoresLeituraModel>()
|
|
|
|
|
|
{
|
|
|
|
|
|
new SensorValoresLeituraModel()
|
|
|
|
|
|
{
|
|
|
|
|
|
funcao = FuncoesPinout.Iniciado,
|
|
|
|
|
|
posicao = CanMessagePosicaoDados.Status,
|
|
|
|
|
|
indice = 0,
|
|
|
|
|
|
},
|
|
|
|
|
|
new SensorValoresLeituraModel()
|
|
|
|
|
|
{
|
|
|
|
|
|
funcao = FuncoesPinout.ServoAnguloLeitura,
|
|
|
|
|
|
posicao = CanMessagePosicaoDados.Dados1,
|
|
|
|
|
|
indice = 0,
|
2025-06-20 20:10:08 +00:00
|
|
|
|
analise_health = true
|
2025-05-30 20:11:31 +00:00
|
|
|
|
},
|
|
|
|
|
|
}
|
2024-07-24 20:04:55 +00:00
|
|
|
|
},
|
|
|
|
|
|
new SensorServoModel()
|
|
|
|
|
|
{
|
2025-11-24 19:58:20 +00:00
|
|
|
|
ID = "FROEF",
|
2025-04-09 21:11:40 +00:00
|
|
|
|
ID_Num = 42,
|
2024-07-24 20:04:55 +00:00
|
|
|
|
Descricao = "Freio Motor EF",
|
2025-12-16 17:17:26 +00:00
|
|
|
|
Componente = S_Code.sSRV,
|
2025-02-14 19:33:06 +00:00
|
|
|
|
Controlar = false,
|
2025-05-07 16:54:45 +00:00
|
|
|
|
Mandatorio = false,
|
2024-07-24 20:04:55 +00:00
|
|
|
|
Funcoes = new List<FuncoesPinout>()
|
|
|
|
|
|
{
|
2025-12-16 17:17:26 +00:00
|
|
|
|
FuncoesPinout.Servo,
|
2024-07-24 20:04:55 +00:00
|
|
|
|
},
|
|
|
|
|
|
_AnguloControle = 0,
|
2025-05-06 18:47:59 +00:00
|
|
|
|
Incremental = true,
|
2025-05-30 20:11:31 +00:00
|
|
|
|
ValoresLeituras = new List<SensorValoresLeituraModel>()
|
|
|
|
|
|
{
|
|
|
|
|
|
new SensorValoresLeituraModel()
|
|
|
|
|
|
{
|
|
|
|
|
|
funcao = FuncoesPinout.Iniciado,
|
|
|
|
|
|
posicao = CanMessagePosicaoDados.Status,
|
|
|
|
|
|
indice = 0,
|
|
|
|
|
|
},
|
|
|
|
|
|
new SensorValoresLeituraModel()
|
|
|
|
|
|
{
|
|
|
|
|
|
funcao = FuncoesPinout.ServoAnguloLeitura,
|
|
|
|
|
|
posicao = CanMessagePosicaoDados.Dados1,
|
|
|
|
|
|
indice = 0,
|
2025-06-20 20:10:08 +00:00
|
|
|
|
analise_health = true
|
2025-05-30 20:11:31 +00:00
|
|
|
|
},
|
|
|
|
|
|
}
|
2024-07-24 20:04:55 +00:00
|
|
|
|
},
|
|
|
|
|
|
new SensorServoModel()
|
|
|
|
|
|
{
|
2025-11-24 19:58:20 +00:00
|
|
|
|
ID = "FRODT",
|
2025-04-09 21:11:40 +00:00
|
|
|
|
ID_Num = 43,
|
2024-07-24 20:04:55 +00:00
|
|
|
|
Descricao = "Freio Motor DT",
|
2025-12-16 17:17:26 +00:00
|
|
|
|
Componente = S_Code.sSRV,
|
2025-02-14 19:33:06 +00:00
|
|
|
|
Controlar = true,
|
2025-05-07 16:54:45 +00:00
|
|
|
|
Mandatorio = false,
|
2024-07-24 20:04:55 +00:00
|
|
|
|
Funcoes = new List<FuncoesPinout>()
|
|
|
|
|
|
{
|
2025-12-16 17:17:26 +00:00
|
|
|
|
FuncoesPinout.Servo,
|
2024-07-24 20:04:55 +00:00
|
|
|
|
},
|
2025-04-15 13:16:27 +00:00
|
|
|
|
_AnguloControle = 180,
|
2025-05-06 18:47:59 +00:00
|
|
|
|
Incremental = false,
|
2025-05-30 20:11:31 +00:00
|
|
|
|
ValoresLeituras = new List<SensorValoresLeituraModel>()
|
|
|
|
|
|
{
|
|
|
|
|
|
new SensorValoresLeituraModel()
|
|
|
|
|
|
{
|
|
|
|
|
|
funcao = FuncoesPinout.Iniciado,
|
|
|
|
|
|
posicao = CanMessagePosicaoDados.Status,
|
|
|
|
|
|
indice = 0,
|
|
|
|
|
|
},
|
|
|
|
|
|
new SensorValoresLeituraModel()
|
|
|
|
|
|
{
|
|
|
|
|
|
funcao = FuncoesPinout.ServoAnguloLeitura,
|
|
|
|
|
|
posicao = CanMessagePosicaoDados.Dados1,
|
|
|
|
|
|
indice = 0,
|
2025-06-20 20:10:08 +00:00
|
|
|
|
analise_health = true
|
2025-05-30 20:11:31 +00:00
|
|
|
|
},
|
|
|
|
|
|
}
|
2024-07-24 20:04:55 +00:00
|
|
|
|
},
|
|
|
|
|
|
new SensorServoModel()
|
|
|
|
|
|
{
|
2025-11-24 19:58:20 +00:00
|
|
|
|
ID = "FRODF",
|
2025-04-09 21:11:40 +00:00
|
|
|
|
ID_Num = 44,
|
2024-07-24 20:04:55 +00:00
|
|
|
|
Descricao = "Freio Motor DF",
|
2025-12-16 17:17:26 +00:00
|
|
|
|
Componente = S_Code.sSRV,
|
2025-02-14 19:33:06 +00:00
|
|
|
|
Controlar = false,
|
2025-05-07 16:54:45 +00:00
|
|
|
|
Mandatorio = false,
|
2024-07-24 20:04:55 +00:00
|
|
|
|
Funcoes = new List<FuncoesPinout>()
|
|
|
|
|
|
{
|
2025-12-16 17:17:26 +00:00
|
|
|
|
FuncoesPinout.Servo,
|
2024-07-24 20:04:55 +00:00
|
|
|
|
},
|
2025-04-15 13:16:27 +00:00
|
|
|
|
_AnguloControle = 180,
|
2025-05-06 18:47:59 +00:00
|
|
|
|
Incremental = false,
|
2025-05-30 20:11:31 +00:00
|
|
|
|
ValoresLeituras = new List<SensorValoresLeituraModel>()
|
|
|
|
|
|
{
|
|
|
|
|
|
new SensorValoresLeituraModel()
|
|
|
|
|
|
{
|
|
|
|
|
|
funcao = FuncoesPinout.Iniciado,
|
|
|
|
|
|
posicao = CanMessagePosicaoDados.Status,
|
|
|
|
|
|
indice = 0,
|
|
|
|
|
|
},
|
|
|
|
|
|
new SensorValoresLeituraModel()
|
|
|
|
|
|
{
|
|
|
|
|
|
funcao = FuncoesPinout.ServoAnguloLeitura,
|
|
|
|
|
|
posicao = CanMessagePosicaoDados.Dados1,
|
|
|
|
|
|
indice = 0,
|
2025-06-20 20:10:08 +00:00
|
|
|
|
analise_health = true
|
2025-05-30 20:11:31 +00:00
|
|
|
|
},
|
|
|
|
|
|
}
|
2024-07-24 20:04:55 +00:00
|
|
|
|
},
|
2025-04-30 21:49:17 +00:00
|
|
|
|
},
|
2025-12-11 12:29:08 +00:00
|
|
|
|
// 81 ~ 82
|
|
|
|
|
|
Reles = new List<SensorReleModel>()
|
|
|
|
|
|
{
|
|
|
|
|
|
new SensorReleModel()
|
|
|
|
|
|
{
|
|
|
|
|
|
ID = "RLCIN",
|
|
|
|
|
|
ID_Num = 81,
|
|
|
|
|
|
Descricao = "Rele Cooler Entrada",
|
|
|
|
|
|
Componente = S_Code.sRLE,
|
|
|
|
|
|
Controlar = true,
|
|
|
|
|
|
Mandatorio = false,
|
|
|
|
|
|
Funcoes = new List<FuncoesPinout>()
|
|
|
|
|
|
{
|
|
|
|
|
|
FuncoesPinout.Cooler,
|
|
|
|
|
|
},
|
|
|
|
|
|
AtuacaoNivelAlto = true,
|
|
|
|
|
|
ValoresLeituras = new List<SensorValoresLeituraModel>()
|
|
|
|
|
|
{
|
|
|
|
|
|
new SensorValoresLeituraModel()
|
|
|
|
|
|
{
|
|
|
|
|
|
funcao = FuncoesPinout.Iniciado,
|
|
|
|
|
|
posicao = CanMessagePosicaoDados.Status,
|
|
|
|
|
|
indice = 0,
|
|
|
|
|
|
},
|
|
|
|
|
|
new SensorValoresLeituraModel()
|
|
|
|
|
|
{
|
|
|
|
|
|
funcao = FuncoesPinout.EstadoLeitura,
|
|
|
|
|
|
posicao = CanMessagePosicaoDados.Dados1,
|
|
|
|
|
|
indice = 0,
|
|
|
|
|
|
},
|
|
|
|
|
|
}
|
|
|
|
|
|
},
|
|
|
|
|
|
new SensorReleModel()
|
|
|
|
|
|
{
|
|
|
|
|
|
ID = "RLCOUT",
|
|
|
|
|
|
ID_Num = 82,
|
|
|
|
|
|
Descricao = "Rele Cooler Saida",
|
|
|
|
|
|
Componente = S_Code.sRLE,
|
|
|
|
|
|
Controlar = true,
|
|
|
|
|
|
Mandatorio = false,
|
|
|
|
|
|
Funcoes = new List<FuncoesPinout>()
|
|
|
|
|
|
{
|
|
|
|
|
|
FuncoesPinout.Cooler,
|
|
|
|
|
|
},
|
|
|
|
|
|
AtuacaoNivelAlto = true,
|
|
|
|
|
|
ValoresLeituras = new List<SensorValoresLeituraModel>()
|
|
|
|
|
|
{
|
|
|
|
|
|
new SensorValoresLeituraModel()
|
|
|
|
|
|
{
|
|
|
|
|
|
funcao = FuncoesPinout.Iniciado,
|
|
|
|
|
|
posicao = CanMessagePosicaoDados.Status,
|
|
|
|
|
|
indice = 0,
|
|
|
|
|
|
},
|
|
|
|
|
|
new SensorValoresLeituraModel()
|
|
|
|
|
|
{
|
|
|
|
|
|
funcao = FuncoesPinout.EstadoLeitura,
|
|
|
|
|
|
posicao = CanMessagePosicaoDados.Dados1,
|
|
|
|
|
|
indice = 0,
|
|
|
|
|
|
},
|
|
|
|
|
|
}
|
|
|
|
|
|
},
|
|
|
|
|
|
},
|
2025-04-30 21:49:17 +00:00
|
|
|
|
loRaService = new LoRaEspService()
|
|
|
|
|
|
{
|
|
|
|
|
|
ID = "LoRa",
|
|
|
|
|
|
ID_Num = Variaveis.ID_Num_sLRA,
|
|
|
|
|
|
Componente = S_Code.sLRA,
|
|
|
|
|
|
Funcoes = new List<FuncoesPinout>()
|
|
|
|
|
|
{
|
2025-09-16 13:31:32 +00:00
|
|
|
|
FuncoesPinout.ENA,
|
2025-04-30 21:49:17 +00:00
|
|
|
|
FuncoesPinout.M0,
|
|
|
|
|
|
FuncoesPinout.M1,
|
|
|
|
|
|
FuncoesPinout.Aux,
|
|
|
|
|
|
FuncoesPinout.RX,
|
|
|
|
|
|
FuncoesPinout.TX
|
|
|
|
|
|
},
|
|
|
|
|
|
Conectado = false,
|
|
|
|
|
|
Configurado = false,
|
2025-05-19 10:35:58 +00:00
|
|
|
|
ParametrosSet = new LoRaParametrosModel()
|
|
|
|
|
|
{
|
|
|
|
|
|
address = 2,
|
|
|
|
|
|
airRate = 0,
|
|
|
|
|
|
baudRate = 96,
|
|
|
|
|
|
parity = 0,
|
|
|
|
|
|
packetSize = 192,
|
|
|
|
|
|
power = 0,
|
|
|
|
|
|
tranMode = 64,
|
|
|
|
|
|
worCycle = 3,
|
|
|
|
|
|
channelRssi = 0,
|
|
|
|
|
|
lbt = 0,
|
|
|
|
|
|
packetRssi = 0,
|
2025-12-04 13:51:11 +00:00
|
|
|
|
channel = 65,
|
2025-05-19 10:35:58 +00:00
|
|
|
|
key = 0
|
|
|
|
|
|
},
|
|
|
|
|
|
ParametrosGet = new LoRaParametrosModel()
|
2025-04-30 21:49:17 +00:00
|
|
|
|
},
|
2023-11-30 00:41:22 +00:00
|
|
|
|
};
|
2025-02-14 19:33:06 +00:00
|
|
|
|
|
2025-11-24 16:05:50 +00:00
|
|
|
|
for (int i = 0; i < Variaveis.OperacaoEmAndamento.Parametros.QtdCamerasSolo; i++)
|
2025-02-14 19:33:06 +00:00
|
|
|
|
{
|
2025-06-06 20:46:08 +00:00
|
|
|
|
obj.CamerasSolo.Add(new OAKCameraModel());
|
2025-02-14 19:33:06 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
return obj;
|
2023-11-30 00:41:22 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
2024-12-02 19:12:39 +00:00
|
|
|
|
public void LimparDados<T>(T _dados)
|
2024-07-18 18:00:14 +00:00
|
|
|
|
{
|
2024-12-02 19:12:39 +00:00
|
|
|
|
var Dados = _dados as SensoriamentoModel;
|
2024-11-29 20:28:25 +00:00
|
|
|
|
Dados.DadosLeitura = new SensoriamentoMensagemJsonModel();
|
2024-07-24 20:04:55 +00:00
|
|
|
|
Dados.Reles.ForEach(x =>
|
|
|
|
|
|
{
|
2024-11-29 20:28:25 +00:00
|
|
|
|
x.StatusControle = Estado.Desligado;
|
2024-10-29 19:53:27 +00:00
|
|
|
|
});
|
|
|
|
|
|
Dados.Servos.ForEach(x =>
|
|
|
|
|
|
{
|
2025-04-15 19:30:39 +00:00
|
|
|
|
x._AnguloControle = x.Incremental ? 0 : 180;
|
2024-10-29 19:53:27 +00:00
|
|
|
|
});
|
2025-04-30 21:49:17 +00:00
|
|
|
|
loRaService.Conectado = false;
|
|
|
|
|
|
loRaService.Configurado = false;
|
2025-05-19 10:35:58 +00:00
|
|
|
|
loRaService.ParametrosGet.UltimaLeitura = DateTime.MinValue;
|
2025-09-17 18:54:39 +00:00
|
|
|
|
loRaService.MensagensRecebidasAvulsas = new List<LoRaMensagemModel>();
|
2026-02-26 19:57:22 +00:00
|
|
|
|
VisualWorkerService.DadosLeitura.CameraFrames = new Dictionary<TipoFrameCamera, OAKCameraFrameModel>();
|
|
|
|
|
|
WeedWorkerService.DadosLeitura.CameraFrames = new Dictionary<TipoFrameCamera, OAKCameraFrameModel>();
|
2024-10-29 19:53:27 +00:00
|
|
|
|
|
|
|
|
|
|
ReiniciarLeituras(Dados);
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2024-12-02 19:12:39 +00:00
|
|
|
|
public void ReiniciarLeituras(SensoriamentoModel Dados)
|
2024-10-29 19:53:27 +00:00
|
|
|
|
{
|
|
|
|
|
|
Dados.Reles.ForEach(x =>
|
|
|
|
|
|
{
|
2025-05-30 20:11:31 +00:00
|
|
|
|
x.ValoresLeituras.ForEach(l =>
|
|
|
|
|
|
{
|
|
|
|
|
|
l.atual = new CanCommandFreqModel<dynamic>();
|
|
|
|
|
|
});
|
2024-07-24 20:04:55 +00:00
|
|
|
|
});
|
|
|
|
|
|
Dados.Sinaleiros.ForEach(x =>
|
|
|
|
|
|
{
|
2025-05-30 20:11:31 +00:00
|
|
|
|
x.ValoresLeituras.ForEach(l =>
|
|
|
|
|
|
{
|
|
|
|
|
|
l.atual = new CanCommandFreqModel<dynamic>();
|
|
|
|
|
|
});
|
2024-07-24 20:04:55 +00:00
|
|
|
|
});
|
2024-07-18 18:00:14 +00:00
|
|
|
|
Dados.Sensores.ForEach(x =>
|
|
|
|
|
|
{
|
2025-05-30 20:11:31 +00:00
|
|
|
|
x.ValoresLeituras.ForEach(l =>
|
|
|
|
|
|
{
|
|
|
|
|
|
l.atual = new CanCommandFreqModel<dynamic>();
|
|
|
|
|
|
});
|
2024-07-18 18:00:14 +00:00
|
|
|
|
});
|
2024-07-24 20:04:55 +00:00
|
|
|
|
Dados.Servos.ForEach(x =>
|
|
|
|
|
|
{
|
2025-05-30 20:11:31 +00:00
|
|
|
|
x.ValoresLeituras.ForEach(l =>
|
|
|
|
|
|
{
|
|
|
|
|
|
l.atual = new CanCommandFreqModel<dynamic>();
|
|
|
|
|
|
});
|
2024-07-24 20:04:55 +00:00
|
|
|
|
});
|
2024-07-18 18:00:14 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
2025-05-06 18:47:59 +00:00
|
|
|
|
public async Task<bool> VerificaDispositivoConectado()
|
2023-11-30 00:41:22 +00:00
|
|
|
|
{
|
2025-07-17 17:53:42 +00:00
|
|
|
|
if (!CanManager.CanService.IsConnected) return false;
|
2025-02-14 19:33:06 +00:00
|
|
|
|
|
2025-05-06 18:47:59 +00:00
|
|
|
|
if (Variaveis.OperacaoEmAndamento.DispSen == null) return false;
|
2025-04-10 20:59:50 +00:00
|
|
|
|
|
2025-07-17 17:53:42 +00:00
|
|
|
|
CanManager.CanService.RegistrarHandler(_EnderecoCAN_Rx, _SenHandler);
|
2024-06-08 01:20:23 +00:00
|
|
|
|
|
2025-05-06 18:47:59 +00:00
|
|
|
|
RequisitarDadosModulo(Variaveis.ID_Num_sMOD, CanMessagePosicaoDados.Status, CanMessagePosicaoDados.Status, true);
|
2024-06-08 01:20:23 +00:00
|
|
|
|
|
2025-05-06 18:47:59 +00:00
|
|
|
|
DateTime Inicio = DateTime.Now;
|
|
|
|
|
|
bool Respondido() => Variaveis.OperacaoEmAndamento.DispSen.Dados.DadosLeitura.UltimoComandoRespondido > Inicio;
|
|
|
|
|
|
await FuncoesGlobais.AguardarCondicaoAsync(Respondido, 500, 50);
|
2024-07-24 20:04:55 +00:00
|
|
|
|
|
2025-06-20 20:10:08 +00:00
|
|
|
|
if (Conectado)
|
2024-12-02 19:12:39 +00:00
|
|
|
|
{
|
2025-05-06 18:47:59 +00:00
|
|
|
|
DefinirDispositivo();
|
|
|
|
|
|
Variaveis.OperacaoEmAndamento.DispSen?.EnviarProtocolosConfiguracao();
|
2024-12-02 19:12:39 +00:00
|
|
|
|
}
|
2024-11-29 20:28:25 +00:00
|
|
|
|
|
2025-06-20 20:10:08 +00:00
|
|
|
|
return Conectado;
|
2024-11-29 20:28:25 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
2025-04-09 21:11:40 +00:00
|
|
|
|
private void DefinirDispositivo()
|
2024-11-29 20:28:25 +00:00
|
|
|
|
{
|
2025-05-30 20:11:31 +00:00
|
|
|
|
if (!SerialService.DispositivosMapeados.Any(x => x.Dispositivo == DadosLeitura.Dispositivo && x.Mod_ID == Modulo_ID))
|
2025-04-09 21:11:40 +00:00
|
|
|
|
{
|
|
|
|
|
|
SerialService.DispositivosMapeados.Add(new DispositivoDetalhesModel()
|
|
|
|
|
|
{
|
2025-07-17 17:53:42 +00:00
|
|
|
|
Endereco = CanManager.CanService._portName,
|
2025-04-09 21:11:40 +00:00
|
|
|
|
Dispositivo = DadosLeitura.Dispositivo,
|
|
|
|
|
|
Versao = DadosLeitura.Versao.ToString(),
|
|
|
|
|
|
Mod_ID = Modulo_ID,
|
|
|
|
|
|
});
|
2025-10-21 19:23:36 +00:00
|
|
|
|
|
|
|
|
|
|
Variaveis.OperacaoEmAndamento.ModsCalibragem[Dispositivo] = new Dictionary<string, bool>();
|
2026-03-25 14:40:06 +00:00
|
|
|
|
Variaveis.OperacaoEmAndamento.Sensoriamento.InserirLog(Dispositivo, StatusModulo.Conectado, 0, "Dispositivo conectado");
|
2025-04-09 21:11:40 +00:00
|
|
|
|
}
|
|
|
|
|
|
}
|
2024-06-08 01:20:23 +00:00
|
|
|
|
|
2025-05-01 18:27:01 +00:00
|
|
|
|
public void RequisitarDadosModulo(int ID_Num, CanMessagePosicaoDados posicaoTx, CanMessagePosicaoDados posicaoRx, bool aguardaResposta)
|
2025-04-09 21:11:40 +00:00
|
|
|
|
{
|
2025-05-01 18:27:01 +00:00
|
|
|
|
Variaveis.OperacaoEmAndamento.DispSen?.AdicionarMensagemFila(ID_Num, posicaoTx, posicaoRx, null, aguardaResposta);
|
2024-11-29 20:28:25 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
2025-12-18 18:11:30 +00:00
|
|
|
|
public (int, CanMessagePosicaoDados, byte[]) ProtocoloComandoReset()
|
|
|
|
|
|
{
|
|
|
|
|
|
return (
|
|
|
|
|
|
Variaveis.ID_Num_sMOD,
|
|
|
|
|
|
CanMessagePosicaoDados.Command1,
|
|
|
|
|
|
new byte[]
|
|
|
|
|
|
{
|
|
|
|
|
|
(byte)Estado.Reset
|
|
|
|
|
|
}
|
|
|
|
|
|
);
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2025-05-01 18:27:01 +00:00
|
|
|
|
public List<(int, CanMessagePosicaoDados, byte[])> ProtocoloConfiguracao(bool Conectar)
|
2024-11-29 20:28:25 +00:00
|
|
|
|
{
|
2025-04-09 21:11:40 +00:00
|
|
|
|
// Inicializar o dicionário
|
2025-05-01 18:27:01 +00:00
|
|
|
|
List<(int, CanMessagePosicaoDados, byte[])> config = new List<(int, CanMessagePosicaoDados, byte[])>();
|
2024-12-05 17:11:38 +00:00
|
|
|
|
|
2025-04-09 21:11:40 +00:00
|
|
|
|
if (!DadosLeitura.Conectado)
|
|
|
|
|
|
{
|
|
|
|
|
|
// Adicionar configuração do ProtocoloMOD
|
|
|
|
|
|
var protocoloMOD = ModConfig(Conectar);
|
2025-04-11 20:13:15 +00:00
|
|
|
|
config.AddRange(protocoloMOD);
|
2025-04-09 21:11:40 +00:00
|
|
|
|
}
|
2024-11-29 20:28:25 +00:00
|
|
|
|
|
2025-04-24 21:11:33 +00:00
|
|
|
|
bool configurarTodos = !DadosLeitura.Conectado && Conectar;
|
|
|
|
|
|
|
2025-04-09 21:11:40 +00:00
|
|
|
|
// Adicionar configurações dos Sinaleiros
|
2025-05-01 18:27:01 +00:00
|
|
|
|
var sinaleirosConfig = SinaleirosConfig(Conectar, configurarTodos);
|
2025-04-09 21:11:40 +00:00
|
|
|
|
config.AddRange(sinaleirosConfig);
|
|
|
|
|
|
|
|
|
|
|
|
// Adicionar configurações dos Servos
|
2025-05-01 18:27:01 +00:00
|
|
|
|
var servosConfig = ServosConfig(Conectar, configurarTodos);
|
2025-04-09 21:11:40 +00:00
|
|
|
|
config.AddRange(servosConfig);
|
|
|
|
|
|
|
|
|
|
|
|
// Adicionar configurações dos Reles
|
2025-05-01 18:27:01 +00:00
|
|
|
|
var relesConfig = RelesConfig(Conectar, configurarTodos);
|
2025-04-09 21:11:40 +00:00
|
|
|
|
config.AddRange(relesConfig);
|
|
|
|
|
|
|
|
|
|
|
|
// Adicionar configurações dos Sensores que devem ser aferidos
|
2025-05-01 18:27:01 +00:00
|
|
|
|
var sensoresConfig = SensoresConfig(Conectar, configurarTodos);
|
2025-04-09 21:11:40 +00:00
|
|
|
|
config.AddRange(sensoresConfig);
|
|
|
|
|
|
|
2025-04-30 21:49:17 +00:00
|
|
|
|
// Adicionar configurações do LoRa
|
2025-12-04 13:51:11 +00:00
|
|
|
|
if (Variaveis.OperacaoEmAndamento.Parametros.ModulosMandatorios.Any(x => x.Dispositivo == T_Code.Lra && x.Mandatorio && x.Utilizar) && (!loRaService.Conectado || !loRaService.Configurado || configurarTodos))
|
2025-04-30 21:49:17 +00:00
|
|
|
|
{
|
2025-05-01 18:27:01 +00:00
|
|
|
|
var loraConfig = loRaService.ProtocoloConfiguracao(Pinout, Conectar);
|
|
|
|
|
|
config.AddRange(loraConfig);
|
2025-04-30 21:49:17 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
2025-04-09 21:11:40 +00:00
|
|
|
|
return config;
|
2024-11-29 20:28:25 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
2025-05-01 18:27:01 +00:00
|
|
|
|
private List<(int, CanMessagePosicaoDados, byte[])> ModConfig(bool Conectar)
|
2024-11-29 20:28:25 +00:00
|
|
|
|
{
|
2025-04-11 20:13:15 +00:00
|
|
|
|
var config1 = new List<byte>
|
2025-04-09 21:11:40 +00:00
|
|
|
|
{
|
|
|
|
|
|
(byte)(Conectar ? 1 : 0),
|
|
|
|
|
|
(byte)(_TaxaAmostragem / 10),
|
|
|
|
|
|
(byte)(RequisitarDados ? 1 : 0),
|
2025-04-30 21:49:17 +00:00
|
|
|
|
LoRaParametrosBase.address
|
2025-04-09 21:11:40 +00:00
|
|
|
|
};
|
2025-04-14 12:52:19 +00:00
|
|
|
|
|
2025-05-01 18:27:01 +00:00
|
|
|
|
config1.AddRange(PinoutModel.PinoProtocolo(Pinout, Funcoes, false));
|
2024-11-29 20:28:25 +00:00
|
|
|
|
|
2025-05-01 18:27:01 +00:00
|
|
|
|
return new List<(int, CanMessagePosicaoDados, byte[])>()
|
2025-04-14 12:52:19 +00:00
|
|
|
|
{
|
2025-05-01 18:27:01 +00:00
|
|
|
|
(Variaveis.ID_Num_sMOD, CanMessagePosicaoDados.Config1, config1.ToArray()),
|
2025-04-14 12:52:19 +00:00
|
|
|
|
};
|
2024-11-29 20:28:25 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
2025-05-01 18:27:01 +00:00
|
|
|
|
public List<(int, CanMessagePosicaoDados, byte[])> SensoresConfig(bool Conectar, bool ConfigurarTodos)
|
2024-11-29 20:28:25 +00:00
|
|
|
|
{
|
2025-05-01 18:27:01 +00:00
|
|
|
|
var config = new List<(int, CanMessagePosicaoDados, byte[])>();
|
2024-12-05 17:11:38 +00:00
|
|
|
|
|
2025-04-24 21:11:33 +00:00
|
|
|
|
foreach (var sensor in Sensores.Where(x => (x.Aferir && (ConfigurarTodos ? true : x.Inicializado != Conectar)) || (!x.Aferir && x.Inicializado)))
|
2025-04-09 21:11:40 +00:00
|
|
|
|
{
|
2025-04-24 21:11:33 +00:00
|
|
|
|
if (!sensor.Aferir && sensor.Inicializado)
|
|
|
|
|
|
{
|
|
|
|
|
|
Conectar = false;
|
|
|
|
|
|
}
|
2025-05-01 18:27:01 +00:00
|
|
|
|
(CanMessagePosicaoDados posicao, byte[] payload) = sensor.ProtocoloConfiguracao(Pinout, Conectar, Dispositivo);
|
2025-04-09 21:11:40 +00:00
|
|
|
|
if (payload != null)
|
|
|
|
|
|
{
|
2025-05-01 18:27:01 +00:00
|
|
|
|
|
|
|
|
|
|
config.Add((sensor.ID_Num, posicao, payload));
|
2025-04-09 21:11:40 +00:00
|
|
|
|
}
|
|
|
|
|
|
}
|
2024-11-29 20:28:25 +00:00
|
|
|
|
|
2025-04-09 21:11:40 +00:00
|
|
|
|
return config;
|
2024-11-29 20:28:25 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
2025-05-01 18:27:01 +00:00
|
|
|
|
private List<(int, CanMessagePosicaoDados, byte[])> SinaleirosConfig(bool Conectar, bool ConfigurarTodos)
|
2024-11-29 20:28:25 +00:00
|
|
|
|
{
|
2025-05-01 18:27:01 +00:00
|
|
|
|
var config = new List<(int, CanMessagePosicaoDados, byte[])>();
|
2024-12-05 17:11:38 +00:00
|
|
|
|
|
2025-12-18 18:11:30 +00:00
|
|
|
|
foreach (var sinaleiro in Sinaleiros.Where(x => (x.Controlar && (ConfigurarTodos ? true : x.Inicializado != Conectar)) || (!x.Controlar && x.Inicializado)))
|
2025-04-09 21:11:40 +00:00
|
|
|
|
{
|
2025-12-18 18:11:30 +00:00
|
|
|
|
if (!sinaleiro.Controlar && sinaleiro.Inicializado)
|
|
|
|
|
|
{
|
|
|
|
|
|
Conectar = false;
|
|
|
|
|
|
}
|
2025-05-01 18:27:01 +00:00
|
|
|
|
(CanMessagePosicaoDados posicao, var payload) = sinaleiro.ProtocoloConfiguracao(Pinout, Conectar);
|
2025-04-09 21:11:40 +00:00
|
|
|
|
if (payload != null)
|
|
|
|
|
|
{
|
2025-05-01 18:27:01 +00:00
|
|
|
|
config.Add((sinaleiro.ID_Num, posicao, payload));
|
2025-04-09 21:11:40 +00:00
|
|
|
|
}
|
|
|
|
|
|
}
|
2024-11-29 20:28:25 +00:00
|
|
|
|
|
2025-04-09 21:11:40 +00:00
|
|
|
|
return config;
|
2023-11-30 00:41:22 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
2025-05-01 18:27:01 +00:00
|
|
|
|
private List<(int, CanMessagePosicaoDados, byte[])> RelesConfig(bool Conectar, bool ConfigurarTodos)
|
2024-06-28 20:14:24 +00:00
|
|
|
|
{
|
2025-05-01 18:27:01 +00:00
|
|
|
|
var config = new List<(int, CanMessagePosicaoDados, byte[])>();
|
2024-06-28 20:14:24 +00:00
|
|
|
|
|
2025-04-24 21:11:33 +00:00
|
|
|
|
foreach (var rele in Reles.Where(x => (x.Controlar && (ConfigurarTodos ? true : x.Inicializado != Conectar)) || (!x.Controlar && x.Inicializado)))
|
2024-06-28 20:14:24 +00:00
|
|
|
|
{
|
2025-04-24 21:11:33 +00:00
|
|
|
|
if (!rele.Controlar && rele.Inicializado)
|
|
|
|
|
|
{
|
|
|
|
|
|
Conectar = false;
|
|
|
|
|
|
}
|
2025-05-01 18:27:01 +00:00
|
|
|
|
(CanMessagePosicaoDados posicao, var payload) = rele.ProtocoloConfiguracao(Pinout, Conectar);
|
2025-04-09 21:11:40 +00:00
|
|
|
|
if (payload != null)
|
|
|
|
|
|
{
|
2025-05-01 18:27:01 +00:00
|
|
|
|
config.Add((rele.ID_Num, posicao, payload));
|
2025-04-09 21:11:40 +00:00
|
|
|
|
}
|
2024-06-28 20:14:24 +00:00
|
|
|
|
}
|
2025-04-09 21:11:40 +00:00
|
|
|
|
|
|
|
|
|
|
return config;
|
2024-06-28 20:14:24 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
2025-05-01 18:27:01 +00:00
|
|
|
|
private List<(int, CanMessagePosicaoDados, byte[])> ServosConfig(bool Conectar, bool ConfigurarTodos)
|
2024-07-18 18:00:14 +00:00
|
|
|
|
{
|
2025-05-01 18:27:01 +00:00
|
|
|
|
var config = new List<(int, CanMessagePosicaoDados, byte[])>();
|
2025-04-09 21:11:40 +00:00
|
|
|
|
|
2025-04-24 21:11:33 +00:00
|
|
|
|
foreach (var servo in Servos.Where(x => (x.Controlar && (ConfigurarTodos ? true : x.Inicializado != Conectar)) || (!x.Controlar && x.Inicializado)))
|
2025-04-09 21:11:40 +00:00
|
|
|
|
{
|
2025-04-24 21:11:33 +00:00
|
|
|
|
if (!servo.Controlar && servo.Inicializado)
|
|
|
|
|
|
{
|
|
|
|
|
|
Conectar = false;
|
|
|
|
|
|
}
|
2025-05-01 18:27:01 +00:00
|
|
|
|
(CanMessagePosicaoDados posicao, var payload) = servo.ProtocoloConfiguracao(Pinout, Conectar);
|
2025-04-09 21:11:40 +00:00
|
|
|
|
if (payload != null)
|
|
|
|
|
|
{
|
2025-05-01 18:27:01 +00:00
|
|
|
|
config.Add((servo.ID_Num, posicao, payload));
|
2025-04-09 21:11:40 +00:00
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
return config;
|
2024-07-18 18:00:14 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
2024-01-03 10:52:37 +00:00
|
|
|
|
public void IniciarRegistrador()
|
|
|
|
|
|
{
|
2024-11-29 20:28:25 +00:00
|
|
|
|
if (!(tmrRegistrador?.IsRunning ?? false))
|
2024-11-27 17:38:56 +00:00
|
|
|
|
{
|
|
|
|
|
|
LimparDados(this);
|
|
|
|
|
|
|
|
|
|
|
|
PararRegistrador();
|
|
|
|
|
|
|
|
|
|
|
|
tmrRegistrador = new AsyncTaskTimerModel("tmrRegistrador_" + T_Code.Sen.ToString(), tmrRegistrador_Tick, _TaxaAmostragem);
|
|
|
|
|
|
tmrRegistrador.Start();
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
2024-01-03 10:52:37 +00:00
|
|
|
|
|
2024-11-27 17:38:56 +00:00
|
|
|
|
public void PararRegistrador()
|
|
|
|
|
|
{
|
|
|
|
|
|
tmrRegistrador?.Dispose();
|
2024-01-03 10:52:37 +00:00
|
|
|
|
}
|
2024-06-14 09:37:22 +00:00
|
|
|
|
|
2024-11-27 17:38:56 +00:00
|
|
|
|
public async Task tmrRegistrador_Tick()
|
2024-06-14 09:37:22 +00:00
|
|
|
|
{
|
2025-12-18 18:11:30 +00:00
|
|
|
|
if (Variaveis.Fechando) return;
|
2025-03-27 11:47:00 +00:00
|
|
|
|
|
2024-11-27 17:38:56 +00:00
|
|
|
|
tmrRegistrador.SetInterval(_TaxaAmostragem);
|
|
|
|
|
|
|
2025-04-10 20:59:50 +00:00
|
|
|
|
if (SerialService.DispositivosMapeados.Any(x => x.Dispositivo == T_Code.Sen) && (_VezesLeituraReconexao >= _TempoReconexaoComponentes))
|
2024-11-27 17:38:56 +00:00
|
|
|
|
{
|
2024-11-29 20:28:25 +00:00
|
|
|
|
Variaveis.OperacaoEmAndamento.DispSen?.EnviarProtocolosConfiguracao();
|
|
|
|
|
|
|
|
|
|
|
|
_VezesLeituraReconexao = 0;
|
2024-11-27 17:38:56 +00:00
|
|
|
|
}
|
2024-11-29 20:28:25 +00:00
|
|
|
|
else
|
2024-11-27 17:38:56 +00:00
|
|
|
|
{
|
2024-11-29 20:28:25 +00:00
|
|
|
|
_VezesLeituraReconexao++;
|
2024-11-27 17:38:56 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
2024-11-29 20:28:25 +00:00
|
|
|
|
|
2025-04-09 21:11:40 +00:00
|
|
|
|
if (DadosLeitura.Conectado)
|
2024-11-27 17:38:56 +00:00
|
|
|
|
{
|
2024-12-03 20:55:25 +00:00
|
|
|
|
if (RequisitarDados)
|
|
|
|
|
|
{
|
2025-05-01 18:27:01 +00:00
|
|
|
|
RequisitarDadosModulo(Variaveis.ID_Num_sTOD, CanMessagePosicaoDados.DadosAll, CanMessagePosicaoDados.DadosAll, true);
|
2024-12-03 20:55:25 +00:00
|
|
|
|
}
|
2025-07-18 20:03:37 +00:00
|
|
|
|
VerificaControleLeitura();
|
2024-11-27 17:38:56 +00:00
|
|
|
|
}
|
2024-06-14 09:37:22 +00:00
|
|
|
|
|
2025-04-16 16:44:06 +00:00
|
|
|
|
AtualizaComponentesIniciados();
|
|
|
|
|
|
}
|
2024-06-14 09:37:22 +00:00
|
|
|
|
|
2025-07-18 20:03:37 +00:00
|
|
|
|
private void VerificaControleLeitura()
|
|
|
|
|
|
{
|
2025-12-18 18:11:30 +00:00
|
|
|
|
if (Variaveis.Fechando) return;
|
2025-07-18 20:03:37 +00:00
|
|
|
|
|
2025-12-18 18:11:30 +00:00
|
|
|
|
foreach (var sinaleiro in Sinaleiros.Where(x => x.Controlar && x.Inicializado))
|
|
|
|
|
|
{
|
|
|
|
|
|
if (sinaleiro.Comportamento.statusLED != sinaleiro._StatusLed || sinaleiro.Comportamento.id != sinaleiro._StatusLedId)
|
2025-07-18 20:03:37 +00:00
|
|
|
|
{
|
2025-12-18 18:11:30 +00:00
|
|
|
|
GeneralJoystick.EnviarComandoSensoriamento(sinaleiro.Componente, sinaleiro.ID, sinaleiro.Comportamento);
|
2025-07-18 20:03:37 +00:00
|
|
|
|
}
|
2025-12-18 18:11:30 +00:00
|
|
|
|
}
|
2025-07-18 20:03:37 +00:00
|
|
|
|
|
2025-12-18 18:11:30 +00:00
|
|
|
|
foreach (var rele in Reles.Where(x => x.Controlar && x.Inicializado))
|
|
|
|
|
|
{
|
|
|
|
|
|
if (rele.StatusControle != rele._EstadoLeitura)
|
2025-07-18 20:03:37 +00:00
|
|
|
|
{
|
2025-12-18 18:11:30 +00:00
|
|
|
|
GeneralJoystick.EnviarComandoSensoriamento(rele.Componente, rele.ID, rele.StatusControle);
|
2025-07-18 20:03:37 +00:00
|
|
|
|
}
|
2025-12-18 18:11:30 +00:00
|
|
|
|
}
|
2025-07-18 20:03:37 +00:00
|
|
|
|
|
2025-12-18 18:11:30 +00:00
|
|
|
|
foreach (var servo in Servos.Where(x => x.Controlar && x.Inicializado))
|
|
|
|
|
|
{
|
|
|
|
|
|
if (servo._AnguloControle != servo._AnguloLeiutra)
|
2025-07-18 20:03:37 +00:00
|
|
|
|
{
|
2025-12-18 18:11:30 +00:00
|
|
|
|
GeneralJoystick.EnviarComandoSensoriamento(servo.Componente, servo.ID, servo._AnguloControle);
|
2025-07-18 20:03:37 +00:00
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2025-04-16 16:44:06 +00:00
|
|
|
|
private void AtualizaComponentesIniciados()
|
|
|
|
|
|
{
|
|
|
|
|
|
DateTime Agora = DateTime.Now;
|
|
|
|
|
|
bool modConectado = DadosLeitura.UltimoComandoRespondido.AddMilliseconds(TempoLimiteConexao) > Agora;
|
|
|
|
|
|
if (!modConectado && DadosLeitura.Conectado)
|
|
|
|
|
|
{
|
|
|
|
|
|
DadosLeitura.Conectado = false;
|
|
|
|
|
|
}
|
2025-05-30 20:11:31 +00:00
|
|
|
|
foreach (var led in Sinaleiros.Where(x => x.Inicializado && x.UltimaLeitura.AddMilliseconds(TempoLimiteConexao) < Agora))
|
2025-04-16 16:44:06 +00:00
|
|
|
|
{
|
2025-05-30 20:11:31 +00:00
|
|
|
|
led.Inicializado = false;
|
2025-04-16 16:44:06 +00:00
|
|
|
|
}
|
2025-05-30 20:11:31 +00:00
|
|
|
|
foreach (var rele in Reles.Where(x => x.Inicializado && x.UltimaLeitura.AddMilliseconds(TempoLimiteConexao) < Agora))
|
2025-04-16 16:44:06 +00:00
|
|
|
|
{
|
2025-05-30 20:11:31 +00:00
|
|
|
|
rele.Inicializado = false;
|
2025-04-16 16:44:06 +00:00
|
|
|
|
}
|
2025-05-30 20:11:31 +00:00
|
|
|
|
foreach (var servo in Servos.Where(x => x.Inicializado && x.UltimaLeitura.AddMilliseconds(TempoLimiteConexao) < Agora))
|
2025-04-16 16:44:06 +00:00
|
|
|
|
{
|
2025-05-30 20:11:31 +00:00
|
|
|
|
servo.Inicializado = false;
|
2025-04-16 16:44:06 +00:00
|
|
|
|
}
|
2025-05-30 20:11:31 +00:00
|
|
|
|
foreach (var sensor in Sensores.Where(x => x.Inicializado && x.UltimaLeitura.AddMilliseconds(TempoLimiteConexao) < Agora))
|
2025-04-16 16:44:06 +00:00
|
|
|
|
{
|
2025-05-30 20:11:31 +00:00
|
|
|
|
sensor.Inicializado = false;
|
2025-04-16 16:44:06 +00:00
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2025-12-18 18:11:30 +00:00
|
|
|
|
public void AtualizarStatusSinaleiros(ModoOperacao Modo, StatusOperacao _statusOperacao)
|
|
|
|
|
|
{
|
2025-12-18 20:14:27 +00:00
|
|
|
|
Sinaleiros.First(x => x.ID == "LEDMN").Comportamento = VariaveisEquipamento.ComportamentoLedPorStatus(Modo == ModoOperacao.Manual ? StatusLED.Aceso : StatusLED.Apagado);
|
|
|
|
|
|
Sinaleiros.First(x => x.ID == "LEDAT").Comportamento = VariaveisEquipamento.ComportamentoLedPorStatus(Modo == ModoOperacao.Manual ? StatusLED.Apagado : StatusLED.Aceso);
|
|
|
|
|
|
Sinaleiros.First(x => x.ID == "LEDOP").Comportamento = VariaveisEquipamento.ComportamentoLedPorStatus(StatusLED.Piscando, status_operacao: _statusOperacao);
|
2025-12-18 18:11:30 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
2023-11-30 00:41:22 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
public class SensorModel
|
|
|
|
|
|
{
|
|
|
|
|
|
public string ID { get; set; }
|
2025-04-09 21:11:40 +00:00
|
|
|
|
public int ID_Num { get; set; }
|
2023-11-30 00:41:22 +00:00
|
|
|
|
public string Descricao { get; set; }
|
|
|
|
|
|
public S_Code Componente { get; set; }
|
2025-12-18 18:11:30 +00:00
|
|
|
|
public bool Aferir { get; set; }
|
2025-05-07 16:54:45 +00:00
|
|
|
|
public bool Mandatorio { get; set; }
|
|
|
|
|
|
public bool Liberado
|
|
|
|
|
|
{
|
|
|
|
|
|
get
|
|
|
|
|
|
{
|
|
|
|
|
|
return !Mandatorio || (Aferir && Inicializado);
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
2025-05-30 20:11:31 +00:00
|
|
|
|
public bool Inicializado { get; set; }
|
|
|
|
|
|
public DateTime UltimaLeitura
|
2024-11-29 20:28:25 +00:00
|
|
|
|
{
|
|
|
|
|
|
get
|
|
|
|
|
|
{
|
2025-05-30 20:11:31 +00:00
|
|
|
|
return ValoresLeituras.OrderByDescending(x => x.atual.lidoEm).FirstOrDefault()?.atual?.lidoEm ?? DateTime.MinValue;
|
2024-11-29 20:28:25 +00:00
|
|
|
|
}
|
|
|
|
|
|
}
|
2023-11-30 00:41:22 +00:00
|
|
|
|
public List<FuncoesPinout> Funcoes { get; set; }
|
2025-12-15 13:41:05 +00:00
|
|
|
|
public List<SensorParametroModel> Parametros { get; set; }
|
|
|
|
|
|
public List<SensorValoresLeituraModel> ValoresLeituras { get; set; }
|
2023-11-30 00:41:22 +00:00
|
|
|
|
|
2025-05-01 18:27:01 +00:00
|
|
|
|
public (CanMessagePosicaoDados, byte[]) ProtocoloConfiguracao(PinoutDataModel Pinout, bool conectar, T_Code Dispositivo)
|
2023-11-30 00:41:22 +00:00
|
|
|
|
{
|
2025-04-09 21:11:40 +00:00
|
|
|
|
List<byte> config = new List<byte>
|
|
|
|
|
|
{
|
2025-04-11 20:13:15 +00:00
|
|
|
|
(byte)Componente,
|
2025-04-09 21:11:40 +00:00
|
|
|
|
(byte)(conectar ? 1 : 0),
|
|
|
|
|
|
};
|
|
|
|
|
|
|
2025-04-14 12:52:19 +00:00
|
|
|
|
var _pinout = Pinout.Clone();
|
2024-04-15 10:57:37 +00:00
|
|
|
|
_pinout.Pinos = _pinout.Pinos.Where(x => x.ComponenteID == ID).ToList();
|
2025-04-09 21:11:40 +00:00
|
|
|
|
if (_pinout.Pinos.Count > 0)
|
2024-01-23 17:10:34 +00:00
|
|
|
|
{
|
2025-04-14 12:52:19 +00:00
|
|
|
|
bool enviaBarramento = Dispositivo == T_Code.Sen;
|
2025-04-10 20:59:50 +00:00
|
|
|
|
|
|
|
|
|
|
byte[] pinos = PinoutModel.PinoProtocolo(_pinout, Funcoes, enviaBarramento);
|
2025-04-09 21:11:40 +00:00
|
|
|
|
config.AddRange(pinos);
|
2024-01-23 17:10:34 +00:00
|
|
|
|
}
|
2025-04-09 21:11:40 +00:00
|
|
|
|
|
|
|
|
|
|
foreach (var parametro in Parametros)
|
|
|
|
|
|
{
|
|
|
|
|
|
if (parametro.Enviar)
|
|
|
|
|
|
{
|
|
|
|
|
|
byte[] paramBytes = parametro.InterpretarParametro();
|
|
|
|
|
|
config.AddRange(paramBytes);
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2025-05-01 18:27:01 +00:00
|
|
|
|
return (CanMessagePosicaoDados.Config1, config.ToArray());
|
2025-05-30 20:11:31 +00:00
|
|
|
|
}
|
2025-04-09 21:11:40 +00:00
|
|
|
|
|
2023-11-30 00:41:22 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
2024-04-02 18:33:15 +00:00
|
|
|
|
public class SensorSinaleiroModel
|
|
|
|
|
|
{
|
|
|
|
|
|
public string ID { get; set; }
|
2025-04-09 21:11:40 +00:00
|
|
|
|
public int ID_Num { get; set; }
|
2024-04-02 18:33:15 +00:00
|
|
|
|
public string Descricao { get; set; }
|
|
|
|
|
|
public S_Code Componente { get; set; }
|
2025-12-18 18:11:30 +00:00
|
|
|
|
public bool Controlar { get; set; }
|
|
|
|
|
|
public bool Mandatorio { get; set; }
|
2024-04-02 18:33:15 +00:00
|
|
|
|
public List<FuncoesPinout> Funcoes { get; set; }
|
|
|
|
|
|
public SensorSinaleiroComportamentoModel Comportamento { get; set; }
|
2025-05-30 20:11:31 +00:00
|
|
|
|
public bool Inicializado { get; set; }
|
|
|
|
|
|
public DateTime UltimaLeitura
|
2024-12-03 20:55:25 +00:00
|
|
|
|
{
|
|
|
|
|
|
get
|
|
|
|
|
|
{
|
2025-05-30 20:11:31 +00:00
|
|
|
|
return ValoresLeituras.OrderByDescending(x => x.atual.lidoEm).FirstOrDefault()?.atual?.lidoEm ?? DateTime.MinValue;
|
2024-12-03 20:55:25 +00:00
|
|
|
|
}
|
|
|
|
|
|
}
|
2025-12-15 13:41:05 +00:00
|
|
|
|
public List<SensorValoresLeituraModel> ValoresLeituras { get; set; }
|
2025-12-18 20:14:27 +00:00
|
|
|
|
public int _StatusLedId => (int)(ValoresLeituras?.FirstOrDefault(x => x.funcao == FuncoesPinout.StatusLedID)?.atual?.valor ?? 99);
|
|
|
|
|
|
public StatusLED _StatusLed => (StatusLED)(ValoresLeituras?.FirstOrDefault(x => x.funcao == FuncoesPinout.StatusLedLeitura)?.atual?.valor ?? StatusLED.Apagado);
|
2024-04-02 18:33:15 +00:00
|
|
|
|
|
2025-05-01 18:27:01 +00:00
|
|
|
|
public (CanMessagePosicaoDados, byte[]) ProtocoloConfiguracao(PinoutDataModel pinout, bool conectar)
|
2024-04-02 18:33:15 +00:00
|
|
|
|
{
|
2025-04-09 21:11:40 +00:00
|
|
|
|
var pino = pinout.Pinos.FirstOrDefault(p => p.ComponenteID == ID);
|
|
|
|
|
|
List<byte> config = new List<byte>
|
2024-04-15 10:57:37 +00:00
|
|
|
|
{
|
2025-04-11 20:13:15 +00:00
|
|
|
|
(byte)Componente,
|
2025-04-09 21:11:40 +00:00
|
|
|
|
(byte)(conectar ? 1 : 0),
|
|
|
|
|
|
(byte)(pino?.Barramento ?? TiposBarramentos.CONTROLADOR),
|
|
|
|
|
|
(byte)(pino?.Pino ?? PinoutUtils.PINO_INVALIDO)
|
2024-04-15 10:57:37 +00:00
|
|
|
|
};
|
2025-04-09 21:11:40 +00:00
|
|
|
|
|
2025-05-01 18:27:01 +00:00
|
|
|
|
return (CanMessagePosicaoDados.Config1, config.ToArray());
|
2024-04-02 18:33:15 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
2025-05-01 18:27:01 +00:00
|
|
|
|
public (int, CanMessagePosicaoDados, byte[]) ProtocoloComando()
|
2024-04-02 18:33:15 +00:00
|
|
|
|
{
|
2025-04-09 21:11:40 +00:00
|
|
|
|
List<byte> frame = new List<byte>
|
|
|
|
|
|
{
|
2025-12-18 18:11:30 +00:00
|
|
|
|
(byte)Comportamento.id,
|
2025-04-09 21:11:40 +00:00
|
|
|
|
(byte)Comportamento.statusLED,
|
|
|
|
|
|
(byte)Comportamento.QtdPiscadas,
|
|
|
|
|
|
(byte)(Comportamento.TempoMs / 10),
|
|
|
|
|
|
(byte)(Comportamento.PausaMs / 10)
|
|
|
|
|
|
};
|
2024-04-02 18:33:15 +00:00
|
|
|
|
|
2025-05-01 18:27:01 +00:00
|
|
|
|
return (ID_Num, CanMessagePosicaoDados.Command1, frame.ToArray());
|
2024-04-02 18:33:15 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
2024-07-18 18:00:14 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
public class SensorReleModel
|
|
|
|
|
|
{
|
|
|
|
|
|
public string ID { get; set; }
|
2025-04-09 21:11:40 +00:00
|
|
|
|
public int ID_Num { get; set; }
|
2024-07-18 18:00:14 +00:00
|
|
|
|
public string Descricao { get; set; }
|
|
|
|
|
|
public S_Code Componente { get; set; }
|
|
|
|
|
|
public List<FuncoesPinout> Funcoes { get; set; }
|
2024-07-24 20:04:55 +00:00
|
|
|
|
public bool Controlar { get; set; }
|
2025-05-07 16:54:45 +00:00
|
|
|
|
public bool Mandatorio { get; set; }
|
|
|
|
|
|
public bool Liberado
|
|
|
|
|
|
{
|
|
|
|
|
|
get
|
|
|
|
|
|
{
|
|
|
|
|
|
return !Mandatorio || (Controlar && Inicializado);
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
2024-11-29 20:28:25 +00:00
|
|
|
|
public bool AtuacaoNivelAlto { get; set; }
|
2024-07-18 18:00:14 +00:00
|
|
|
|
public Estado StatusControle { get; set; }
|
2025-05-30 20:11:31 +00:00
|
|
|
|
public bool Inicializado { get; set; }
|
|
|
|
|
|
public DateTime UltimaLeitura
|
2024-12-03 20:55:25 +00:00
|
|
|
|
{
|
|
|
|
|
|
get
|
|
|
|
|
|
{
|
2025-05-30 20:11:31 +00:00
|
|
|
|
return ValoresLeituras.OrderByDescending(x => x.atual.lidoEm).FirstOrDefault()?.atual?.lidoEm ?? DateTime.MinValue;
|
2024-12-03 20:55:25 +00:00
|
|
|
|
}
|
|
|
|
|
|
}
|
2025-12-15 13:41:05 +00:00
|
|
|
|
public List<SensorValoresLeituraModel> ValoresLeituras { get; set; }
|
2025-12-16 17:17:26 +00:00
|
|
|
|
public Estado _EstadoLeitura => ValoresLeituras?.FirstOrDefault(x => x.funcao == FuncoesPinout.EstadoLeitura)?.atual?.valor ?? Estado.Desligado;
|
|
|
|
|
|
|
2024-07-18 18:00:14 +00:00
|
|
|
|
|
2025-05-01 18:27:01 +00:00
|
|
|
|
public (CanMessagePosicaoDados, byte[]) ProtocoloConfiguracao(PinoutDataModel pinout, bool conectar)
|
2024-07-18 18:00:14 +00:00
|
|
|
|
{
|
2025-04-09 21:11:40 +00:00
|
|
|
|
var pino = pinout.Pinos.FirstOrDefault(p => p.ComponenteID == ID);
|
|
|
|
|
|
List<byte> config = new List<byte>
|
2024-07-18 18:00:14 +00:00
|
|
|
|
{
|
2025-04-11 20:13:15 +00:00
|
|
|
|
(byte)Componente,
|
2025-04-09 21:11:40 +00:00
|
|
|
|
(byte)(conectar ? 1 : 0),
|
|
|
|
|
|
(byte)(AtuacaoNivelAlto ? 1 : 0),
|
|
|
|
|
|
(byte)(pino?.Barramento ?? TiposBarramentos.CONTROLADOR),
|
|
|
|
|
|
(byte)(pino?.Pino ?? PinoutUtils.PINO_INVALIDO)
|
2024-07-18 18:00:14 +00:00
|
|
|
|
};
|
2025-04-09 21:11:40 +00:00
|
|
|
|
|
2025-05-01 18:27:01 +00:00
|
|
|
|
return (CanMessagePosicaoDados.Config1, config.ToArray());
|
2024-07-18 18:00:14 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
2025-05-01 18:27:01 +00:00
|
|
|
|
public (int, CanMessagePosicaoDados, byte[]) ProtocoloComando()
|
2024-07-18 18:00:14 +00:00
|
|
|
|
{
|
2025-04-09 21:11:40 +00:00
|
|
|
|
return (
|
2025-05-01 18:27:01 +00:00
|
|
|
|
ID_Num,
|
|
|
|
|
|
CanMessagePosicaoDados.Command1,
|
2025-04-09 21:11:40 +00:00
|
|
|
|
new byte[]
|
|
|
|
|
|
{
|
|
|
|
|
|
(byte)StatusControle
|
|
|
|
|
|
}
|
|
|
|
|
|
);
|
2024-07-24 20:04:55 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
public class SensorServoModel
|
|
|
|
|
|
{
|
|
|
|
|
|
public string ID { get; set; }
|
2025-04-09 21:11:40 +00:00
|
|
|
|
public int ID_Num { get; set; }
|
2024-07-24 20:04:55 +00:00
|
|
|
|
public string Descricao { get; set; }
|
|
|
|
|
|
public S_Code Componente { get; set; }
|
|
|
|
|
|
public List<FuncoesPinout> Funcoes { get; set; }
|
2025-04-15 19:30:39 +00:00
|
|
|
|
public bool Incremental { get; set; }
|
2024-07-24 20:04:55 +00:00
|
|
|
|
|
|
|
|
|
|
public bool Controlar { get; set; }
|
2025-05-07 16:54:45 +00:00
|
|
|
|
public bool Mandatorio { get; set; }
|
|
|
|
|
|
public bool Liberado
|
|
|
|
|
|
{
|
|
|
|
|
|
get
|
|
|
|
|
|
{
|
|
|
|
|
|
return !Mandatorio || (Controlar && Inicializado);
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
2024-07-24 20:04:55 +00:00
|
|
|
|
public int _AnguloControle { get; set; }
|
2025-12-18 18:11:30 +00:00
|
|
|
|
public int _AnguloLeiutra => (int)(ValoresLeituras?.FirstOrDefault(x => x.funcao == FuncoesPinout.ServoAnguloLeitura)?.atual?.valor ?? -1);
|
2025-05-30 20:11:31 +00:00
|
|
|
|
public bool Inicializado { get; set; }
|
|
|
|
|
|
public DateTime UltimaLeitura
|
2024-12-03 20:55:25 +00:00
|
|
|
|
{
|
|
|
|
|
|
get
|
|
|
|
|
|
{
|
2025-05-30 20:11:31 +00:00
|
|
|
|
return ValoresLeituras.OrderByDescending(x => x.atual.lidoEm).FirstOrDefault()?.atual?.lidoEm ?? DateTime.MinValue;
|
2024-12-03 20:55:25 +00:00
|
|
|
|
}
|
|
|
|
|
|
}
|
2025-12-15 13:41:05 +00:00
|
|
|
|
public List<SensorValoresLeituraModel> ValoresLeituras { get; set; }
|
2024-07-24 20:04:55 +00:00
|
|
|
|
|
2025-05-01 18:27:01 +00:00
|
|
|
|
public (CanMessagePosicaoDados, byte[]) ProtocoloConfiguracao(PinoutDataModel pinout, bool conectar)
|
2024-07-24 20:04:55 +00:00
|
|
|
|
{
|
2025-04-09 21:11:40 +00:00
|
|
|
|
var pino = pinout.Pinos.FirstOrDefault(p => p.ComponenteID == ID);
|
2024-11-25 12:14:59 +00:00
|
|
|
|
|
2025-04-09 21:11:40 +00:00
|
|
|
|
List<byte> config = new List<byte>
|
|
|
|
|
|
{
|
2025-04-11 20:13:15 +00:00
|
|
|
|
(byte)Componente,
|
2025-04-09 21:11:40 +00:00
|
|
|
|
(byte)(conectar ? 1 : 0),
|
2025-04-15 19:30:39 +00:00
|
|
|
|
(byte)(Incremental ? 1 : 0),
|
2025-04-09 21:11:40 +00:00
|
|
|
|
(byte)(pino?.Barramento ?? TiposBarramentos.CONTROLADOR),
|
|
|
|
|
|
(byte)(pino?.Pino ?? PinoutUtils.PINO_INVALIDO)
|
|
|
|
|
|
};
|
|
|
|
|
|
|
2025-05-01 18:27:01 +00:00
|
|
|
|
return (CanMessagePosicaoDados.Config1, config.ToArray());
|
2024-07-24 20:04:55 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
2025-05-01 18:27:01 +00:00
|
|
|
|
public (int, CanMessagePosicaoDados, byte[]) ProtocoloComando()
|
2024-07-24 20:04:55 +00:00
|
|
|
|
{
|
2025-04-09 21:11:40 +00:00
|
|
|
|
return (
|
2025-05-01 18:27:01 +00:00
|
|
|
|
ID_Num,
|
|
|
|
|
|
CanMessagePosicaoDados.Command1,
|
2025-04-09 21:11:40 +00:00
|
|
|
|
new byte[]
|
|
|
|
|
|
{
|
|
|
|
|
|
(byte)_AnguloControle
|
|
|
|
|
|
}
|
|
|
|
|
|
);
|
2024-07-18 18:00:14 +00:00
|
|
|
|
}
|
2024-04-02 18:33:15 +00:00
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2024-07-18 18:00:14 +00:00
|
|
|
|
|
2024-04-02 18:33:15 +00:00
|
|
|
|
public class SensorSinaleiroComportamentoModel
|
|
|
|
|
|
{
|
2025-12-18 18:11:30 +00:00
|
|
|
|
public int id { get; set; }
|
|
|
|
|
|
public StatusOperacao? statusOperacao { get; set; }
|
2024-04-02 18:33:15 +00:00
|
|
|
|
public StatusLED statusLED { get; set; }
|
|
|
|
|
|
public int QtdPiscadas { get; set; } = 0;
|
|
|
|
|
|
public int TempoMs { get; set; } = 0;
|
|
|
|
|
|
public int PausaMs { get; set; } = 0;
|
2024-07-18 18:00:14 +00:00
|
|
|
|
|
|
|
|
|
|
public override bool Equals(object obj)
|
|
|
|
|
|
{
|
|
|
|
|
|
if (obj == null || GetType() != obj.GetType())
|
|
|
|
|
|
{
|
|
|
|
|
|
return false;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
SensorSinaleiroComportamentoModel other = (SensorSinaleiroComportamentoModel)obj;
|
|
|
|
|
|
return statusLED == other.statusLED &&
|
|
|
|
|
|
QtdPiscadas == other.QtdPiscadas &&
|
|
|
|
|
|
TempoMs == other.TempoMs &&
|
2025-12-18 18:11:30 +00:00
|
|
|
|
PausaMs == other.PausaMs &&
|
|
|
|
|
|
statusOperacao == other.statusOperacao &&
|
|
|
|
|
|
id == other.id;
|
2024-07-18 18:00:14 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
public override int GetHashCode()
|
|
|
|
|
|
{
|
|
|
|
|
|
unchecked // Permite overflow de inteiros
|
|
|
|
|
|
{
|
|
|
|
|
|
int hash = 17;
|
|
|
|
|
|
hash = hash * 23 + statusLED.GetHashCode();
|
|
|
|
|
|
hash = hash * 23 + QtdPiscadas.GetHashCode();
|
|
|
|
|
|
hash = hash * 23 + TempoMs.GetHashCode();
|
|
|
|
|
|
hash = hash * 23 + PausaMs.GetHashCode();
|
|
|
|
|
|
return hash;
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
public static bool operator ==(SensorSinaleiroComportamentoModel left, SensorSinaleiroComportamentoModel right)
|
|
|
|
|
|
{
|
|
|
|
|
|
if (ReferenceEquals(left, right))
|
|
|
|
|
|
{
|
|
|
|
|
|
return true;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
if ((object)left == null || (object)right == null)
|
|
|
|
|
|
{
|
|
|
|
|
|
return false;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
return left.Equals(right);
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
public static bool operator !=(SensorSinaleiroComportamentoModel left, SensorSinaleiroComportamentoModel right)
|
|
|
|
|
|
{
|
|
|
|
|
|
return !(left == right);
|
|
|
|
|
|
}
|
2024-04-02 18:33:15 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
2025-04-09 21:11:40 +00:00
|
|
|
|
public class SensorParametroModel
|
|
|
|
|
|
{
|
|
|
|
|
|
public string Descricao { get; set; }
|
|
|
|
|
|
public string Valor { get; set; }
|
|
|
|
|
|
public int QtdBytes { get; set; }
|
|
|
|
|
|
public bool Escalar { get; set; }
|
|
|
|
|
|
public bool Enviar { get; set; }
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public byte[] InterpretarParametro()
|
|
|
|
|
|
{
|
2025-04-24 21:11:33 +00:00
|
|
|
|
string valor = Valor.Replace(",", ".").Trim();
|
2025-04-09 21:11:40 +00:00
|
|
|
|
|
|
|
|
|
|
// HEX direto
|
|
|
|
|
|
if (valor.StartsWith("0x", StringComparison.OrdinalIgnoreCase))
|
|
|
|
|
|
{
|
|
|
|
|
|
byte parsedHex = Convert.ToByte(valor, 16);
|
|
|
|
|
|
return QtdBytes == 2 ? new byte[] { 0x00, parsedHex } : new byte[] { parsedHex };
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// FLOAT com ou sem ponto
|
|
|
|
|
|
float f = float.Parse(valor, CultureInfo.InvariantCulture);
|
2025-08-22 18:36:19 +00:00
|
|
|
|
short final = (short)(Escalar ? f * 100 : f);
|
2025-04-09 21:11:40 +00:00
|
|
|
|
|
|
|
|
|
|
if (QtdBytes == 1)
|
|
|
|
|
|
return new byte[] { (byte)(final & 0xFF) };
|
|
|
|
|
|
|
|
|
|
|
|
return new byte[] {
|
|
|
|
|
|
(byte)(final >> 8),
|
|
|
|
|
|
(byte)(final & 0xFF)
|
|
|
|
|
|
};
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
2024-11-29 20:28:25 +00:00
|
|
|
|
|
2025-05-30 20:11:31 +00:00
|
|
|
|
public class SensorValoresLeituraModel
|
|
|
|
|
|
{
|
|
|
|
|
|
public FuncoesPinout funcao { get; set; }
|
|
|
|
|
|
public CanMessagePosicaoDados posicao { get; set; }
|
|
|
|
|
|
public int indice { get; set; }
|
|
|
|
|
|
public double minimo { get; set; }
|
|
|
|
|
|
public double maximo { get; set; }
|
|
|
|
|
|
public double nominal { get; set; }
|
|
|
|
|
|
public double offset { get; set; } = 0.0;
|
|
|
|
|
|
public CanCommandFreqModel<dynamic> atual { get; set; } = new CanCommandFreqModel<dynamic>();
|
|
|
|
|
|
public bool analise_health { get; set; } = false;
|
|
|
|
|
|
public string unidade_medida { get; set; }
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2025-05-15 20:20:46 +00:00
|
|
|
|
public class SensoriamentoMensagemJsonModel
|
|
|
|
|
|
{
|
|
|
|
|
|
public DateTime Momento { get; set; }
|
|
|
|
|
|
public bool Conectado { get; set; }
|
|
|
|
|
|
public T_Code Dispositivo { get; set; }
|
|
|
|
|
|
public int Versao { get; set; }
|
|
|
|
|
|
public string Mod_ID { get; set; }
|
|
|
|
|
|
public int QualidadeWifi { get; set; }
|
|
|
|
|
|
public int LatenciaLoop { get; set; }
|
2025-05-30 20:11:31 +00:00
|
|
|
|
public DateTime UltimoComandoRespondido { get; set; } = DateTime.MinValue;
|
|
|
|
|
|
public List<SensorModel> Sensores { get; set; }
|
|
|
|
|
|
public List<SensorSinaleiroModel> Sinaleiros { get; set; }
|
|
|
|
|
|
public List<SensorReleModel> Reles { get; set; }
|
|
|
|
|
|
public List<SensorServoModel> Servos { get; set; }
|
2025-05-15 20:20:46 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
public class SenHandler : ICanMessageHandler
|
|
|
|
|
|
{
|
|
|
|
|
|
public T_Code Dispositivo { get; set; } = Variaveis.OperacaoEmAndamento.DispSen?.Dados?.Dispositivo ?? T_Code.Sen;
|
|
|
|
|
|
|
|
|
|
|
|
private double ConverterByteParaDouble(byte[] data, int idx)
|
|
|
|
|
|
{
|
|
|
|
|
|
int raw = (data[idx] << 8) | data[idx + 1];
|
|
|
|
|
|
short _short = (short)raw;
|
|
|
|
|
|
double _value = _short / 100.0;
|
|
|
|
|
|
|
|
|
|
|
|
return _value;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
private double ConverterBytesParaDouble32(byte[] data, int idx)
|
|
|
|
|
|
{
|
|
|
|
|
|
int valor = (data[idx] << 24) | (data[idx + 1] << 16) | (data[idx + 2] << 8) | data[idx + 3];
|
|
|
|
|
|
return valor / 100.0;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
private double ConverterValorEscala(byte[] data, int idx, double escala)
|
|
|
|
|
|
{
|
|
|
|
|
|
int raw = (data[idx] << 8) | data[idx + 1];
|
|
|
|
|
|
return raw * escala;
|
2025-04-15 18:18:04 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
2025-12-04 13:51:11 +00:00
|
|
|
|
private ushort Converter2BytesU16(byte[] data, int idx)
|
|
|
|
|
|
{
|
|
|
|
|
|
return (ushort)((data[idx] << 8) | data[idx + 1]);
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
private double ConverterAngle100(byte[] data, int idx)
|
|
|
|
|
|
{
|
|
|
|
|
|
ushort v = (ushort)((data[idx] << 8) | data[idx + 1]);
|
|
|
|
|
|
return v / 100.0;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2025-04-11 20:13:15 +00:00
|
|
|
|
private S_Code DetectarComponenteDoID_Num(int ID_Num)
|
|
|
|
|
|
{
|
|
|
|
|
|
if (ID_Num == Variaveis.ID_Num_sMOD) return S_Code.sMOD;
|
2025-05-01 18:27:01 +00:00
|
|
|
|
if (ID_Num == Variaveis.ID_Num_sTOD) return S_Code.sTOD;
|
2025-04-30 21:49:17 +00:00
|
|
|
|
if (ID_Num == Variaveis.ID_Num_sLRA) return S_Code.sLRA;
|
2025-04-11 20:13:15 +00:00
|
|
|
|
|
|
|
|
|
|
var Disp = Variaveis.OperacaoEmAndamento.DispSen.Dados;
|
|
|
|
|
|
var sensor = Disp.Sensores.FirstOrDefault(x => x.ID_Num == ID_Num);
|
|
|
|
|
|
var rele = Disp.Reles.FirstOrDefault(x => x.ID_Num == ID_Num);
|
|
|
|
|
|
var sinaleiro = Disp.Sinaleiros.FirstOrDefault(x => x.ID_Num == ID_Num);
|
|
|
|
|
|
var servo = Disp.Servos.FirstOrDefault(x => x.ID_Num == ID_Num);
|
|
|
|
|
|
|
|
|
|
|
|
return sensor?.Componente ?? rele?.Componente ?? sinaleiro?.Componente ?? servo?.Componente ?? S_Code.sVZO;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2025-05-30 20:11:31 +00:00
|
|
|
|
private void AtualizarDados(int CompID_Num, CanMessagePosicaoDados Posicao, S_Code componente, List<dynamic> Parametros)
|
2025-04-11 20:13:15 +00:00
|
|
|
|
{
|
2025-05-30 20:11:31 +00:00
|
|
|
|
var Dados = Variaveis.OperacaoEmAndamento.DispSen.Dados;
|
2025-04-11 20:13:15 +00:00
|
|
|
|
|
2025-05-30 20:11:31 +00:00
|
|
|
|
var sensor = Dados.Sensores.FirstOrDefault(x => x.ID_Num == CompID_Num);
|
|
|
|
|
|
var rele = Dados.Reles.FirstOrDefault(x => x.ID_Num == CompID_Num);
|
|
|
|
|
|
var sinaleiro = Dados.Sinaleiros.FirstOrDefault(x => x.ID_Num == CompID_Num);
|
|
|
|
|
|
var servo = Dados.Servos.FirstOrDefault(x => x.ID_Num == CompID_Num);
|
|
|
|
|
|
|
|
|
|
|
|
List<SensorValoresLeituraModel> valoresLeituras = new List<SensorValoresLeituraModel>();
|
2025-04-14 16:37:53 +00:00
|
|
|
|
|
2025-05-30 20:11:31 +00:00
|
|
|
|
if (sensor != null) valoresLeituras = sensor.ValoresLeituras;
|
|
|
|
|
|
else if (rele != null) valoresLeituras = rele.ValoresLeituras;
|
|
|
|
|
|
else if (sinaleiro != null) valoresLeituras = sinaleiro.ValoresLeituras;
|
|
|
|
|
|
else if (servo != null) valoresLeituras = servo.ValoresLeituras;
|
2025-05-15 20:20:46 +00:00
|
|
|
|
|
2025-05-30 20:11:31 +00:00
|
|
|
|
for (int i = 0; i < valoresLeituras.Where(x => x.posicao == Posicao).Count(); i++)
|
|
|
|
|
|
{
|
2025-06-20 20:10:08 +00:00
|
|
|
|
try
|
|
|
|
|
|
{
|
|
|
|
|
|
var valor = valoresLeituras.FirstOrDefault(x => x.posicao == Posicao && x.indice == i);
|
|
|
|
|
|
if (valor != null)
|
|
|
|
|
|
{
|
|
|
|
|
|
var v = Parametros.Count > i ? (Parametros[i]) : -1;
|
|
|
|
|
|
if (v is sbyte || v is byte || v is short || v is ushort || v is int || v is uint || v is long || v is ulong || v is float || v is double || v is decimal)
|
|
|
|
|
|
{
|
|
|
|
|
|
v += valor.offset;
|
|
|
|
|
|
valor.atual.valor = v;
|
|
|
|
|
|
}
|
|
|
|
|
|
else
|
|
|
|
|
|
{
|
|
|
|
|
|
valor.atual.valor = v;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
if (Posicao == CanMessagePosicaoDados.Status)
|
|
|
|
|
|
{
|
|
|
|
|
|
if (sensor != null)
|
|
|
|
|
|
sensor.Inicializado = v;
|
|
|
|
|
|
if (rele != null)
|
|
|
|
|
|
rele.Inicializado = v;
|
|
|
|
|
|
if (sinaleiro != null)
|
|
|
|
|
|
sinaleiro.Inicializado = v;
|
|
|
|
|
|
if (servo != null)
|
|
|
|
|
|
servo.Inicializado = v;
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
catch (Exception ex)
|
2025-05-30 20:11:31 +00:00
|
|
|
|
{
|
2025-06-20 20:10:08 +00:00
|
|
|
|
|
2025-05-30 20:11:31 +00:00
|
|
|
|
}
|
2025-04-11 20:13:15 +00:00
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2025-04-09 21:11:40 +00:00
|
|
|
|
public void ProcessarMensagem(CanMessage mensagem)
|
|
|
|
|
|
{
|
2025-05-01 18:27:01 +00:00
|
|
|
|
CanMessagePosicaoDados posicao = (CanMessagePosicaoDados)mensagem.DataRx[0];
|
|
|
|
|
|
byte ID_Num = mensagem.DataRx[1];
|
2025-04-09 21:11:40 +00:00
|
|
|
|
var data = mensagem.DataRx;
|
|
|
|
|
|
|
2025-04-11 20:13:15 +00:00
|
|
|
|
S_Code componente = DetectarComponenteDoID_Num(ID_Num);
|
|
|
|
|
|
|
2025-05-30 20:11:31 +00:00
|
|
|
|
var Dados = Variaveis.OperacaoEmAndamento.DispSen.Dados;
|
|
|
|
|
|
|
2025-07-17 17:53:42 +00:00
|
|
|
|
//Console.WriteLine($"[SEN] Componente={componente.ToString()}, ID_Num={ID_Num}, Posicao={posicao.ToString()}, Data={FuncoesGlobais.ConverterComandoBytesParaTexto(data)}");
|
2025-04-11 20:13:15 +00:00
|
|
|
|
|
2025-05-09 20:17:28 +00:00
|
|
|
|
switch (componente)
|
2025-04-09 21:11:40 +00:00
|
|
|
|
{
|
2025-05-09 20:17:28 +00:00
|
|
|
|
case S_Code.sMOD:
|
2025-04-09 21:11:40 +00:00
|
|
|
|
{
|
2025-05-09 20:17:28 +00:00
|
|
|
|
switch (posicao)
|
2025-04-11 20:13:15 +00:00
|
|
|
|
{
|
2025-05-09 20:17:28 +00:00
|
|
|
|
case CanMessagePosicaoDados.Status:
|
2025-04-30 21:49:17 +00:00
|
|
|
|
{
|
|
|
|
|
|
T_Code tipoModulo = (T_Code)data[2];
|
|
|
|
|
|
bool conectado = data[3] == 1;
|
|
|
|
|
|
int versao = data[4];
|
2025-04-09 21:11:40 +00:00
|
|
|
|
|
2025-07-17 17:53:42 +00:00
|
|
|
|
//Console.WriteLine($"[SEN] Resposta {ID_Num} recebida. Tipo={tipoModulo}, Conectado={conectado}, Versão={versao}");
|
2025-04-09 21:11:40 +00:00
|
|
|
|
|
2025-05-30 20:11:31 +00:00
|
|
|
|
Dados.DadosLeitura.Conectado = conectado;
|
|
|
|
|
|
Dados.DadosLeitura.Dispositivo = tipoModulo;
|
|
|
|
|
|
Dados.DadosLeitura.Versao = versao;
|
2025-04-30 21:49:17 +00:00
|
|
|
|
break;
|
|
|
|
|
|
}
|
2025-05-09 20:17:28 +00:00
|
|
|
|
}
|
|
|
|
|
|
break;
|
|
|
|
|
|
}
|
|
|
|
|
|
case S_Code.sLRA:
|
|
|
|
|
|
{
|
2025-05-30 20:11:31 +00:00
|
|
|
|
var loraService = Dados.loRaService;
|
2025-05-09 20:17:28 +00:00
|
|
|
|
switch (posicao)
|
|
|
|
|
|
{
|
|
|
|
|
|
case CanMessagePosicaoDados.Status:
|
2025-04-30 21:49:17 +00:00
|
|
|
|
{
|
|
|
|
|
|
bool Conectado = data[2] == 1;
|
|
|
|
|
|
bool Configurado = data[3] == 1;
|
2025-12-08 17:32:23 +00:00
|
|
|
|
//Console.WriteLine($"[LRA] Resposta {ID_Num} recebida. Conectado={Conectado}, Configurado={Configurado}");
|
2025-04-30 21:49:17 +00:00
|
|
|
|
loraService.Conectado = Conectado;
|
|
|
|
|
|
loraService.Configurado = Configurado;
|
|
|
|
|
|
break;
|
|
|
|
|
|
}
|
2025-05-09 20:17:28 +00:00
|
|
|
|
case CanMessagePosicaoDados.Dados1:
|
2025-04-30 21:49:17 +00:00
|
|
|
|
{
|
|
|
|
|
|
byte address = data[2];
|
|
|
|
|
|
byte baudAndAirRate = data[3];
|
|
|
|
|
|
byte baud = (byte)(baudAndAirRate & 0b11100000);
|
|
|
|
|
|
byte airRate = (byte)((baudAndAirRate & 0b00011100) >> 2);
|
|
|
|
|
|
byte packetSizeAndPower = data[4];
|
|
|
|
|
|
byte packetSize = (byte)((packetSizeAndPower & 0b11000000));
|
|
|
|
|
|
byte power = (byte)(packetSizeAndPower & 0b00000011);
|
|
|
|
|
|
byte channel = data[5];
|
|
|
|
|
|
byte tranModeAndWorCycle = data[6];
|
|
|
|
|
|
byte tranMode = (byte)(tranModeAndWorCycle & 0b01000000);
|
|
|
|
|
|
byte worCycle = (byte)(tranModeAndWorCycle & 0b00000111);
|
2025-12-08 17:32:23 +00:00
|
|
|
|
//Console.WriteLine($"[LRA] Resposta {ID_Num} recebida. Address={address.ToString("X")}, BaudRate={baud.ToString("X")}, AirRate={airRate.ToString("X")}, PacketSize={packetSize.ToString("X")}, Power={power.ToString("X")}, Channel={channel.ToString("X")}, transMode={tranMode.ToString("X")}, WorCycle={worCycle.ToString("X")}");
|
2025-05-19 10:35:58 +00:00
|
|
|
|
loraService.ParametrosGet.address = address;
|
|
|
|
|
|
loraService.ParametrosGet.baudRate = baud;
|
|
|
|
|
|
loraService.ParametrosGet.airRate = airRate;
|
|
|
|
|
|
loraService.ParametrosGet.packetSize = packetSize;
|
|
|
|
|
|
loraService.ParametrosGet.power = power;
|
|
|
|
|
|
loraService.ParametrosGet.channel = channel;
|
|
|
|
|
|
loraService.ParametrosGet.worCycle = worCycle;
|
|
|
|
|
|
loraService.ParametrosGet.tranMode = tranMode;
|
2025-09-15 10:23:07 +00:00
|
|
|
|
loraService.ParametrosGet.UltimaLeitura = DateTime.Now;
|
2025-04-30 21:49:17 +00:00
|
|
|
|
break;
|
|
|
|
|
|
}
|
2025-04-14 16:37:53 +00:00
|
|
|
|
default:
|
|
|
|
|
|
{
|
2025-05-09 20:17:28 +00:00
|
|
|
|
DadosLoRaParse tipoDado = (DadosLoRaParse)posicao;
|
2025-09-22 18:56:35 +00:00
|
|
|
|
//Console.WriteLine($"[LRA] Dados recebidos ({tipoDado.ToString()}). " + string.Join(" ", data));
|
2025-05-09 20:17:28 +00:00
|
|
|
|
switch (tipoDado)
|
|
|
|
|
|
{
|
|
|
|
|
|
case DadosLoRaParse.ComandoControle:
|
|
|
|
|
|
{
|
2025-11-24 16:05:50 +00:00
|
|
|
|
BotoesJoystick tecla = (BotoesJoystick)data[2];
|
2025-05-09 20:17:28 +00:00
|
|
|
|
int percentualVelocidadeSp = data[3];
|
|
|
|
|
|
TipoMovimentoDirecional tipoMovimentoDirecional = (TipoMovimentoDirecional)data[4];
|
|
|
|
|
|
int anguloMp = data[5];
|
|
|
|
|
|
//int velocidadeMp = data[6];
|
|
|
|
|
|
T_Code dispositivo = (T_Code)data[6];
|
|
|
|
|
|
bool emergencia = data[7] == 1;
|
|
|
|
|
|
|
2025-11-24 16:05:50 +00:00
|
|
|
|
OperacaoComandoBaseModel Controle = new OperacaoComandoBaseModel()
|
2025-05-09 20:17:28 +00:00
|
|
|
|
{
|
|
|
|
|
|
Momento = DateTime.Now,
|
|
|
|
|
|
Tecla = tecla,
|
2025-11-24 16:05:50 +00:00
|
|
|
|
Controle = new OperacaoComandoBaseControleModel()
|
|
|
|
|
|
{
|
|
|
|
|
|
AnguloSP = anguloMp,
|
|
|
|
|
|
PercentualVelocidadeSP = percentualVelocidadeSp,
|
|
|
|
|
|
TipoMovimentoDirecional = tipoMovimentoDirecional,
|
|
|
|
|
|
},
|
2025-05-09 20:17:28 +00:00
|
|
|
|
Emergencia = emergencia,
|
|
|
|
|
|
Dispositivo = dispositivo
|
|
|
|
|
|
};
|
|
|
|
|
|
Variaveis.OperacaoEmAndamento.ExecutaComandoDaBase(Controle);
|
|
|
|
|
|
break;
|
|
|
|
|
|
}
|
|
|
|
|
|
case DadosLoRaParse.DadosLivre:
|
|
|
|
|
|
{
|
|
|
|
|
|
Console.WriteLine("[LRA] Dados livres LORA recebidos da base: " + FuncoesGlobais.ConverterComandoBytesParaTexto(data));
|
2025-09-17 18:54:39 +00:00
|
|
|
|
Variaveis.LoraService.MensagensRecebidasAvulsas.Add(new LoRaMensagemModel()
|
|
|
|
|
|
{
|
|
|
|
|
|
Lido = false,
|
|
|
|
|
|
Momento = DateTime.Now,
|
|
|
|
|
|
channel = Variaveis.LoraBaseParametros.channel,
|
|
|
|
|
|
Remetente = Variaveis.LoraBaseParametros.address,
|
|
|
|
|
|
Destinatario = Variaveis.LoraService.ParametrosGet.address,
|
|
|
|
|
|
Data = data,
|
|
|
|
|
|
Mensagem = string.Join("", data.Select(x => x.ToString("X")))
|
|
|
|
|
|
});
|
2025-05-09 20:17:28 +00:00
|
|
|
|
break;
|
|
|
|
|
|
}
|
|
|
|
|
|
case DadosLoRaParse.GpsQualidade:
|
|
|
|
|
|
{
|
|
|
|
|
|
bool iniciado = data[2] == 1;
|
|
|
|
|
|
TiposCorrecaoGPS qualidadeFix = (TiposCorrecaoGPS)data[3];
|
|
|
|
|
|
int numeroSatelites = data[4];
|
|
|
|
|
|
double precisao = LoRaSerializer.DescompactarDecimal(data, 5);
|
|
|
|
|
|
|
|
|
|
|
|
VariaveisOperacao.PosicaoBase.Inicializado = iniciado;
|
|
|
|
|
|
VariaveisOperacao.PosicaoBase.QualidadeFix = qualidadeFix;
|
2025-09-02 13:49:11 +00:00
|
|
|
|
VariaveisOperacao.PosicaoBase.NumeroSatelites = numeroSatelites;
|
2025-05-09 20:17:28 +00:00
|
|
|
|
VariaveisOperacao.PosicaoBase.PrecisaoHorizontal = precisao;
|
|
|
|
|
|
VariaveisOperacao.PosicaoBase.Momento = DateTime.Now;
|
|
|
|
|
|
break;
|
|
|
|
|
|
}
|
|
|
|
|
|
case DadosLoRaParse.GpsLatitude:
|
|
|
|
|
|
{
|
|
|
|
|
|
double _lat = LoRaSerializer.DescompactarCoordenada(data.Skip(2).ToArray());
|
|
|
|
|
|
VariaveisOperacao.PosicaoBase.Latitude = _lat;
|
|
|
|
|
|
VariaveisOperacao.PosicaoBase.Momento = DateTime.Now;
|
|
|
|
|
|
break;
|
|
|
|
|
|
}
|
|
|
|
|
|
case DadosLoRaParse.GpsLongitude:
|
|
|
|
|
|
{
|
|
|
|
|
|
double _long = LoRaSerializer.DescompactarCoordenada(data.Skip(2).ToArray());
|
|
|
|
|
|
VariaveisOperacao.PosicaoBase.Longitude = _long;
|
|
|
|
|
|
VariaveisOperacao.PosicaoBase.Momento = DateTime.Now;
|
|
|
|
|
|
break;
|
|
|
|
|
|
}
|
|
|
|
|
|
case DadosLoRaParse.GpsGerais:
|
|
|
|
|
|
{
|
|
|
|
|
|
double _altitude = LoRaSerializer.DescompactarDecimal(data, 2);
|
|
|
|
|
|
double _velocidade = LoRaSerializer.DescompactarDecimal(data, 4);
|
|
|
|
|
|
double _orientacao = LoRaSerializer.DescompactarDecimal(data, 6);
|
|
|
|
|
|
VariaveisOperacao.PosicaoBase.Altitude = _altitude;
|
|
|
|
|
|
VariaveisOperacao.PosicaoBase.Velocidade = _velocidade;
|
|
|
|
|
|
VariaveisOperacao.PosicaoBase.OrientacaoReal = _orientacao;
|
|
|
|
|
|
VariaveisOperacao.PosicaoBase.Momento = DateTime.Now;
|
|
|
|
|
|
break;
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
2025-09-15 10:23:07 +00:00
|
|
|
|
Variaveis.LoraService.UltimoRxDados = Stopwatch.GetTimestamp() / (double)Stopwatch.Frequency;
|
2025-09-17 18:54:39 +00:00
|
|
|
|
Variaveis.LoraService._ultimoRxDados = DateTime.UtcNow;
|
2025-04-14 16:37:53 +00:00
|
|
|
|
break;
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
break;
|
|
|
|
|
|
}
|
2025-05-09 20:17:28 +00:00
|
|
|
|
case S_Code.sTOD:
|
2025-04-14 16:37:53 +00:00
|
|
|
|
{
|
2025-05-09 20:17:28 +00:00
|
|
|
|
switch (posicao)
|
2025-04-14 16:37:53 +00:00
|
|
|
|
{
|
2025-05-09 20:17:28 +00:00
|
|
|
|
case CanMessagePosicaoDados.DadosAll:
|
2025-04-24 11:49:04 +00:00
|
|
|
|
{
|
2025-05-15 20:20:46 +00:00
|
|
|
|
double latenciaLoop = ConverterByteParaDouble(data, 2) * 100;
|
2025-05-30 20:11:31 +00:00
|
|
|
|
Dados.DadosLeitura.LatenciaLoop = Convert.ToInt32(latenciaLoop);
|
2025-07-17 17:53:42 +00:00
|
|
|
|
//Console.WriteLine($"[SEN] Ciclo concluido. Latencia de loop: {latenciaLoop} ms");
|
2025-04-24 11:49:04 +00:00
|
|
|
|
break;
|
|
|
|
|
|
}
|
2025-05-09 20:17:28 +00:00
|
|
|
|
}
|
|
|
|
|
|
break;
|
|
|
|
|
|
}
|
2025-05-15 20:20:46 +00:00
|
|
|
|
case S_Code.sNTC:
|
2025-05-09 20:17:28 +00:00
|
|
|
|
{
|
|
|
|
|
|
switch (posicao)
|
|
|
|
|
|
{
|
|
|
|
|
|
case CanMessagePosicaoDados.Status:
|
|
|
|
|
|
{
|
|
|
|
|
|
bool Iniciado = data[2] == 1;
|
2025-05-30 20:11:31 +00:00
|
|
|
|
AtualizarDados(ID_Num, posicao, componente, new List<dynamic>() { Iniciado });
|
2025-05-09 20:17:28 +00:00
|
|
|
|
break;
|
|
|
|
|
|
}
|
|
|
|
|
|
case CanMessagePosicaoDados.Dados1:
|
2025-04-14 16:37:53 +00:00
|
|
|
|
{
|
2025-12-16 17:17:26 +00:00
|
|
|
|
ushort raw = Converter2BytesU16(data, 2);
|
|
|
|
|
|
double temperatura = ConverterByteParaDouble(data, 4);
|
|
|
|
|
|
AtualizarDados(ID_Num, posicao, componente, new List<dynamic>() { raw, temperatura });
|
2025-04-14 16:37:53 +00:00
|
|
|
|
break;
|
|
|
|
|
|
}
|
2025-05-09 20:17:28 +00:00
|
|
|
|
}
|
|
|
|
|
|
break;
|
|
|
|
|
|
}
|
|
|
|
|
|
case S_Code.sCOR:
|
|
|
|
|
|
{
|
|
|
|
|
|
switch (posicao)
|
|
|
|
|
|
{
|
|
|
|
|
|
case CanMessagePosicaoDados.Status:
|
2025-04-30 21:49:17 +00:00
|
|
|
|
{
|
2025-05-09 20:17:28 +00:00
|
|
|
|
bool Iniciado = data[2] == 1;
|
2025-05-30 20:11:31 +00:00
|
|
|
|
AtualizarDados(ID_Num, posicao, componente, new List<dynamic>() { Iniciado });
|
2025-04-30 21:49:17 +00:00
|
|
|
|
break;
|
|
|
|
|
|
}
|
2025-05-09 20:17:28 +00:00
|
|
|
|
case CanMessagePosicaoDados.Dados1:
|
2025-04-14 16:37:53 +00:00
|
|
|
|
{
|
2025-05-09 20:17:28 +00:00
|
|
|
|
double busVoltage = ConverterByteParaDouble(data, 2); // continua igual
|
|
|
|
|
|
double current = ConverterByteParaDouble(data, 4) * 1000.0; // volts / 100, amps * 10 (volta para mA)
|
|
|
|
|
|
double power = ConverterByteParaDouble(data, 6) * 1000.0; // volta para mW
|
2025-06-20 20:10:08 +00:00
|
|
|
|
//Console.WriteLine($"[AB36V] Tensao {busVoltage}, Corrente: {current}, Power: {power}");
|
2025-05-30 20:11:31 +00:00
|
|
|
|
AtualizarDados(ID_Num, posicao, componente, new List<dynamic>() { busVoltage, current, power });
|
2025-05-09 20:17:28 +00:00
|
|
|
|
break;
|
|
|
|
|
|
}
|
|
|
|
|
|
case CanMessagePosicaoDados.Dados2:
|
|
|
|
|
|
{
|
|
|
|
|
|
double energia = ConverterByteParaDouble(data, 2) * 1000.0; // volta para mWh
|
|
|
|
|
|
double temperatura = ConverterByteParaDouble(data, 4); // volta para °C
|
2025-06-20 20:10:08 +00:00
|
|
|
|
double codAlarme = ConverterByteParaDouble(data, 6) * 100; // volta para °C
|
|
|
|
|
|
AtualizarDados(ID_Num, posicao, componente, new List<dynamic>() { energia, temperatura, codAlarme });
|
2025-04-14 16:37:53 +00:00
|
|
|
|
break;
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
break;
|
|
|
|
|
|
}
|
2025-05-09 20:17:28 +00:00
|
|
|
|
case S_Code.sLED:
|
2025-04-14 16:37:53 +00:00
|
|
|
|
{
|
2025-05-09 20:17:28 +00:00
|
|
|
|
switch (posicao)
|
2025-04-14 16:37:53 +00:00
|
|
|
|
{
|
2025-05-09 20:17:28 +00:00
|
|
|
|
case CanMessagePosicaoDados.Status:
|
2025-04-14 16:37:53 +00:00
|
|
|
|
{
|
2025-05-09 20:17:28 +00:00
|
|
|
|
bool Iniciado = data[2] == 1;
|
2025-05-30 20:11:31 +00:00
|
|
|
|
AtualizarDados(ID_Num, posicao, componente, new List<dynamic>() { Iniciado });
|
2025-04-14 16:37:53 +00:00
|
|
|
|
break;
|
|
|
|
|
|
}
|
2025-05-09 20:17:28 +00:00
|
|
|
|
case CanMessagePosicaoDados.Dados1:
|
2025-04-14 16:37:53 +00:00
|
|
|
|
{
|
2025-12-18 18:11:30 +00:00
|
|
|
|
int statusId = data[2];
|
|
|
|
|
|
StatusLED statusLeitura = (StatusLED)data[3];
|
|
|
|
|
|
AtualizarDados(ID_Num, posicao, componente, new List<dynamic>() { statusId, statusLeitura });
|
2025-04-14 16:37:53 +00:00
|
|
|
|
break;
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
break;
|
|
|
|
|
|
}
|
2025-05-09 20:17:28 +00:00
|
|
|
|
case S_Code.sRLE:
|
2025-04-14 16:37:53 +00:00
|
|
|
|
{
|
2025-05-09 20:17:28 +00:00
|
|
|
|
switch (posicao)
|
2025-04-14 16:37:53 +00:00
|
|
|
|
{
|
2025-05-09 20:17:28 +00:00
|
|
|
|
case CanMessagePosicaoDados.Status:
|
2025-04-14 16:37:53 +00:00
|
|
|
|
{
|
2025-05-09 20:17:28 +00:00
|
|
|
|
bool Iniciado = data[2] == 1;
|
2025-05-30 20:11:31 +00:00
|
|
|
|
AtualizarDados(ID_Num, posicao, componente, new List<dynamic>() { Iniciado });
|
2025-04-14 16:37:53 +00:00
|
|
|
|
break;
|
|
|
|
|
|
}
|
2025-05-09 20:17:28 +00:00
|
|
|
|
case CanMessagePosicaoDados.Dados1:
|
2025-04-14 16:37:53 +00:00
|
|
|
|
{
|
2025-05-09 20:17:28 +00:00
|
|
|
|
Estado estado = (Estado)data[2];
|
2025-05-30 20:11:31 +00:00
|
|
|
|
AtualizarDados(ID_Num, posicao, componente, new List<dynamic>() { estado });
|
2025-05-09 20:17:28 +00:00
|
|
|
|
break;
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
break;
|
|
|
|
|
|
}
|
2025-12-16 17:17:26 +00:00
|
|
|
|
case S_Code.sSRV:
|
2025-05-09 20:17:28 +00:00
|
|
|
|
{
|
|
|
|
|
|
switch (posicao)
|
|
|
|
|
|
{
|
|
|
|
|
|
case CanMessagePosicaoDados.Status:
|
|
|
|
|
|
{
|
|
|
|
|
|
bool Iniciado = data[2] == 1;
|
2025-05-30 20:11:31 +00:00
|
|
|
|
AtualizarDados(ID_Num, posicao, componente, new List<dynamic>() { Iniciado });
|
2025-05-09 20:17:28 +00:00
|
|
|
|
break;
|
|
|
|
|
|
}
|
|
|
|
|
|
case CanMessagePosicaoDados.Dados1:
|
|
|
|
|
|
{
|
|
|
|
|
|
int angulo = data[2];
|
2025-05-30 20:11:31 +00:00
|
|
|
|
AtualizarDados(ID_Num, posicao, componente, new List<dynamic>() { angulo });
|
2025-04-14 16:37:53 +00:00
|
|
|
|
break;
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
break;
|
|
|
|
|
|
}
|
2025-05-09 20:17:28 +00:00
|
|
|
|
case S_Code.sIMU:
|
2025-04-14 16:37:53 +00:00
|
|
|
|
{
|
2025-05-09 20:17:28 +00:00
|
|
|
|
switch (posicao)
|
2025-04-14 16:37:53 +00:00
|
|
|
|
{
|
2025-05-09 20:17:28 +00:00
|
|
|
|
case CanMessagePosicaoDados.Status:
|
|
|
|
|
|
{
|
|
|
|
|
|
bool Iniciado = data[2] == 1;
|
2025-05-30 20:11:31 +00:00
|
|
|
|
AtualizarDados(ID_Num, posicao, componente, new List<dynamic>() { Iniciado });
|
2025-05-09 20:17:28 +00:00
|
|
|
|
break;
|
|
|
|
|
|
}
|
|
|
|
|
|
case CanMessagePosicaoDados.Dados1:
|
|
|
|
|
|
{
|
|
|
|
|
|
double roll = ConverterByteParaDouble(data, 2);
|
|
|
|
|
|
double pitch = ConverterByteParaDouble(data, 4);
|
|
|
|
|
|
double yaw = ConverterByteParaDouble(data, 6);
|
2025-05-30 20:11:31 +00:00
|
|
|
|
AtualizarDados(ID_Num, posicao, componente, new List<dynamic>() { roll, pitch, yaw });
|
2025-05-09 20:17:28 +00:00
|
|
|
|
break;
|
|
|
|
|
|
}
|
|
|
|
|
|
case CanMessagePosicaoDados.Dados2:
|
|
|
|
|
|
{
|
|
|
|
|
|
double temperatura = ConverterByteParaDouble(data, 2);
|
|
|
|
|
|
double pressao = ConverterValorEscala(data, 4, 10);
|
|
|
|
|
|
double altitude = ConverterValorEscala(data, 6, 10);
|
2025-05-30 20:11:31 +00:00
|
|
|
|
AtualizarDados(ID_Num, posicao, componente, new List<dynamic>() { temperatura, pressao, altitude });
|
2025-05-09 20:17:28 +00:00
|
|
|
|
break;
|
|
|
|
|
|
}
|
|
|
|
|
|
case CanMessagePosicaoDados.Dados3:
|
|
|
|
|
|
{
|
|
|
|
|
|
double accX = ConverterByteParaDouble(data, 2);
|
|
|
|
|
|
double accY = ConverterByteParaDouble(data, 4);
|
|
|
|
|
|
double accZ = ConverterByteParaDouble(data, 6);
|
2025-05-30 20:11:31 +00:00
|
|
|
|
AtualizarDados(ID_Num, posicao, componente, new List<dynamic>() { accX, accY, accZ });
|
2025-05-09 20:17:28 +00:00
|
|
|
|
break;
|
|
|
|
|
|
}
|
|
|
|
|
|
case CanMessagePosicaoDados.Dados4:
|
|
|
|
|
|
{
|
|
|
|
|
|
double gyrX = ConverterByteParaDouble(data, 2);
|
|
|
|
|
|
double gyrY = ConverterByteParaDouble(data, 4);
|
|
|
|
|
|
double gyrZ = ConverterByteParaDouble(data, 6);
|
2025-05-30 20:11:31 +00:00
|
|
|
|
AtualizarDados(ID_Num, posicao, componente, new List<dynamic>() { gyrX, gyrY, gyrZ });
|
2025-05-09 20:17:28 +00:00
|
|
|
|
break;
|
|
|
|
|
|
}
|
|
|
|
|
|
case CanMessagePosicaoDados.Dados5:
|
2025-04-14 16:37:53 +00:00
|
|
|
|
{
|
|
|
|
|
|
double magX = ConverterByteParaDouble(data, 2);
|
|
|
|
|
|
double magY = ConverterByteParaDouble(data, 4);
|
|
|
|
|
|
double magZ = ConverterByteParaDouble(data, 6);
|
2025-05-30 20:11:31 +00:00
|
|
|
|
AtualizarDados(ID_Num, posicao, componente, new List<dynamic>() { magX, magY, magZ });
|
2025-04-09 21:11:40 +00:00
|
|
|
|
break;
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
break;
|
|
|
|
|
|
}
|
2025-05-15 20:20:46 +00:00
|
|
|
|
case S_Code.sGAS:
|
|
|
|
|
|
{
|
|
|
|
|
|
switch (posicao)
|
|
|
|
|
|
{
|
|
|
|
|
|
case CanMessagePosicaoDados.Status:
|
|
|
|
|
|
{
|
|
|
|
|
|
bool Iniciado = data[2] == 1;
|
2025-05-30 20:11:31 +00:00
|
|
|
|
AtualizarDados(ID_Num, posicao, componente, new List<dynamic>() { Iniciado });
|
2025-05-15 20:20:46 +00:00
|
|
|
|
break;
|
|
|
|
|
|
}
|
|
|
|
|
|
case CanMessagePosicaoDados.Dados1:
|
|
|
|
|
|
{
|
2025-12-16 17:17:26 +00:00
|
|
|
|
ushort raw = Converter2BytesU16(data, 2);
|
|
|
|
|
|
double ppm = ConverterBytesParaDouble32(data, 4);
|
|
|
|
|
|
AtualizarDados(ID_Num, posicao, componente, new List<dynamic>() { raw, ppm });
|
2025-05-15 20:20:46 +00:00
|
|
|
|
break;
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
break;
|
|
|
|
|
|
}
|
|
|
|
|
|
case S_Code.sSHT:
|
|
|
|
|
|
{
|
|
|
|
|
|
switch (posicao)
|
|
|
|
|
|
{
|
|
|
|
|
|
case CanMessagePosicaoDados.Status:
|
|
|
|
|
|
{
|
|
|
|
|
|
bool Iniciado = data[2] == 1;
|
2025-05-30 20:11:31 +00:00
|
|
|
|
AtualizarDados(ID_Num, posicao, componente, new List<dynamic>() { Iniciado });
|
2025-05-15 20:20:46 +00:00
|
|
|
|
break;
|
|
|
|
|
|
}
|
|
|
|
|
|
case CanMessagePosicaoDados.Dados1:
|
|
|
|
|
|
{
|
|
|
|
|
|
double temperatura = ConverterByteParaDouble(data, 2);
|
|
|
|
|
|
double umidade = ConverterByteParaDouble(data, 4);
|
2025-05-30 20:11:31 +00:00
|
|
|
|
AtualizarDados(ID_Num, posicao, componente, new List<dynamic>() { temperatura, umidade });
|
2025-05-15 20:20:46 +00:00
|
|
|
|
break;
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
break;
|
|
|
|
|
|
}
|
|
|
|
|
|
case S_Code.sLUZ:
|
|
|
|
|
|
{
|
|
|
|
|
|
switch (posicao)
|
|
|
|
|
|
{
|
|
|
|
|
|
case CanMessagePosicaoDados.Status:
|
|
|
|
|
|
{
|
|
|
|
|
|
bool Iniciado = data[2] == 1;
|
2025-05-30 20:11:31 +00:00
|
|
|
|
AtualizarDados(ID_Num, posicao, componente, new List<dynamic>() { Iniciado });
|
2025-05-15 20:20:46 +00:00
|
|
|
|
break;
|
|
|
|
|
|
}
|
|
|
|
|
|
case CanMessagePosicaoDados.Dados1:
|
|
|
|
|
|
{
|
|
|
|
|
|
double lux = ConverterBytesParaDouble32(data, 2);
|
2025-05-30 20:11:31 +00:00
|
|
|
|
AtualizarDados(ID_Num, posicao, componente, new List<dynamic>() { lux });
|
2025-05-15 20:20:46 +00:00
|
|
|
|
break;
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
break;
|
|
|
|
|
|
}
|
|
|
|
|
|
case S_Code.sIUV:
|
|
|
|
|
|
{
|
|
|
|
|
|
switch (posicao)
|
|
|
|
|
|
{
|
|
|
|
|
|
case CanMessagePosicaoDados.Status:
|
|
|
|
|
|
{
|
|
|
|
|
|
bool Iniciado = data[2] == 1;
|
2025-05-30 20:11:31 +00:00
|
|
|
|
AtualizarDados(ID_Num, posicao, componente, new List<dynamic>() { Iniciado });
|
2025-05-15 20:20:46 +00:00
|
|
|
|
break;
|
|
|
|
|
|
}
|
|
|
|
|
|
case CanMessagePosicaoDados.Dados1:
|
|
|
|
|
|
{
|
2025-12-16 17:17:26 +00:00
|
|
|
|
ushort raw = Converter2BytesU16(data, 2);
|
|
|
|
|
|
double iuv = ConverterByteParaDouble(data, 4);
|
|
|
|
|
|
AtualizarDados(ID_Num, posicao, componente, new List<dynamic>() { raw, iuv });
|
2025-05-15 20:20:46 +00:00
|
|
|
|
break;
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
break;
|
|
|
|
|
|
}
|
|
|
|
|
|
case S_Code.sQAR:
|
|
|
|
|
|
{
|
|
|
|
|
|
switch (posicao)
|
|
|
|
|
|
{
|
|
|
|
|
|
case CanMessagePosicaoDados.Status:
|
|
|
|
|
|
{
|
|
|
|
|
|
bool Iniciado = data[2] == 1;
|
2025-05-30 20:11:31 +00:00
|
|
|
|
AtualizarDados(ID_Num, posicao, componente, new List<dynamic>() { Iniciado });
|
2025-05-15 20:20:46 +00:00
|
|
|
|
break;
|
|
|
|
|
|
}
|
|
|
|
|
|
case CanMessagePosicaoDados.Dados1:
|
|
|
|
|
|
{
|
|
|
|
|
|
double tvoc = ConverterByteParaDouble(data, 2);
|
|
|
|
|
|
double eco2 = ConverterByteParaDouble(data, 4);
|
|
|
|
|
|
int aqi = data[6];
|
2025-05-30 20:11:31 +00:00
|
|
|
|
AtualizarDados(ID_Num, posicao, componente, new List<dynamic>() { tvoc, eco2, aqi });
|
2025-05-15 20:20:46 +00:00
|
|
|
|
break;
|
|
|
|
|
|
}
|
|
|
|
|
|
case CanMessagePosicaoDados.Dados2:
|
|
|
|
|
|
{
|
|
|
|
|
|
double temperatura = ConverterByteParaDouble(data, 2);
|
|
|
|
|
|
double umidade = ConverterByteParaDouble(data, 4);
|
2025-05-30 20:11:31 +00:00
|
|
|
|
AtualizarDados(ID_Num, posicao, componente, new List<dynamic>() { temperatura, umidade });
|
2025-05-15 20:20:46 +00:00
|
|
|
|
break;
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
break;
|
|
|
|
|
|
}
|
|
|
|
|
|
case S_Code.sCHV:
|
|
|
|
|
|
{
|
|
|
|
|
|
switch (posicao)
|
|
|
|
|
|
{
|
|
|
|
|
|
case CanMessagePosicaoDados.Status:
|
|
|
|
|
|
{
|
|
|
|
|
|
bool Iniciado = data[2] == 1;
|
2025-05-30 20:11:31 +00:00
|
|
|
|
AtualizarDados(ID_Num, posicao, componente, new List<dynamic>() { Iniciado });
|
2025-05-15 20:20:46 +00:00
|
|
|
|
break;
|
|
|
|
|
|
}
|
|
|
|
|
|
case CanMessagePosicaoDados.Dados1:
|
|
|
|
|
|
{
|
2025-12-16 17:17:26 +00:00
|
|
|
|
ushort raw = Converter2BytesU16(data, 2);
|
|
|
|
|
|
double percentual = ConverterByteParaDouble(data, 4);
|
|
|
|
|
|
AtualizarDados(ID_Num, posicao, componente, new List<dynamic>() { raw, percentual });
|
2025-05-15 20:20:46 +00:00
|
|
|
|
break;
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
break;
|
|
|
|
|
|
}
|
2025-12-04 13:51:11 +00:00
|
|
|
|
case S_Code.sMAG:
|
|
|
|
|
|
{
|
|
|
|
|
|
switch (posicao)
|
|
|
|
|
|
{
|
|
|
|
|
|
case CanMessagePosicaoDados.Status:
|
|
|
|
|
|
{
|
|
|
|
|
|
bool Iniciado = data[2] == 1;
|
|
|
|
|
|
AtualizarDados(ID_Num, posicao, componente, new List<dynamic>() { Iniciado });
|
|
|
|
|
|
break;
|
|
|
|
|
|
}
|
|
|
|
|
|
case CanMessagePosicaoDados.Dados1:
|
|
|
|
|
|
{
|
|
|
|
|
|
ushort raw = Converter2BytesU16(data, 2);
|
|
|
|
|
|
double angle = ConverterAngle100(data, 4);
|
|
|
|
|
|
AtualizarDados(ID_Num, posicao, componente, new List<dynamic>() { raw, angle });
|
2025-12-05 18:25:29 +00:00
|
|
|
|
//Console.WriteLine($"[sMAG] {ID_Num}, Raw: {raw}, Angulo: {angle}");
|
2025-12-04 13:51:11 +00:00
|
|
|
|
break;
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
break;
|
|
|
|
|
|
}
|
2025-05-15 20:20:46 +00:00
|
|
|
|
|
|
|
|
|
|
|
2025-04-09 21:11:40 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
2025-05-30 20:11:31 +00:00
|
|
|
|
Dados.DadosLeitura.UltimoComandoRespondido = DateTime.Now;
|
2025-12-05 16:42:54 +00:00
|
|
|
|
//Console.WriteLine("Ultimo comando respondido: " + Dados.DadosLeitura.UltimoComandoRespondido.ToString("HH:mm:ss.fff") + ", Conectado: " + Dados.Conectado);
|
2025-12-05 18:25:29 +00:00
|
|
|
|
|
|
|
|
|
|
Variaveis.OperacaoEmAndamento.DispMvd.Dados.AtualizarDadosSensoresExternos(componente, ID_Num);
|
2025-04-09 21:11:40 +00:00
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2023-11-30 00:41:22 +00:00
|
|
|
|
}
|