Skip to content

Commit

Permalink
fix input pullup issue
Browse files Browse the repository at this point in the history
  • Loading branch information
soundanalogous committed Feb 17, 2016
1 parent 4ecc460 commit 38b7bd4
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 13 deletions.
2 changes: 1 addition & 1 deletion library.properties
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
name=ConfigurableFirmata
version=2.8.1
version=2.8.2
author=Firmata Developers
maintainer=https://github.com/firmata/ConfigurableFirmata
sentence=This library implements the Firmata protocol as a set of plugins that can be used to create applications to remotely interface with an Arduino board.
Expand Down
2 changes: 1 addition & 1 deletion src/ConfigurableFirmata.cpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
ConfigurableFirmata.pp - ConfigurableFirmata library v2.8.1 - 2016-1-23
ConfigurableFirmata.pp - ConfigurableFirmata library v2.8.2 - 2016-2-16
Copyright (c) 2006-2008 Hans-Christoph Steiner. All rights reserved.
Copyright (c) 2013 Norbert Truchsess. All rights reserved.
Copyright (c) 2013-2016 Jeff Hoefs. All rights reserved.
Expand Down
6 changes: 3 additions & 3 deletions src/ConfigurableFirmata.h
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
ConfigurableFirmata.h - ConfigurableFirmata library v2.8.1 - 2016-1-23
ConfigurableFirmata.h - ConfigurableFirmata library v2.8.2 - 2016-2-16
Copyright (c) 2006-2008 Hans-Christoph Steiner. All rights reserved.
Copyright (c) 2013 Norbert Truchsess. All rights reserved.
Copyright (c) 2013-2016 Jeff Hoefs. All rights reserved.
Expand Down Expand Up @@ -33,7 +33,7 @@
*/
#define FIRMATA_FIRMWARE_MAJOR_VERSION 2 // for non-compatible changes
#define FIRMATA_FIRMWARE_MINOR_VERSION 8 // for backwards compatible changes
#define FIRMATA_FIRMWARE_BUGFIX_VERSION 1 // for bugfix releases
#define FIRMATA_FIRMWARE_BUGFIX_VERSION 2 // for bugfix releases

// DEPRECATED as of ConfigurableFirmata v2.8.1.
// Use FIRMATA_PROTOCOL_[MAJOR|MINOR|BUGFIX]_VERSION instead.
Expand All @@ -44,7 +44,7 @@
//Use FIRMATA_FIRMWARE_[MAJOR|MINOR|BUGFIX]_VERSION instead.
#define FIRMWARE_MAJOR_VERSION 2
#define FIRMWARE_MINOR_VERSION 8
#define FIRMWARE_BUGFIX_VERSION 1
#define FIRMWARE_BUGFIX_VERSION 2

#define MAX_DATA_BYTES 64 // max number of data bytes in incoming messages

Expand Down
15 changes: 7 additions & 8 deletions src/DigitalOutputFirmata.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
Copyright (C) 2010-2011 Paul Stoffregen. All rights reserved.
Copyright (C) 2009 Shigeru Kobayashi. All rights reserved.
Copyright (C) 2013 Norbert Truchsess. All rights reserved.
Copyright (C) 2009-2015 Jeff Hoefs. All rights reserved.
Copyright (C) 2009-2016 Jeff Hoefs. All rights reserved.
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
Expand All @@ -13,7 +13,7 @@
See file LICENSE.txt for further informations on licensing terms.
Last updated by Jeff Hoefs: November 15th, 2015
Last updated by Jeff Hoefs: February 16th, 2016
*/

#include <ConfigurableFirmata.h>
Expand Down Expand Up @@ -61,7 +61,7 @@ void DigitalOutputFirmata::reset()

void DigitalOutputFirmata::digitalWritePort(byte port, int value)
{
byte pin, lastPin, pinValue, pinMode, mask = 1, pinWriteMask = 0;
byte pin, lastPin, pinValue, mask = 1, pinWriteMask = 0;

if (port < TOTAL_PORTS) {
// create a mask of the pins on this port that are writable.
Expand All @@ -70,14 +70,13 @@ void DigitalOutputFirmata::digitalWritePort(byte port, int value)
for (pin = port * 8; pin < lastPin; pin++) {
// do not disturb non-digital pins (eg, Rx & Tx)
if (IS_PIN_DIGITAL(pin)) {
pinMode = Firmata.getPinMode(pin);
// do not touch pins in PWM, ANALOG, SERVO or other modes
if (pinMode == OUTPUT || pinMode == INPUT) {
if (Firmata.getPinMode(pin) == OUTPUT || Firmata.getPinMode(pin) == INPUT) {
pinValue = ((byte)value & mask) ? 1 : 0;
if (pinMode == OUTPUT) {
if (Firmata.getPinMode(pin) == OUTPUT) {
pinWriteMask |= mask;
} else if (pinMode == INPUT && pinValue == 1 && Firmata.getPinState(pin) != 1) {
Firmata.setPinMode(pin, INPUT_PULLUP);
} else if (Firmata.getPinMode(pin) == INPUT && pinValue == 1 && Firmata.getPinState(pin) != 1) {
pinMode(pin, INPUT_PULLUP);
}
Firmata.setPinState(pin, pinValue);
}
Expand Down

0 comments on commit 38b7bd4

Please sign in to comment.