NMEA2000 manufacturer names and a bit more logging
This commit is contained in:
@@ -55,7 +55,7 @@ bool Nmea2kTwai::CANOpen()
|
||||
}
|
||||
esp_err_t rt = twai_start();
|
||||
if (rt != ESP_OK) {
|
||||
LOGE(TAG, "CANOpen failed: %x", (int)rt);
|
||||
LOGE(TAG, "CANOpen failed: %x", rt);
|
||||
return false;
|
||||
} else {
|
||||
LOGI(TAG, "CANOpen ok");
|
||||
@@ -101,9 +101,9 @@ void Nmea2kTwai::initDriver()
|
||||
twai_filter_config_t f_config = TWAI_FILTER_CONFIG_ACCEPT_ALL();
|
||||
esp_err_t rt = twai_driver_install(&g_config, &t_config, &f_config);
|
||||
if (rt == ESP_OK) {
|
||||
// logDebug(LOG_INFO,"twai driver initialzed, rx=%d,tx=%d",(int)RxPin,(int)TxPin);
|
||||
LOGI(TAG, "twai driver initialzed, rx=%d,tx=%d", RxPin, TxPin);
|
||||
} else {
|
||||
// logDebug(LOG_ERR,"twai driver init failed: %x",(int)rt);
|
||||
LOGE(TAG,"twai driver init failed: %x", rt);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -115,7 +115,7 @@ void Nmea2kTwai::initDriver()
|
||||
void Nmea2kTwai::InitCANFrameBuffers()
|
||||
{
|
||||
if (disabled) {
|
||||
// logDebug(LOG_INFO,"twai init - disabled");
|
||||
LOGI(TAG, "twai init - disabled");
|
||||
} else{
|
||||
initDriver();
|
||||
}
|
||||
@@ -170,11 +170,11 @@ bool Nmea2kTwai::checkRecovery()
|
||||
if (canState.state == Nmea2kTwai::ST_BUS_OFF) {
|
||||
strt = true;
|
||||
bool rt = startRecovery();
|
||||
// logDebug(LOG_INFO, "twai BUS_OFF: start can recovery - result %d", (int)rt);
|
||||
LOGI(TAG, "twai BUS_OFF: start can recovery - result %d", rt);
|
||||
}
|
||||
if (canState.state == Nmea2kTwai::ST_STOPPED) {
|
||||
bool rt = CANOpen();
|
||||
// logDebug(LOG_INFO, "twai STOPPED: restart can driver - result %d", (int)rt);
|
||||
LOGI(TAG, "twai STOPPED: restart can driver - result %d", rt);
|
||||
}
|
||||
}
|
||||
return strt;
|
||||
@@ -185,20 +185,22 @@ void Nmea2kTwai::loop()
|
||||
if (disabled) {
|
||||
return;
|
||||
}
|
||||
LOGW(TAG, "twai loop() not implemented");
|
||||
// TODO?
|
||||
// timers.loop();
|
||||
}
|
||||
|
||||
Nmea2kTwai::Status Nmea2kTwai::logStatus()
|
||||
{
|
||||
Status canState = getStatus();
|
||||
/* logDebug(LOG_INFO, "twai state %s, rxerr %d, txerr %d, txfail %d, txtimeout %d, rxmiss %d, rxoverrun %d",
|
||||
stateStr(canState.state),
|
||||
canState.rx_errors,
|
||||
canState.tx_errors,
|
||||
canState.tx_failed,
|
||||
canState.tx_timeouts,
|
||||
canState.rx_missed,
|
||||
canState.rx_overrun); */
|
||||
LOGI(TAG, "twai state %s, rxerr %d, txerr %d, txfail %d, txtimeout %d, rxmiss %d, rxoverrun %d",
|
||||
stateStr(canState.state),
|
||||
canState.rx_errors,
|
||||
canState.tx_errors,
|
||||
canState.tx_failed,
|
||||
canState.tx_timeouts,
|
||||
canState.rx_missed,
|
||||
canState.rx_overrun);
|
||||
return canState;
|
||||
}
|
||||
|
||||
@@ -210,7 +212,7 @@ bool Nmea2kTwai::startRecovery()
|
||||
lastRecoveryStart = millis();
|
||||
esp_err_t rt = twai_driver_uninstall();
|
||||
if (rt != ESP_OK) {
|
||||
// logDebug(LOG_ERR,"twai: deinit for recovery failed with %x",(int)rt);
|
||||
LOGE(TAG, "twai: deinit for recovery failed with %x", rt);
|
||||
}
|
||||
initDriver();
|
||||
bool frt = CANOpen();
|
||||
@@ -229,3 +231,204 @@ const char * Nmea2kTwai::stateStr(const Nmea2kTwai::STATE &st)
|
||||
}
|
||||
return "ERROR";
|
||||
}
|
||||
const Nmea2kTwai::ManufacturerEntry Nmea2kTwai::ManufacturerTable[] = {
|
||||
{0, "Reserved"},
|
||||
{69, "ARKS Enterprises, Inc."},
|
||||
{78, "FW Murphy/Enovation Controls"},
|
||||
{80, "Twin Disc"},
|
||||
{85, "Kohler Power Systems"},
|
||||
{88, "Hemisphere GPS Inc"},
|
||||
{116, "BEP Marine"},
|
||||
{135, "Airmar"},
|
||||
{137, "Maretron"},
|
||||
{140, "Lowrance"},
|
||||
{144, "Mercury Marine"},
|
||||
{147, "Nautibus Electronic GmbH"},
|
||||
{148, "Blue Water Data"},
|
||||
{154, "Westerbeke"},
|
||||
{161, "Offshore Systems (UK) Ltd."},
|
||||
{163, "Evinrude/BRP"},
|
||||
{165, "CPAC Systems AB"},
|
||||
{168, "Xantrex Technology Inc."},
|
||||
{172, "Yanmar Marine"},
|
||||
{174, "Volvo Penta"},
|
||||
{175, "Honda Marine"},
|
||||
{176, "Carling Technologies Inc. (Moritz Aerospace)"},
|
||||
{185, "Beede Instruments"},
|
||||
{192, "Floscan Instrument Co. Inc."},
|
||||
{193, "Nobletec"},
|
||||
{198, "Mystic Valley Communications"},
|
||||
{199, "Actia"},
|
||||
{200, "Honda Marine"},
|
||||
{201, "Disenos Y Technologia"},
|
||||
{211, "Digital Switching Systems"},
|
||||
{215, "Xintex/Atena"},
|
||||
{224, "EMMI NETWORK S.L."},
|
||||
{225, "Honda Marine"},
|
||||
{228, "ZF"},
|
||||
{229, "Garmin"},
|
||||
{233, "Yacht Monitoring Solutions"},
|
||||
{235, "Sailormade Marine Telemetry/Tetra Technology LTD"},
|
||||
{243, "Eride"},
|
||||
{250, "Honda Marine"},
|
||||
{257, "Honda Motor Company LTD"},
|
||||
{272, "Groco"},
|
||||
{273, "Actisense"},
|
||||
{274, "Amphenol LTW Technology"},
|
||||
{275, "Navico"},
|
||||
{283, "Hamilton Jet"},
|
||||
{285, "Sea Recovery"},
|
||||
{286, "Coelmo SRL Italy"},
|
||||
{295, "BEP Marine"},
|
||||
{304, "Empir Bus"},
|
||||
{305, "NovAtel"},
|
||||
{306, "Sleipner Motor AS"},
|
||||
{307, "MBW Technologies"},
|
||||
{311, "Fischer Panda"},
|
||||
{315, "ICOM"},
|
||||
{328, "Qwerty"},
|
||||
{329, "Dief"},
|
||||
{341, "Böning Automationstechnologie GmbH & Co. KG"},
|
||||
{345, "Korean Maritime University"},
|
||||
{351, "Thrane and Thrane"},
|
||||
{355, "Mastervolt"},
|
||||
{356, "Fischer Panda Generators"},
|
||||
{358, "Victron Energy"},
|
||||
{370, "Rolls Royce Marine"},
|
||||
{373, "Electronic Design"},
|
||||
{374, "Northern Lights"},
|
||||
{378, "Glendinning"},
|
||||
{381, "B & G"},
|
||||
{384, "Rose Point Navigation Systems"},
|
||||
{385, "Johnson Outdoors Marine Electronics Inc Geonav"},
|
||||
{394, "Capi 2"},
|
||||
{396, "Beyond Measure"},
|
||||
{400, "Livorsi Marine"},
|
||||
{404, "ComNav"},
|
||||
{409, "Chetco"},
|
||||
{419, "Fusion Electronics"},
|
||||
{421, "Standard Horizon"},
|
||||
{422, "True Heading AB"},
|
||||
{426, "Egersund Marine Electronics AS"},
|
||||
{427, "em-trak Marine Electronics"},
|
||||
{431, "Tohatsu Co, JP"},
|
||||
{437, "Digital Yacht"},
|
||||
{438, "Comar Systems Limited"},
|
||||
{440, "Cummins"},
|
||||
{443, "VDO (aka Continental-Corporation)"},
|
||||
{451, "Parker Hannifin aka Village Marine Tech"},
|
||||
{459, "Alltek Marine Electronics Corp"},
|
||||
{460, "SAN GIORGIO S.E.I.N"},
|
||||
{466, "Veethree Electronics & Marine"},
|
||||
{467, "Humminbird Marine Electronics"},
|
||||
{470, "SI-TEX Marine Electronics"},
|
||||
{471, "Sea Cross Marine AB"},
|
||||
{475, "GME aka Standard Communications Pty LTD"},
|
||||
{476, "Humminbird Marine Electronics"},
|
||||
{478, "Ocean Sat BV"},
|
||||
{481, "Chetco Digitial Instruments"},
|
||||
{493, "Watcheye"},
|
||||
{499, "Lcj Capteurs"},
|
||||
{502, "Attwood Marine"},
|
||||
{503, "Naviop S.R.L."},
|
||||
{504, "Vesper Marine Ltd"},
|
||||
{510, "Marinesoft Co. LTD"},
|
||||
{517, "NoLand Engineering"},
|
||||
{518, "Transas USA"},
|
||||
{529, "National Instruments Korea"},
|
||||
{532, "Onwa Marine"},
|
||||
{571, "Marinecraft (South Korea)"},
|
||||
{573, "McMurdo Group aka Orolia LTD"},
|
||||
{578, "Advansea"},
|
||||
{579, "KVH"},
|
||||
{580, "San Jose Technology"},
|
||||
{583, "Yacht Control"},
|
||||
{586, "Suzuki Motor Corporation"},
|
||||
{591, "US Coast Guard"},
|
||||
{595, "Ship Module aka Customware"},
|
||||
{600, "Aquatic AV"},
|
||||
{605, "Aventics GmbH"},
|
||||
{606, "Intellian"},
|
||||
{612, "SamwonIT"},
|
||||
{614, "Arlt Tecnologies"},
|
||||
{637, "Bavaria Yacts"},
|
||||
{641, "Diverse Yacht Services"},
|
||||
{644, "Wema U.S.A dba KUS"},
|
||||
{645, "Garmin"},
|
||||
{658, "Shenzhen Jiuzhou Himunication"},
|
||||
{688, "Rockford Corp"},
|
||||
{704, "JL Audio"},
|
||||
{715, "Autonnic"},
|
||||
{717, "Yacht Devices"},
|
||||
{734, "REAP Systems"},
|
||||
{735, "Au Electronics Group"},
|
||||
{739, "LxNav"},
|
||||
{743, "DaeMyung"},
|
||||
{744, "Woosung"},
|
||||
{773, "Clarion US"},
|
||||
{776, "HMI Systems"},
|
||||
{777, "Ocean Signal"},
|
||||
{778, "Seekeeper"},
|
||||
{781, "Poly Planar"},
|
||||
{785, "Fischer Panda DE"},
|
||||
{795, "Broyda Industries"},
|
||||
{796, "Canadian Automotive"},
|
||||
{797, "Tides Marine"},
|
||||
{798, "Lumishore"},
|
||||
{799, "Still Water Designs and Audio"},
|
||||
{802, "BJ Technologies (Beneteau)"},
|
||||
{803, "Gill Sensors"},
|
||||
{811, "Blue Water Desalination"},
|
||||
{815, "FLIR"},
|
||||
{824, "Undheim Systems"},
|
||||
{838, "TeamSurv"},
|
||||
{844, "Fell Marine"},
|
||||
{847, "Oceanvolt"},
|
||||
{862, "Prospec"},
|
||||
{868, "Data Panel Corp"},
|
||||
{890, "L3 Technologies"},
|
||||
{894, "Rhodan Marine Systems"},
|
||||
{896, "Nexfour Solutions"},
|
||||
{905, "ASA Electronics"},
|
||||
{909, "Marines Co (South Korea)"},
|
||||
{911, "Nautic-on"},
|
||||
{930, "Ecotronix"},
|
||||
{962, "Timbolier Industries"},
|
||||
{963, "TJC Micro"},
|
||||
{968, "Cox Powertrain"},
|
||||
{969, "Blue Seas"},
|
||||
{1850, "Teleflex Marine (SeaStar Solutions)"},
|
||||
{1851, "Raymarine"},
|
||||
{1852, "Navionics"},
|
||||
{1853, "Japan Radio Co"},
|
||||
{1854, "Northstar Technologies"},
|
||||
{1855, "Furuno"},
|
||||
{1856, "Trimble"},
|
||||
{1857, "Simrad"},
|
||||
{1858, "Litton"},
|
||||
{1859, "Kvasar AB"},
|
||||
{1860, "MMP"},
|
||||
{1861, "Vector Cantech"},
|
||||
{1862, "Yamaha Marine"},
|
||||
{1863, "Faria Instruments"},
|
||||
{2046, "Open Boat Projects"}
|
||||
};
|
||||
|
||||
const char* Nmea2kTwai::GetManufacturerName(uint16_t code) {
|
||||
constexpr size_t ManufacturerCount =
|
||||
sizeof(Nmea2kTwai::ManufacturerTable) /
|
||||
sizeof(Nmea2kTwai::ManufacturerTable[0]);
|
||||
int low = 0;
|
||||
int high = ManufacturerCount - 1;
|
||||
|
||||
while (low <= high) {
|
||||
int mid = (low + high) / 2;
|
||||
uint16_t midCode = ManufacturerTable[mid].code;
|
||||
|
||||
if (midCode == code) return ManufacturerTable[mid].name;
|
||||
if (midCode < code) low = mid + 1;
|
||||
else high = mid - 1;
|
||||
}
|
||||
return "Unknown";
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user