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();

View File

@ -58,8 +58,9 @@ lib_deps = ${env.lib_deps}
build_flags =
-D BOARD_M5ATOM_CANUNIT
${env.build_flags}
upload_port = /dev/esp32
upload_port = COM13
upload_protocol = esptool
monitor_speed = 115200
[env:m5stickc-atom-canunit]
board = m5stick-c