Open Pepinaco opened 1 year ago
PGN 127505 is for fluid level. 127506 is for DC detailed status and 127507 for charger status.
If you send several fluid levels from single device, you just use different fluid instance value for each sensor and also set fluid type.
You can use TemperatureMonitor as base and modify settings to match fluid level device. Then you write example:
// *****************************************************************************
void SendN2kFluidLevels() {
tN2kMsg N2kMsg;
if ( FluidScheduler.IsTime() ) {
FluidScheduler.UpdateNextTime();
SetN2kFluidLevel(N2kMsg, 0, N2kft_Water, WaterTank1Level/WaterTank1Capacity*100, WaterTank1Capacity);
NMEA2000.SendMsg(N2kMsg);
SetN2kFluidLevel(N2kMsg, 1, N2kft_Water, WaterTank2Level/WaterTank2Capacity*100, WaterTank2Capacity);
NMEA2000.SendMsg(N2kMsg);
SetN2kFluidLevel(N2kMsg, 2, N2kft_Fuel, FuelTank1Level/FuelTank1Capacity*100, FuelTank1Capacity);
NMEA2000.SendMsg(N2kMsg);
}
}
I understood that a combination between instance and the fluidtype would make it different. So, is this correct?:
.... FluidScheduler.UpdateNextTime(); SetN2kFluidLevel(N2kMsg, 0, N2kft_Water, WaterTank1Level/WaterTank1Capacity100, WaterTank1Capacity); NMEA2000.SendMsg(N2kMsg); SetN2kFluidLevel(N2kMsg, 0, N2kft_Fuel, FuelTank1Level/FuelTank1Capacity100, FuelTank1Capacity); NMEA2000.SendMsg(N2kMsg); SetN2kFluidLevel(N2kMsg, 1, N2kft_Water, WaterTank2Level/WaterTank2Capacity*100, WaterTank2Capacity); NMEA2000.SendMsg(N2kMsg); } }
You have to use different instance for each tank.
FluidScheduler.UpdateNextTime();
SetN2kFluidLevel(N2kMsg, 0, N2kft_Water, WaterTank1Level/WaterTank1Capacity*100, WaterTank1Capacity);
NMEA2000.SendMsg(N2kMsg);
SetN2kFluidLevel(N2kMsg, 1, N2kft_Fuel, FuelTank1Level/FuelTank1Capacity*100, FuelTank1Capacity);
NMEA2000.SendMsg(N2kMsg);
SetN2kFluidLevel(N2kMsg, 2, N2kft_Water, WaterTank2Level/WaterTank2Capacity*100, WaterTank2Capacity);
NMEA2000.SendMsg(N2kMsg);
Thank you Timo, It's a real pleasure to have you here. So in the same device, the maximum number of tanks is 16 (0-15) regardless of type of fluid. And another question, Is it possible for two devices to have the same Instance simultaneously on network?
It should be. Devices should handle same instances from different devices. Unfortuntely this does not seem to work with all MFD:s. I had problems with my Garmin GMI 20, which did not handle that. It required each tank having different instance even it game from other device.
I will be testing on a Garmin xs742xs and a lowrance elite 7 ti some setups with multiple devices and Instances. Thanks for the help, I'll report the results.
I have a very basic question, PGN 127505 sends Tank instance. Tank instance values are 0-15 or 0-254? I have this confusion because I think I remember that the maximum values are 16 or maybe I have seen some code that has confused me. If you can clarify it I would appreciate it. Thanks
PGN 127505 tank instance can be 0-15 not 16. It has only 4 bit for instance. Do not mix to e.g., temperature instances, which has 8 bit value 0-252. There is reservation for one reserved, error and NA.
I meant that the maximum number of values is 16 : from 0 to 15 (4 bits = 1nibble= 2 exp4 = 16 different values. Thanks
Hello Timo, I want to use several fluid sensors with one ESP32. Is it possible to send data from the sensor to different PGN? for example 12505,12506,12507. In which file I have to do the modification. Thank you in advance.