1
0
mirror of https://github.com/thooge/esp32-nmea2000-obp60.git synced 2025-12-12 13:33:06 +01:00

Add direction pin function for NMEA0183

This commit is contained in:
norbert-walter
2022-01-25 21:51:44 +01:00
parent 8a776d355b
commit 29c72d359d
2 changed files with 14 additions and 2 deletions

View File

@@ -119,7 +119,7 @@ void OBP60Init(GwApi *api){
GwLog *logger=api->getLogger();
// Define timer interrupts
// Timer1.attach_ms(1, underVoltageDetection); // Maximum speed with 1ms
Timer1.attach_ms(1, underVoltageDetection); // Maximum speed with 1ms
Timer2.attach_ms(40, readKeypad); // Timer value nust grater than 30ms
Timer3.attach_ms(500, blinkingFlashLED);
@@ -159,6 +159,17 @@ void OBP60Init(GwApi *api){
else{
LOG_DEBUG(GwLog::DEBUG,"1Wire Mode is Off");
}
// Settings for NMEA0183
String nmea0183Mode = api->getConfig()->getConfigItem(api->getConfig()->serialDirection,true)->asString();
LOG_DEBUG(GwLog::DEBUG,"NMEA0183 Mode is: %s", nmea0183Mode);
pinMode(OBP_DIRECTION_PIN, OUTPUT);
if(String(nmea0183Mode) == "receive" || String(nmea0183Mode) == "off"){
digitalWrite(OBP_DIRECTION_PIN, false);
}
if(String(nmea0183Mode) == "send"){
digitalWrite(OBP_DIRECTION_PIN, true);
}
// Settings for backlight
String backlightMode = api->getConfig()->getConfigItem(api->getConfig()->backlight,true)->asString();