Skip to content

Commit

Permalink
RX/TX pinout from settings.h was set after SoftwareSerial was created…
Browse files Browse the repository at this point in the history
…. Moved to start
  • Loading branch information
Jan ten Hove committed Jun 16, 2017
1 parent 7149b76 commit 6b31020
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 4 deletions.
9 changes: 5 additions & 4 deletions GoodWeCommunicator.cpp
Original file line number Diff line number Diff line change
@@ -1,16 +1,17 @@
#include "GoodWeCommunicator.h"


GoodWeCommunicator::GoodWeCommunicator(SettingsManager * settingsManager, bool inDebug)
GoodWeCommunicator::GoodWeCommunicator(SettingsManager * settingsMan, bool inDebug)
{
auto settings = settingsManager->GetSettings();
//create the software serial on the custom pins so we can use the hardware serial for debug comms.
goodweSerial = new SoftwareSerial(settings->RS485Rx, settings->RS485Tx, false, BufferSize); // (RX, TX. inverted, buffer)
settingsManager = settingsMan;
debugMode = inDebug;
}

void GoodWeCommunicator::start()
{
auto settings = settingsManager->GetSettings();
//create the software serial on the custom pins so we can use the hardware serial for debug comms.
goodweSerial = new SoftwareSerial(settings->RS485Rx, settings->RS485Tx, false, BufferSize); // (RX, TX. inverted, buffer)
//start the software serial
goodweSerial->begin(9600); //inverter fixed baud rate

Expand Down
1 change: 1 addition & 0 deletions GoodWeCommunicator.h
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,7 @@ class GoodWeCommunicator

static const int BufferSize = 96; // largest packet is 67 bytes long. Extra for receiving with sliding window
SoftwareSerial * goodweSerial;
SettingsManager * settingsManager;

char headerBuffer[7];
char inputBuffer[BufferSize];
Expand Down

0 comments on commit 6b31020

Please sign in to comment.