Skip to content

Commit

Permalink
More pin-mode fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
SRGDamia1 committed Jul 14, 2017
1 parent 1a48670 commit 6bafb0f
Show file tree
Hide file tree
Showing 8 changed files with 11 additions and 8 deletions.
2 changes: 1 addition & 1 deletion src/AOSongDHT.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ AOSongDHT::AOSongDHT(int powerPin, int dataPin, DHTtype type)
SENSOR_STATUS AOSongDHT::setup(void)
{
if (_powerPin > 0) pinMode(_powerPin, OUTPUT);
pinMode(_dataPin, INPUT);
pinMode(_dataPin, INPUT_PULLUP);

// Start up the sensor
dht_internal.begin();
Expand Down
2 changes: 1 addition & 1 deletion src/DecagonSDI12.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ DecagonSDI12::DecagonSDI12(int SDI12address, int powerPin, int dataPin,
SENSOR_STATUS DecagonSDI12::setup(void)
{
if (_powerPin > 0) pinMode(_powerPin, OUTPUT);
pinMode(_dataPin, INPUT_PULLUP);
pinMode(_dataPin, INPUT_PULLUP_PULLUP);

bool isSet = getSensorInfo();

Expand Down
4 changes: 2 additions & 2 deletions src/LoggerBase.h
Original file line number Diff line number Diff line change
Expand Up @@ -573,7 +573,7 @@ class Logger : public VariableArray
virtual void checkForDebugMode(int buttonPin, Stream *stream = &Serial)
{
// Set the pin attached to some button to enter debug mode
pinMode(buttonPin, INPUT);
if (buttonPin > 0) pinMode(buttonPin, INPUT_PULLUP);

// Flash the LED to let user know it is now possible to enter debug mode
for (uint8_t i = 0; i < 15; i++)
Expand Down Expand Up @@ -608,7 +608,7 @@ class Logger : public VariableArray
delay(100);

// Set up pins for the LED's
pinMode(_ledPin, OUTPUT);
if (_ledPin > 0) pinMode(_ledPin, OUTPUT);

// Set up the sensors
setupSensors();
Expand Down
2 changes: 1 addition & 1 deletion src/LoggerEnviroDIY.h
Original file line number Diff line number Diff line change
Expand Up @@ -203,7 +203,7 @@ class LoggerEnviroDIY : public Logger
delay(100);

// Set up pins for the LED's
pinMode(_ledPin, OUTPUT);
if (_ledPin > 0) pinMode(_ledPin, OUTPUT);

// Set up the sensors
setupSensors();
Expand Down
2 changes: 1 addition & 1 deletion src/MaximDS18.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,7 @@ SENSOR_STATUS MaximDS18::getStatus(void)
SENSOR_STATUS MaximDS18::setup(void)
{
if (_powerPin > 0) pinMode(_powerPin, OUTPUT);
pinMode(_dataPin, INPUT);
pinMode(_dataPin, INPUT_PULLUP);

// Check if the power is on, turn it on if not (Need power to get address)
bool wasOn = checkPowerOn();
Expand Down
2 changes: 1 addition & 1 deletion src/ModemOnOff.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ void ModemOnOff::init(int vcc33Pin, int onoff_DTR_pin, int status_CTS_pin)
}
if (status_CTS_pin >= 0) {
_status_CTS_pin = status_CTS_pin;
pinMode(_status_CTS_pin, INPUT);
pinMode(_status_CTS_pin, INPUT_PULLUP);
}
DBGM(F(" ... Success!\n"));
}
Expand Down
2 changes: 1 addition & 1 deletion src/SensorBase.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,7 @@ void Sensor::waitForWarmUp(void)
SENSOR_STATUS Sensor::setup(void)
{
if (_powerPin > 0) pinMode(_powerPin, OUTPUT);
pinMode(_dataPin, INPUT);
if (_dataPin > 0) pinMode(_dataPin, INPUT_PULLUP);

DBGS(F("Set up "));
DBGS(getSensorName());
Expand Down
3 changes: 3 additions & 0 deletions src/VariableArray.h
Original file line number Diff line number Diff line change
Expand Up @@ -89,10 +89,12 @@ class VariableArray
PRINTOUT(F("Beginning setup for sensors and variables..."));

// First wake up all of the sensors
DBGVA(F("Waking sensors for setup.\n"));
for (int i = 0; i < _variableCount; i++)
_variableList[i]->parentSensor->wake();

// Now run all the set-up functions
DBGVA(F("Running setup functions.\n"));
for (int i = 0; i < _variableCount; i++)
{
// Make 5 attempts to contact the sensor before giving up
Expand Down Expand Up @@ -121,6 +123,7 @@ class VariableArray
}

// Put all the sensors back to sleep
DBGVA(F("Putting sensors to sleep after setup.\n"));
for (int i = 0; i < _variableCount; i++)
_variableList[i]->parentSensor->sleep();

Expand Down

0 comments on commit 6bafb0f

Please sign in to comment.