Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

130576 Small Craft Status (Trimtab) #130

Closed
burckiratli opened this issue Dec 16, 2018 · 5 comments
Closed

130576 Small Craft Status (Trimtab) #130

burckiratli opened this issue Dec 16, 2018 · 5 comments

Comments

@burckiratli
Copy link

burckiratli commented Dec 16, 2018

I have added this. It doesnt seem to have a problem can you check please?

// *******************************************************
// * 130576 Small Craft Status (Trimtab) *
// *******************************************************
// * Input: *
// *- Port Trim Tab *
// *- StarBoard Trim Tab *
// *- Reserved *
// *******************************************************
PGN: 130576 - Small Craft Status
Field #1: Port trim tab
Bits: 8
Signed: true
Field #2: Starboard trim tab
Bits: 8
Signed: true

<><><>N2KMessages.cpp<><><>

 //*****************************************************************************
 // Small Craft Status (Trimtab) 
 void SetN2kPGN130576(tN2kMsg &N2kMsg, int8_t PortTrimTab, int8_t StarboardTrimTab) {
     N2kMsg.SetPGN(130576L);
     N2kMsg.Priority=3;
     N2kMsg.AddByte(PortTrimTab); 
     N2kMsg.AddByte(StarboardTrimTab); 
     N2kMsg.AddByte(0xff); // Reserved 
 }
 //*****************************************************************************
 bool ParseN2kPGN130576(const tN2kMsg &N2kMsg, int8_t &PortTrimTab, int8_t &StarboardTrimTab) {
   if (N2kMsg.PGN!=130576L) return false;
   int Index=0;
   PortTrimTab=N2kMsg.GetByte(Index); 
   StarboardTrimTab=N2kMsg.GetByte(Index); 
   
   return true;
 }
 //*****************************************************************************

<><><>N2KMessages.h<><><>

 // Small Craft Status (Trimtab) 
 // Input:
 //  - PortTrimTab                   Tab Level % of full level
 //  - StarboardTrimTab              Tab Level % of full level
 // Output:
 //  - N2kMsg                NMEA2000 message ready to be send.
 void SetN2kPGN130576(tN2kMsg &N2kMsg, int8_t PortTrimTab=N2kInt8NA, int8_t StarboardTrimTab=N2kInt8NA);
 
 inline void SetN2kTrimtabLevel(tN2kMsg &N2kMsg, int8_t PortTrimTab=N2kInt8NA, int8_t StarboardTrimTab=N2kInt8NA) {
   SetN2kPGN130576(N2kMsg, PortTrimTab, StarboardTrimTab);
 }
 // Parse Trimtab message
 // Output:
 //  - PortTrimTab                   Tab Level % of full level
 //  - StarboardTrimTab              Tab Level % of full level
 bool ParseN2kPGN130576(const tN2kMsg &N2kMsg, int8_t &PortTrimTab, int8_t &StarboardTrimTab);
 
 inline bool ParseN2kTrimtabLevel(const tN2kMsg &N2kMsg, int8_t &PortTrimTab, int8_t &StarboardTrimTab) {
   return ParseN2kPGN130576(N2kMsg, PortTrimTab, StarboardTrimTab);
 }
 #endif
 //*****************************************************************************

<><><>NMEA2000.cpp<><><>

 130576L, // Small Craft Status
//*****************************************************************************
// System date/time  			126992
// Rudder            			127245
// Vessel Heading    			127250
// Rate of Turn      			127251
// Attitude      			127257
// Magnetic Variation			127258
// Engine parameters rapid   		127488
// Engine parameters dynamic		127489
// Transmission parameters, dynamic	127493
// DC Detailed Status			127506
// Battery Status			127508
// Battery Configuration Status		127513
// Boat speed				128259
// Water depth				128267
// Distance log				128275
// Lat/lon rapid			129025
// COG SOG rapid			129026
// GNSS Position Data			129029
// AIS position reports for Class A	129038
// AIS position reports for Class B	129039
// Cross Track Error			129283
// Navigation info			129284
// Waypoint list			129285
// AIS static data class A		129794
// AIS static data class B part A	129809
// AIS static data class B part B	129810
// Waypoint list			130074
// Wind Speed				130306
// Outside Environmental parameters	130310
// Environmental parameters		130311
// Temperature				130312
// Temperature				130316
// Small Craft Status (Trimtab) 	130576
//*****************************************************************************
@ttlappalainen
Copy link
Owner

I did not understood, what you mean - that was already on library. Anyway I found that values should be signed, so I have to fix the code to handle that right.

Also you have N2kMsg.Priority=3; Where did you got that? I do not have document for right send period and priority. So if you have certified device, which sends that PGN, please report, what priority and send period it uses.

@burckiratli
Copy link
Author

I am terribly sorry about opening this becouse i didnt checked your latest code. I wrote this code more then a year ago and decided to share but little after i noticed that you have wrote it allready. And i a m new to github and i didnt know how to delete this so is that i tried closing this as an issue.

@ttlappalainen
Copy link
Owner

That is OK. Anyway I'll fix handling within few days. I'll leave this open and inform, when I have done it.

And what about my question of priority and update speed?

@burckiratli
Copy link
Author

burckiratli commented Dec 26, 2018

http://forum.katera.ru/index.php?app=core&module=attach&section=attach&attach_id=135641 as far as i remember i have looked at here and https://www.maretron.com/support/manuals/USB100UM_1.7.pdf then i have examined your code and wrote it. I am no expert about NMEA bus, just trying to digitize my analog devices on my boat thanks to your source libraries.

@ttlappalainen
Copy link
Owner

This works right, except in case that for some reason send data length would be less than expected. In that case it will not return NA. I'll close this and fix it some day. There are other PGN:s, which has same problem.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants